From: dbv Date: Mon, 21 Dec 2015 16:45:46 +0000 (+0300) Subject: Improvement #996: topological reference syntax X-Git-Tag: V_2.1.0~124 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c763b9a1b4b26b81bf27bbd7f45f330f1ab14929;p=modules%2Fshaper.git Improvement #996: topological reference syntax --- diff --git a/src/FeaturesPlugin/Test/TestGroup.py b/src/FeaturesPlugin/Test/TestGroup.py index fc955f30d..e57ed3bce 100644 --- a/src/FeaturesPlugin/Test/TestGroup.py +++ b/src/FeaturesPlugin/Test/TestGroup.py @@ -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 #========================================================================= - diff --git a/src/FeaturesPlugin/Test/TestPlacement.py b/src/FeaturesPlugin/Test/TestPlacement.py index 0fb8a0411..4b85903a4 100644 --- a/src/FeaturesPlugin/Test/TestPlacement.py +++ b/src/FeaturesPlugin/Test/TestPlacement.py @@ -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() diff --git a/src/Model/Model_SelectionNaming.cpp b/src/Model/Model_SelectionNaming.cpp index 69af7f289..2a776e624 100644 --- a/src/Model/Model_SelectionNaming.cpp +++ b/src/Model/Model_SelectionNaming.cpp @@ -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& 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; diff --git a/src/PythonAPI/examples/MakeBrick1.py b/src/PythonAPI/examples/MakeBrick1.py index 32bc1553a..3f7d6fbbc 100644 --- a/src/PythonAPI/examples/MakeBrick1.py +++ b/src/PythonAPI/examples/MakeBrick1.py @@ -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) diff --git a/src/PythonAPI/examples/MakeBrick2.py b/src/PythonAPI/examples/MakeBrick2.py index e47e9c0b9..55cc29bbc 100644 --- a/src/PythonAPI/examples/MakeBrick2.py +++ b/src/PythonAPI/examples/MakeBrick2.py @@ -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) diff --git a/src/PythonAPI/examples/Platine.py b/src/PythonAPI/examples/Platine.py index e71c50ae6..8a1a3dfca 100644 --- a/src/PythonAPI/examples/Platine.py +++ b/src/PythonAPI/examples/Platine.py @@ -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() #!!!