From: azv Date: Tue, 26 Jul 2016 08:06:54 +0000 (+0300) Subject: Update split shape for correct processing of closed edges X-Git-Tag: V_2.5.0~173 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1ad74436601ac5f8d43d01b2a1d7f9ff6521b223;p=modules%2Fshaper.git Update split shape for correct processing of closed edges --- diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp index 6fa8f4b31..247e6126e 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -676,7 +677,21 @@ void GeomAlgoAPI_ShapeTools::splitShape(const std::shared_ptr& th { // General Fuse to split edge by vertices BOPAlgo_Builder aBOP; - const TopoDS_Edge& aBaseEdge = theBaseShape->impl(); + TopoDS_Edge aBaseEdge = theBaseShape->impl(); + // Rebuild closed edge to place vertex to one of split points. + // This will prevent edge to be split on seam vertex. + if (BRep_Tool::IsClosed(aBaseEdge)) + { + Standard_Real aFirst, aLast; + Handle(Geom_Curve) aCurve = BRep_Tool::Curve(aBaseEdge, aFirst, aLast); + + std::set >::const_iterator aPIt = thePoints.begin(); + gp_Pnt aPoint((*aPIt)->x(), (*aPIt)->y(), (*aPIt)->z()); + + TopAbs_Orientation anOrientation = aBaseEdge.Orientation(); + aBaseEdge = BRepBuilderAPI_MakeEdge(aCurve, aPoint, aPoint).Edge(); + aBaseEdge.Orientation(anOrientation); + } aBOP.AddArgument(aBaseEdge); std::set >::const_iterator aPtIt = thePoints.begin();