From: dbv Date: Tue, 5 Apr 2016 07:54:07 +0000 (+0300) Subject: Issue #1343 Fixes for creating extrusion on vertex X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=63daee7f87b5ed9537d743f7eb77ef84ee879f17;p=modules%2Fshaper.git Issue #1343 Fixes for creating extrusion on vertex --- diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp index b971c401a..35918e17f 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp @@ -31,6 +31,8 @@ #include #include +#include + //================================================================================================= GeomAlgoAPI_Prism::GeomAlgoAPI_Prism(const GeomShapePtr theBaseShape, const double theToSize, @@ -100,6 +102,9 @@ void GeomAlgoAPI_Prism::build(const GeomShapePtr& theBaseShape, return; } + aBaseDir = theDirection; + aDirVec = theDirection->impl(); + } else { Handle(Geom_Plane) aPlane = aFindPlane.Plane(); gp_Pnt aLoc = aPlane->Axis().Location(); aDirVec = aPlane->Axis().Direction(); @@ -136,7 +141,21 @@ void GeomAlgoAPI_Prism::build(const GeomShapePtr& theBaseShape, aResult = aPrismBuilder->Shape(); // Setting naming. - for(TopExp_Explorer anExp(aMovedBase, TopAbs_FACE); anExp.More(); anExp.Next()) { + TopAbs_ShapeEnum aShapeTypeToExp; + switch(aMovedBase.ShapeType()) { + case TopAbs_VERTEX: + aShapeTypeToExp = TopAbs_VERTEX; + break; + case TopAbs_EDGE: + case TopAbs_WIRE: + aShapeTypeToExp = TopAbs_EDGE; + break; + case TopAbs_FACE: + case TopAbs_SHELL: + aShapeTypeToExp = TopAbs_FACE; + break; + } + for(TopExp_Explorer anExp(aMovedBase, aShapeTypeToExp); anExp.More(); anExp.Next()) { const TopoDS_Shape& aFace = anExp.Current(); GeomShapePtr aFromShape(new GeomAPI_Shape), aToShape(new GeomAPI_Shape); aFromShape->setImpl(new TopoDS_Shape(aPrismBuilder->FirstShape(aFace))); @@ -295,6 +314,9 @@ void GeomAlgoAPI_Prism::build(const GeomShapePtr& theBaseShape, this->addToShape(aShape); } aResult = aToCutBuilder->Shape(); + if(aResult.ShapeType() == TopAbs_COMPOUND) { + aResult = GeomAlgoAPI_DFLoader::refineResult(aResult); + } // Cutting with from plane. BRepAlgoAPI_Cut* aFromCutBuilder = new BRepAlgoAPI_Cut(aResult, aFromSolid); @@ -311,8 +333,8 @@ void GeomAlgoAPI_Prism::build(const GeomShapePtr& theBaseShape, } aResult = aFromCutBuilder->Shape(); - TopExp_Explorer anExp(aResult, TopAbs_SOLID); - if(!anExp.More()) { + TopoDS_Iterator anIt(aResult); + if(!anIt.More()) { return; } if(aResult.ShapeType() == TopAbs_COMPOUND) {