Salome HOME
Issue #1315 Middle point constraint problem
[modules/shaper.git] / src / Model / Model_BodyBuilder.cpp
index 614afa3b53126a7c1bb8cb3b58f4cc6e95d1bed3..1d3b8a4d506d48ef85e711e995ad7c75e8568f93 100755 (executable)
@@ -79,7 +79,7 @@ static void evolutionToSelectionRec(TDF_Label theLab, const bool theFlag) {
   std::list<std::pair<TopoDS_Shape, TopoDS_Shape> >::iterator aPairsIter = aShapePairs.begin();
   for(; aPairsIter != aShapePairs.end(); aPairsIter++) {
     if (theFlag) { // disabled => make selection
-      aBuilder.Select(aPairsIter->first, aPairsIter->second);
+      aBuilder.Select(aPairsIter->second, aPairsIter->first);
     } else if (anEvol == TNaming_GENERATED) {
       aBuilder.Generated(aPairsIter->first, aPairsIter->second);
     } else if (anEvol == TNaming_MODIFY) {
@@ -89,7 +89,7 @@ static void evolutionToSelectionRec(TDF_Label theLab, const bool theFlag) {
     } else if (anEvol == TNaming_PRIMITIVE) {
       aBuilder.Generated(aPairsIter->second);
     } else if (anEvol == TNaming_SELECTED) {
-      aBuilder.Select(aPairsIter->first, aPairsIter->second);
+      aBuilder.Select(aPairsIter->second, aPairsIter->first);
     }
   }
   // recursive call for all sub-labels
@@ -225,8 +225,11 @@ void Model_BodyBuilder::storeModified(const std::shared_ptr<GeomAPI_Shape>& theO
         TNaming_Builder aSubBuilder(aShapeLab.FindChild(aTag++));
         aSubBuilder.Generated(aSubIter.Value());
         if(!aName.IsEmpty()) {
+          TCollection_AsciiString aShapeType = aShape.ShapeType() == TopAbs_EDGE ? "_Edge_" :
+                                               aShape.ShapeType() == TopAbs_FACE ? "_Face_" :
+                                               aShape.ShapeType() == TopAbs_SOLID ? "_Solid_" : "_Shape_";
           std::string aSolidName = 
-            (aName + "_Solid_" + TCollection_AsciiString(aTag - theDecomposeSolidsTag)).ToCString(); 
+            (aName + aShapeType + TCollection_AsciiString(aTag - theDecomposeSolidsTag)).ToCString(); 
           std::shared_ptr<Model_Document> aDoc = 
             std::dynamic_pointer_cast<Model_Document>(document());
           aDoc->addNamingName(aSubBuilder.NamedShape()->Label(), aSolidName);