From f340b77e53c5b5ef931c6c1b39dbc79e7aa15c6d Mon Sep 17 00:00:00 2001 From: azv Date: Mon, 2 Mar 2020 13:31:19 +0300 Subject: [PATCH] Fix regression related to the order of wires on Sketch faces with holes, which appeared after migrating to OCCT 7.4.0 --- src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp index c193b3a83..94c7b7185 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp @@ -165,7 +165,7 @@ bool isFirst(const TopoDS_Shape& theFirst, const TopoDS_Shape& theSecond, } // sorts faces (in theAreas list) to make persistent order: by initial shapes edges -static void sortFaces(TopTools_ListOfShape& theAreas, +static void sortAreas(TopTools_ListOfShape& theAreas, const std::list >& theInitialShapes) { // collect indices of all edges to operate them quickly @@ -242,7 +242,7 @@ void GeomAlgoAPI_SketchBuilder::build( // Collect faces TopTools_ListOfShape anAreas = aBB->Modified(aPlnFace); - sortFaces(anAreas, theEdges); // sort faces by the edges in them + sortAreas(anAreas, theEdges); // sort faces by the edges in them TopTools_ListIteratorOfListOfShape anIt(anAreas); for (; anIt.More(); anIt.Next()) { TopoDS_Face aFace = TopoDS::Face(anIt.Value()); @@ -255,10 +255,16 @@ void GeomAlgoAPI_SketchBuilder::build( TopoDS_Face aNewFace; aBuilder.MakeFace(aNewFace, aPlane, Precision::Confusion()); - // iterate on wires + // sort wires according to the original edges as well as faces + TopTools_ListOfShape aWires; TopExp_Explorer aWireExp(aFace, TopAbs_WIRE); - for (; aWireExp.More(); aWireExp.Next()) { - TopoDS_Wire aWire = TopoDS::Wire(aWireExp.Current()); + for (; aWireExp.More(); aWireExp.Next()) + aWires.Append(aWireExp.Current()); + sortAreas(aWires, theEdges); + + // iterate on wires + for (TopTools_ListIteratorOfListOfShape aWIt(aWires); aWIt.More(); aWIt.Next()) { + TopoDS_Wire aWire = TopoDS::Wire(aWIt.Value()); // 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 -- 2.39.2