Salome HOME
Continue fixing regression with incorrect order of inner wires (sort inner wires...
[modules/shaper.git] / 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()) {