From: mpv Date: Fri, 12 Sep 2014 06:17:45 +0000 (+0400) Subject: Issue #110: make only faces are used for extrusion to generate solids only X-Git-Tag: V_0.4.4~67^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=80e970c4bb1a8a159ec42d77cdb36f638de4945e;p=modules%2Fshaper.git Issue #110: make only faces are used for extrusion to generate solids only --- 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); }