Salome HOME
Issue #19056: crash when selecting a whole sketch in "build ==> wire"
[modules/shaper.git] / src / BuildPlugin / BuildPlugin_Wire.cpp
index bbaa4d3242d3fd2f253014190dfe1b66b74b7cd2..7f10590d93fbf3e2c22b4b221281ed2e8a2a1253 100644 (file)
@@ -386,11 +386,18 @@ bool buildSketchWires(FeaturePtr theSketchFeature, GeomShapePtr theSketchShape,
         aStartV = aEndV;
       }
       else {
-        // both vertices are found => close the loop
+        // both vertices are found
         aFoundStart->second->push_back(anEdge);
         if (aFoundStart->second != aFoundEnd->second) {
+          // different wires => merge segments
           aFoundStart->second->insert(aFoundStart->second->end(),
               aFoundEnd->second->begin(), aFoundEnd->second->end());
+          for (MapVertexWire::iterator it = aMapVW.begin(); it != aMapVW.end(); ++it)
+            if (it != aFoundEnd && it->second == aFoundEnd->second) {
+              // another boundary of the wire, change link to the whole result
+              it->second = aFoundStart->second;
+              break;
+            }
           aNewWires.erase(aFoundEnd->second);
         }
         aMapVW.erase(aFoundStart);