]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Improvement #996: topological reference syntax
authordbv <dbv@opencascade.com>
Mon, 21 Dec 2015 16:45:46 +0000 (19:45 +0300)
committerdbv <dbv@opencascade.com>
Mon, 21 Dec 2015 16:45:46 +0000 (19:45 +0300)
src/FeaturesPlugin/Test/TestGroup.py
src/FeaturesPlugin/Test/TestPlacement.py
src/Model/Model_SelectionNaming.cpp
src/PythonAPI/examples/MakeBrick1.py
src/PythonAPI/examples/MakeBrick2.py
src/PythonAPI/examples/Platine.py

index fc955f30dec24ca0797dc277d2327324d1d76e47..e57ed3bce37f89a56d7ae356ed82ee39e56048c3 100644 (file)
@@ -1,11 +1,11 @@
 """
       TestBoolean.py
       Unit test of FeaturesPlugin_Group class
-      
+
       class FeaturesPlugin_Group
         static const std::string MY_GROUP_ID("Group");
         static const std::string MY_GROUP_LIST_ID("group_list");
-        
+
         data()->addAttribute(FeaturesPlugin_Group::LIST_ID(), ModelAPI_AttributeSelectionList::typeId());
 """
 #=========================================================================
@@ -78,12 +78,12 @@ aSession.startOperation()
 aGroupFeature = aSession.activeDocument().addFeature("Group")
 aSelectionListAttr = aGroupFeature.selectionList("group_list")
 aSelectionListAttr.setSelectionType("vertex")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_3|Extrusion_1_1/LateralFace_1|Extrusion_1_1/ToFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_3|Extrusion_1_1/LateralFace_2|Extrusion_1_1/ToFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_2|Extrusion_1_1/LateralFace_1|Extrusion_1_1/ToFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_3|Extrusion_1_1/LateralFace_1|Extrusion_1_1/FromFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_3|Extrusion_1_1/LateralFace_2|Extrusion_1_1/FromFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_2|Extrusion_1_1/LateralFace_1|Extrusion_1_1/FromFace_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_1&Extrusion_1_1/ToFace_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_2&Extrusion_1_1/ToFace_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_2&Extrusion_1_1/LateralFace_1&Extrusion_1_1/ToFace_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_1&Extrusion_1_1/FromFace_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_2&Extrusion_1_1/FromFace_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_2&Extrusion_1_1/LateralFace_1&Extrusion_1_1/FromFace_1")
 aSession.finishOperation()
 #=========================================================================
 # Check results
@@ -98,15 +98,15 @@ aSession.startOperation()
 aGroupFeature = aSession.activeDocument().addFeature("Group")
 aSelectionListAttr = aGroupFeature.selectionList("group_list")
 aSelectionListAttr.setSelectionType("edge")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_2|Extrusion_1_1/LateralFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_3|Extrusion_1_1/LateralFace_2")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_3|Extrusion_1_1/LateralFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_3|Extrusion_1_1/FromFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_1|Extrusion_1_1/ToFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_1|Extrusion_1_1/FromFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_2|Extrusion_1_1/ToFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_2|Extrusion_1_1/FromFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_3|Extrusion_1_1/ToFace_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_2&Extrusion_1_1/LateralFace_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_2")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/FromFace_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_1&Extrusion_1_1/ToFace_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_1&Extrusion_1_1/FromFace_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_2&Extrusion_1_1/ToFace_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_2&Extrusion_1_1/FromFace_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/ToFace_1")
 aSession.finishOperation()
 #=========================================================================
 # Check results
@@ -241,4 +241,3 @@ assert(aGroupResult)
 #=========================================================================
 # End of test
 #=========================================================================
