Salome HOME
Fix for stator_ermes problem of plane created on 3 points
[modules/shaper.git] / src / Model / Model_ResultConstruction.cpp
index 8fc24dd9592e97cf3d5b7b4419ba891cd71c04f1..8de3c4165aff45c0b604ab2a3db9d8e0346ae996 100644 (file)
@@ -254,6 +254,15 @@ void Model_ResultConstruction::storeShape(std::shared_ptr<GeomAPI_Shape> theShap
         TNaming_Builder aBuilder(aSubLab);
         aBuilder.Generated(anExp.Current());
         std::string aVertexName = aMyName + "_" + (anIndex == 1 ? "StartVertex" : "EndVertex");
+        // check this name is already used
+        ResultPtr aThisRes;
+        do {
+          static std::string anEmpty;
+          static bool aUnique;
+          aThisRes = aMyDoc->findByName(aVertexName, anEmpty, aUnique);
+          if (aThisRes.get() && aThisRes.get() != this)
+            aVertexName += "x";
+        } while(aThisRes.get() && aThisRes.get() != this);
         TDataStd_Name::Set(aSubLab, aVertexName.c_str());
         aMyDoc->addNamingName(aSubLab, aVertexName);
       }