handle possible crashes with FaceMaker and fix a few coding flaws

This commit is contained in:
wmayer
2016-10-02 14:47:59 +02:00
parent 679bb2f5a8
commit da406cddb8
11 changed files with 48 additions and 28 deletions

View File

@@ -170,8 +170,13 @@ App::DocumentObjectExecReturn *Revolution::execute(void)
Standard_Boolean makeSolid = Solid.getValue() ? Standard_True : Standard_False;
if (makeSolid && strlen(this->FaceMakerClass.getValue())>0){
//new facemaking behavior: use facemaker class
std::unique_ptr<FaceMaker> fm_instance = FaceMaker::ConstructFromType(this->FaceMakerClass.getValue());
FaceMaker* mkFace = &(*(fm_instance));
std::unique_ptr<FaceMaker> mkFace = FaceMaker::ConstructFromType(this->FaceMakerClass.getValue());
if (!mkFace) {
std::stringstream out;
out << "Cannot create FaceMaker from abstract type " << this->FaceMakerClass.getValue();
throw Base::TypeError(out.str());
}
TopoDS_Shape myShape = sourceShape.getShape();
if(myShape.ShapeType() == TopAbs_COMPOUND)
mkFace->useCompound(TopoDS::Compound(myShape));