-
index 0fb8a0411916866314faadd37dd3773575a0b9ed..4b85903a475fa18fa6e8f5c6cb79aacc0ca6bd43 100644 (file)
@@ -131,7 +131,7 @@ aSession.startOperation()
 aPlacementFt = aPart.addFeature("Placement")
 aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
 aPlacementFt.selection("placement_start_shape").selectSubShape("face", "Extrusion_1_1/LateralFace_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("edge", "Extrusion_1_2/ToFace_1|Extrusion_1_2/LateralFace_3")
+aPlacementFt.selection("placement_end_shape").selectSubShape("edge", "Extrusion_1_2/ToFace_1&Extrusion_1_2/LateralFace_3")
 aPlacementFt.boolean("placement_reverse_direction").setValue(False)
 aPlacementFt.boolean("placement_centering").setValue(True)
 aPlacementFt.execute()
@@ -150,7 +150,7 @@ aSession.startOperation()
 aPlacementFt = aPart.addFeature("Placement")
 aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
 aPlacementFt.selection("placement_start_shape").selectSubShape("face", "Extrusion_1_1/LateralFace_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/ToFace_1|Extrusion_1_2/LateralFace_3|Extrusion_1_2/LateralFace_2")
+aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/ToFace_1&Extrusion_1_2/LateralFace_3&Extrusion_1_2/LateralFace_2")
 aPlacementFt.boolean("placement_reverse_direction").setValue(False)
 aPlacementFt.boolean("placement_centering").setValue(True)
 aPlacementFt.execute()
@@ -168,8 +168,8 @@ aSession.undo()
 aSession.startOperation()
 aPlacementFt = aPart.addFeature("Placement")
 aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
-aPlacementFt.selection("placement_start_shape").selectSubShape("edge", "Extrusion_1_1/ToFace_1|Extrusion_1_1/LateralFace_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("edge", "Extrusion_1_2/ToFace_1|Extrusion_1_2/LateralFace_3")
+aPlacementFt.selection("placement_start_shape").selectSubShape("edge", "Extrusion_1_1/ToFace_1&Extrusion_1_1/LateralFace_1")
+aPlacementFt.selection("placement_end_shape").selectSubShape("edge", "Extrusion_1_2/ToFace_1&Extrusion_1_2/LateralFace_3")
 aPlacementFt.boolean("placement_reverse_direction").setValue(False)
 aPlacementFt.boolean("placement_centering").setValue(True)
 aPlacementFt.execute()
@@ -187,8 +187,8 @@ aSession.undo()
 aSession.startOperation()
 aPlacementFt = aPart.addFeature("Placement")
 aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
-aPlacementFt.selection("placement_start_shape").selectSubShape("edge", "Extrusion_1_1/ToFace_1|Extrusion_1_1/LateralFace_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/ToFace_1|Extrusion_1_2/LateralFace_3|Extrusion_1_2/LateralFace_2")
+aPlacementFt.selection("placement_start_shape").selectSubShape("edge", "Extrusion_1_1/ToFace_1&Extrusion_1_1/LateralFace_1")
+aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/ToFace_1&Extrusion_1_2/LateralFace_3&Extrusion_1_2/LateralFace_2")
 aPlacementFt.boolean("placement_reverse_direction").setValue(False)
 aPlacementFt.boolean("placement_centering").setValue(True)
 aPlacementFt.execute()
@@ -206,8 +206,8 @@ aSession.undo()
 aSession.startOperation()
 aPlacementFt = aPart.addFeature("Placement")
 aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
-aPlacementFt.selection("placement_start_shape").selectSubShape("vertex", "Extrusion_1_1/LateralFace_4|Extrusion_1_1/FromFace_1|Extrusion_1_1/LateralFace_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/ToFace_1|Extrusion_1_2/LateralFace_3|Extrusion_1_2/LateralFace_2")
+aPlacementFt.selection("placement_start_shape").selectSubShape("vertex", "Extrusion_1_1/LateralFace_4&Extrusion_1_1/FromFace_1&Extrusion_1_1/LateralFace_1")
+aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/ToFace_1&Extrusion_1_2/LateralFace_3&Extrusion_1_2/LateralFace_2")
 aPlacementFt.boolean("placement_reverse_direction").setValue(False)
 aPlacementFt.boolean("placement_centering").setValue(True)
 aPlacementFt.execute()
index 69af7f28966fcd4efd253981a6344e75dd56773e..2a776e624544f14d6b1c0b8d7f5c0e65302ebdcb 100644 (file)
@@ -168,12 +168,12 @@ std::string Model_SelectionNaming::namingName(ResultPtr& theContext,
           if(i == 1)
             aName = aFaceName;
           else 
-            aName += "|" + aFaceName;
+            aName += "&" + aFaceName;
         }
         TopTools_ListIteratorOfListOfShape itl(aListOfNbs);
         for (;itl.More();itl.Next()) {
           std::string aFaceName = getShapeName(aDoc, itl.Value());
-          aName += "|" + aFaceName;
+          aName += "&" + aFaceName;
         }                
       }
       break;
@@ -230,7 +230,7 @@ std::string Model_SelectionNaming::namingName(ResultPtr& theContext,
               if(i == 1)
                 aName = anEdgeName;
               else 
-                aName += "|" + anEdgeName;
+                aName += "&" + anEdgeName;
             }
           }//reg
           else { // dangle vertex: if(aList22.Extent() == 1)
@@ -245,7 +245,7 @@ std::string Model_SelectionNaming::namingName(ResultPtr& theContext,
             if(i == 1)
               aName = aFaceName;
             else 
-              aName += "|" + aFaceName;
+              aName += "&" + aFaceName;
           }
         }
       }
