From d21f339a0f3fffd8f6b1caae0a861ae59d29f4a5 Mon Sep 17 00:00:00 2001 From: DeepSOIC Date: Tue, 4 Oct 2016 21:51:58 +0300 Subject: [PATCH] Part: Extrude, Revolve: fix #2720 - relax action of Solid=true When facemakers were introduced, Solid property of Revolve and Extrude was made strict: it calls facemaker if Solid==true, and facemaker would fail if shape being extruded/revolved is a face. This is fixed by testing there are no faces in source shape prior to calling facemaker. --- src/Mod/Part/App/FeatureExtrusion.cpp | 7 ++++--- src/Mod/Part/App/FeatureRevolution.cpp | 12 +++++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/Mod/Part/App/FeatureExtrusion.cpp b/src/Mod/Part/App/FeatureExtrusion.cpp index bb63c77bb..aafb265ec 100644 --- a/src/Mod/Part/App/FeatureExtrusion.cpp +++ b/src/Mod/Part/App/FeatureExtrusion.cpp @@ -296,10 +296,11 @@ TopoShape Extrusion::extrudeShape(const TopoShape source, Extrusion::ExtrusionPa //make faces from wires if (params.solid) { - if (myShape.ShapeType() == TopAbs_FACE && params.faceMakerClass == "Part::FaceMakerExtrusion"){ - //legacy exclusion: ignore "solid" if extruding a face. + //test if we need to make faces from wires. If there are faces - we don't. + TopExp_Explorer xp(myShape, TopAbs_FACE); + if (xp.More()){ + //source shape has faces. Just extrude as-is. } else { - //new strict behavior. If solid==True => make faces from wires, and if myShape not wires - fail! std::unique_ptr mkFace = FaceMaker::ConstructFromType(params.faceMakerClass.c_str()); if (myShape.ShapeType() == TopAbs_COMPOUND) diff --git a/src/Mod/Part/App/FeatureRevolution.cpp b/src/Mod/Part/App/FeatureRevolution.cpp index dd8d5353b..73f7c5dbf 100644 --- a/src/Mod/Part/App/FeatureRevolution.cpp +++ b/src/Mod/Part/App/FeatureRevolution.cpp @@ -28,6 +28,7 @@ # include # include # include +# include #endif @@ -166,8 +167,15 @@ App::DocumentObjectExecReturn *Revolution::execute(void) sourceShape.setShape(sourceShape.getShape().Moved(loc)); } - //do it! + //"make solid" processing: make faces from wires. Standard_Boolean makeSolid = Solid.getValue() ? Standard_True : Standard_False; + if (makeSolid){ + //test if we need to make faces from wires. If there are faces - we don't. + TopExp_Explorer xp(sourceShape.getShape(), TopAbs_FACE); + if (xp.More()) + //source shape has faces. Just revolve as-is. + makeSolid = Standard_False; + } if (makeSolid && strlen(this->FaceMakerClass.getValue())>0){ //new facemaking behavior: use facemaker class std::unique_ptr mkFace = FaceMaker::ConstructFromType(this->FaceMakerClass.getValue()); @@ -183,6 +191,8 @@ App::DocumentObjectExecReturn *Revolution::execute(void) makeSolid = Standard_False;//don't ask TopoShape::revolve to make solid, as we've made faces... } + + // actual revolution! TopoDS_Shape revolve = sourceShape.revolve(revAx, angle, makeSolid); if (revolve.IsNull())