From 80e970c4bb1a8a159ec42d77cdb36f638de4945e Mon Sep 17 00:00:00 2001 From: mpv Date: Fri, 12 Sep 2014 10:17:45 +0400 Subject: [PATCH] Issue #110: make only faces are used for extrusion to generate solids only --- src/GeomAlgoAPI/GeomAlgoAPI_Extrusion.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Extrusion.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Extrusion.cpp index b7e475307..a236fc8bb 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Extrusion.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Extrusion.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include const double tolerance = Precision::Angular(); @@ -38,6 +39,9 @@ boost::shared_ptr GeomAlgoAPI_Extrusion::makeExtrusion( const TopoDS_Shape& aShape = theShape->impl(); TopExp_Explorer aFaceExp(aShape, TopAbs_FACE); + TopoDS_Compound aFaces; // use only faces from the shape: make compound for this + BRep_Builder aBuilder; + aBuilder.MakeCompound(aFaces); for (; aFaceExp.More(); aFaceExp.Next()) { const TopoDS_Face& aFace = (const TopoDS_Face&) aFaceExp.Current(); Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast(BRep_Tool::Surface(aFace)); @@ -50,10 +54,15 @@ boost::shared_ptr GeomAlgoAPI_Extrusion::makeExtrusion( isFirstNorm = false; } else if (!aShapeNormal.IsEqual(aNormal, tolerance)) // non-planar shapes is not supported for extrusion yet return boost::shared_ptr(); + aBuilder.Add(aFaces, aFace); } + if (aFaces.IsNull()) + return boost::shared_ptr(); boost::shared_ptr aDir( new GeomAPI_Dir(aShapeNormal.X(), aShapeNormal.Y(), aShapeNormal.Z())); - return GeomAlgoAPI_Extrusion::makeExtrusion(theShape, aDir, theSize); + boost::shared_ptr aFacesShape(new (GeomAPI_Shape)); + aFacesShape->setImpl(new TopoDS_Shape(aFaces)); + return GeomAlgoAPI_Extrusion::makeExtrusion(aFacesShape, aDir, theSize); } -- 2.39.2