From: azv Date: Sat, 25 Nov 2017 15:56:21 +0000 (+0300) Subject: Issue #2299: Wrong face support of sketch in script from python dump X-Git-Tag: V_2.10.0RC~142 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b375a060800d22b49e4a6752bcdab09917a69cfe;p=modules%2Fshaper.git Issue #2299: Wrong face support of sketch in script from python dump Use BRepTools_WireExplorer instead of TopExp_Explorer when building sketch face, because it takes into account the connectivity of the wire. --- diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp index eadaee6c6..a6da1e785 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -63,7 +64,7 @@ static TopoDS_Vertex findStartVertex(const TopoDS_Shape& theShape) return aStart; } -static TopoDS_Vertex findStartVertex(const TopoDS_Shape& theShape, +static TopoDS_Vertex findStartVertex(const TopoDS_Wire& theWire, const TopoDS_Face& theFace, const std::list >& theInitialShapes) { // Try to find edge lying on the one of original edges. @@ -80,9 +81,9 @@ static TopoDS_Vertex findStartVertex(const TopoDS_Shape& theShape, if (aCurve->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve)) aCurve = Handle(Geom_TrimmedCurve)::DownCast(aCurve)->BasisCurve(); - TopExp_Explorer anExp(theShape, TopAbs_EDGE); + BRepTools_WireExplorer anExp(theWire, theFace); for (; anExp.More(); anExp.Next()) { - const TopoDS_Edge& aShapeEdge = TopoDS::Edge(anExp.Current()); + const TopoDS_Edge& aShapeEdge = anExp.Current(); double aF, aL; Handle(Geom_Curve) aShapeCurve = BRep_Tool::Curve(aShapeEdge, aF, aL); if (aShapeCurve->DynamicType() == STANDARD_TYPE(Geom_TrimmedCurve)) @@ -99,7 +100,7 @@ static TopoDS_Vertex findStartVertex(const TopoDS_Shape& theShape, } // start vertex is not found, use algorithm to search vertex with the greatest coordinates - return findStartVertex(theShape); + return findStartVertex(theWire); } // returns true if the first shape must be located earlier than the second @@ -247,7 +248,7 @@ void GeomAlgoAPI_SketchBuilder::createFaces( // to make faces equal on different platforms, we will find // a vertex lying on an edge with the lowest index in the list of initial edges - TopoDS_Vertex aStartVertex = findStartVertex(aWire, theFeatures); + TopoDS_Vertex aStartVertex = findStartVertex(aWire, aFace, theFeatures); TopoDS_Wire aNewWire; aBuilder.MakeWire(aNewWire); @@ -255,12 +256,12 @@ void GeomAlgoAPI_SketchBuilder::createFaces( bool aStartFound = false; // remove internal edges from faces and make wire start from found vertex - TopExp_Explorer anExp(aWire, TopAbs_EDGE); + BRepTools_WireExplorer anExp(aWire, aFace); for (; anExp.More(); anExp.Next()) { if (anExp.Current().Orientation() == TopAbs_INTERNAL) continue; if (!aStartFound) { - const TopoDS_Edge& anEdge = TopoDS::Edge(anExp.Current()); + const TopoDS_Edge& anEdge = anExp.Current(); TopoDS_Vertex aV1, aV2; TopExp::Vertices(anEdge, aV1, aV2, Standard_True); if (aV1.IsSame(aStartVertex) == Standard_True) @@ -277,7 +278,7 @@ void GeomAlgoAPI_SketchBuilder::createFaces( aBuilder.Add(aNewWire, *aSkIt); // check the wire is empty - anExp.Init(aNewWire, TopAbs_EDGE); + anExp.Init(aNewWire); if (anExp.More()) aBuilder.Add(aNewFace, aNewWire); }