From 1ad74436601ac5f8d43d01b2a1d7f9ff6521b223 Mon Sep 17 00:00:00 2001 From: azv Date: Tue, 26 Jul 2016 11:06:54 +0300 Subject: [PATCH] Update split shape for correct processing of closed edges --- src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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(); -- 2.39.2