Salome HOME
Continue fixing regression with incorrect order of inner wires (sort inner wires...
authorazv <azv@opencascade.com>
Tue, 3 Mar 2020 09:37:16 +0000 (12:37 +0300)
committerazv <azv@opencascade.com>
Tue, 3 Mar 2020 09:38:19 +0000 (12:38 +0300)
src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp

index 94c7b718562a7c9202cf8c16bdf21818891ce8f9..dff098d9950e102917290632ebc795427cfea3f6 100644 (file)
@@ -255,12 +255,17 @@ void GeomAlgoAPI_SketchBuilder::build(
     TopoDS_Face aNewFace;
     aBuilder.MakeFace(aNewFace, aPlane, Precision::Confusion());
 
-    // sort wires according to the original edges as well as faces
+    // sort inner wires according to the original edges as well as faces
     TopTools_ListOfShape aWires;
     TopExp_Explorer aWireExp(aFace, TopAbs_WIRE);
     for (; aWireExp.More(); aWireExp.Next())
       aWires.Append(aWireExp.Current());
-    sortAreas(aWires, theEdges);
+    if (aWires.Size() > 2) {
+      TopoDS_Shape anOuterWire = aWires.First();
+      aWires.RemoveFirst();
+      sortAreas(aWires, theEdges);
+      aWires.Prepend(anOuterWire);
+    }
 
     // iterate on wires
     for (TopTools_ListIteratorOfListOfShape aWIt(aWires); aWIt.More(); aWIt.Next()) {