@@ -340,7 +340,7 @@ int ParseName(const std::string& theSubShapeName,   std::list<std::string>& theL
   std::string aName = theSubShapeName;
   std::string aLastName;
   int n1(0), n2(0); // n1 - start position, n2 - position of the delimiter
-  while ((n2 = aName.find('|', n1)) != std::string::npos) {
+  while ((n2 = aName.find('&', n1)) != std::string::npos) {
     const std::string aName1 = aName.substr(n1, n2 - n1); //name of face
     theList.push_back(aName1); 
     n1 = n2 + 1;
index 32bc1553a9e8fd4c72a74a9b89fc4710caff7a94..3f7d6fbbca5942eb08b2fc828fe3342e8dae7bad 100644 (file)
@@ -45,10 +45,10 @@ mybox = model.addExtrusion(mypart, mybase.selectFace(), 50)
 # Creating a cylinder on a face of the box
 
 thisface = "Extrusion_1_1/LateralFace_2"
-thisxmin = "Extrusion_1_1/LateralFace_3|Extrusion_1_1/LateralFace_2"
-thisxmax = "Extrusion_1_1/LateralFace_2|Extrusion_1_1/LateralFace_1"
+thisxmin = "Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_2"
+thisxmax = "Extrusion_1_1/LateralFace_2&Extrusion_1_1/LateralFace_1"
 thiszmin = "Sketch_1/Edge5_1"
-thiszmax = "Extrusion_1_1/LateralFace_2|Extrusion_1_1/ToFace_1"
+thiszmax = "Extrusion_1_1/LateralFace_2&Extrusion_1_1/ToFace_1"
 
 mystand = model.addSketch(mypart, thisface)
 
index e47e9c0b9b25fd9ffce277662de506ec4c26117f..55cc29bbc2f5a3722d1b3b5f72b1eafca0a56615 100644 (file)
@@ -44,8 +44,8 @@ mybox = model.addExtrusion(mypart, mybase.selectFace(), 50)
 # Creating a cylinder on a face of the box
 
 thisface = "Extrusion_1_1/LateralFace_2"
-thisxmin = "Extrusion_1_1/LateralFace_3|Extrusion_1_1/LateralFace_2"
-thiszmax = "Extrusion_1_1/LateralFace_2|Extrusion_1_1/ToFace_1"
+thisxmin = "Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_2"
+thiszmax = "Extrusion_1_1/LateralFace_2&Extrusion_1_1/ToFace_1"
 
 mystand = model.addSketch(mypart, thisface)
 circle = mystand.addCircle(0, 25, 5)
index e71c50ae6030e43bef5cc3ee7060bfa1046be5c1..8a1a3dfcab04d416a7cab033f0d614d2ef90c3d6 100644 (file)
@@ -92,7 +92,7 @@ def bottom_body():
     sketch.setCoincident(arc.endPoint(), h1.startPoint())
 
     # Binding
-    left_e = sketch.addLine("Extrusion_1_1/LateralFace_2|Extrusion_1_1/ToFace_1")
+    left_e = sketch.addLine("Extrusion_1_1/LateralFace_2&Extrusion_1_1/ToFace_1")
     sketch.setCoincident(left_e.startPoint(), left.endPoint())
     sketch.setCoincident(left_e.endPoint(), left.startPoint())
 
@@ -145,7 +145,7 @@ def body_3():
     sketch.setRadius(arc.result(), r)
 
     # Binding
-    bottom_e = sketch.addLine("Boolean_1_1/Modified_1|Boolean_1_1/Modified_3")
+    bottom_e = sketch.addLine("Boolean_1_1/Modified_1&Boolean_1_1/Modified_3")
     sketch.setCoincident(bottom_e.result(), bottom.startPoint())
     sketch.setCoincident(bottom_e.startPoint(), bottom.endPoint())
 
@@ -169,11 +169,11 @@ def body_4():
     left, diagonal, bottom = sketch.addPolygon(*geom_points)
 
     # Binding
-    bottom_e = sketch.addLine("Boolean_2_1/Modified_8|Boolean_2_1/Modified_7")
+    bottom_e = sketch.addLine("Boolean_2_1/Modified_8&Boolean_2_1/Modified_7")
     sketch.setCoincident(bottom_e.endPoint(), bottom.startPoint())
     sketch.setCoincident(bottom_e.startPoint(), left.startPoint())
 
-    left_e = sketch.addLine("Boolean_2_1/Modified_3|Boolean_2_1/Modified_2")
+    left_e = sketch.addLine("Boolean_2_1/Modified_3&Boolean_2_1/Modified_2")
     sketch.setCoincident(left_e.startPoint(), left.endPoint())
 
     model.do()  #!!!