generalize preview mode

This commit is contained in:
Stefan Tröger
2015-05-31 07:34:38 +02:00
parent 31ac29501c
commit 254e2226ba
10 changed files with 410 additions and 230 deletions

View File

@@ -196,7 +196,42 @@ App::DocumentObjectExecReturn *Pipe::execute(void)
if(!mkSolid.IsDone())
return new App::DocumentObjectExecReturn("Result is not a solid");
this->Shape.setValue(mkSolid.Shape());
AddSubShape.setValue(mkSolid.Shape());
if(base.IsNull()) {
Shape.setValue(mkSolid.Shape());
return App::DocumentObject::StdReturn;
}
if(getAddSubType() == FeatureAddSub::Additive) {
BRepAlgoAPI_Fuse mkFuse(base, mkSolid.Shape());
if (!mkFuse.IsDone())
return new App::DocumentObjectExecReturn("Adding the pipe failed");
// we have to get the solids (fuse sometimes creates compounds)
TopoDS_Shape boolOp = this->getSolid(mkFuse.Shape());
// lets check if the result is a solid
if (boolOp.IsNull())
return new App::DocumentObjectExecReturn("Resulting shape is not a solid");
boolOp = refineShapeIfActive(boolOp);
Shape.setValue(boolOp);
}
else if(getAddSubType() == FeatureAddSub::Subtractive) {
BRepAlgoAPI_Cut mkCut(base, mkSolid.Shape());
if (!mkCut.IsDone())
return new App::DocumentObjectExecReturn("Subtracting the pipe failed");
// we have to get the solids (fuse sometimes creates compounds)
TopoDS_Shape boolOp = this->getSolid(mkCut.Shape());
// lets check if the result is a solid
if (boolOp.IsNull())
return new App::DocumentObjectExecReturn("Resulting shape is not a solid");
boolOp = refineShapeIfActive(boolOp);
Shape.setValue(boolOp);
}
return App::DocumentObject::StdReturn;
return SketchBased::execute();