"""
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());
"""
#=========================================================================
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
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
#=========================================================================
# End of test
#=========================================================================
-
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()
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()
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()
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()
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()
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;
if(i == 1)
aName = anEdgeName;
else
- aName += "|" + anEdgeName;
+ aName += "&" + anEdgeName;
}
}//reg
else { // dangle vertex: if(aList22.Extent() == 1)
if(i == 1)
aName = aFaceName;
else
- aName += "|" + aFaceName;
+ aName += "&" + aFaceName;
}
}
}
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;
# 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)
# 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)
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())
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())
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() #!!!