From 530f5aff42069e844c4a4ef164088ea23ba0e2dd Mon Sep 17 00:00:00 2001 From: dbv Date: Tue, 5 Apr 2016 10:54:07 +0300 Subject: [PATCH] Issue #1343 Fixes for creating extrusion on vertex --- src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp | 28 ++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) 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) { -- 2.39.2