anAxisFeatureData = anAxisFeature.data()
assert(anAxisFeatureData is not None)
anAxisFeatureData.string("CreationMethod").setValue("AxisByCylindricalFaceCase")
-anAxisFeatureData.selection("CylindricalFace").selectSubShape("face", "Extrusion_1_1/LateralFace_1")
+anAxisFeatureData.selection("CylindricalFace").selectSubShape("face", "Extrusion_1_1/Generated_Face_1")
anAxisFeature.execute()
aSession.finishOperation()
dirx.setValue(1, 0, 0)
norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
-aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/TopFace_1")
+aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/To_Face_1")
+aSession.startOperation()
aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle")
anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("CircleCenter"))
aCircleRadius = aSketchCircle.real("CircleRadius")
anCircleCentr.setValue(0, 0)
aCircleRadius.setValue(10)
aSession.finishOperation()
+aSession.finishOperation()
aSession.startOperation()
+aCircleSketchFeature.execute() # execute for sketch should be called here, because it is not set as current feature, so it is disabled.
+anExtrusionCutFt.selectionList("base").append(aCircleSketchFeature.firstResult(), None)
anExtrusionCutFt.string("CreationMethod").setValue("ByPlanesAndOffsets")
anExtrusionCutFt.real("to_size").setValue(0)
anExtrusionCutFt.real("from_size").setValue(0)
aFromShape = modelAPI_ResultConstruction(aFromResult).shape()
anExtrusionCutFt.selection("from_object").setValue(aFromResult, aFromShape)
anExtrusionCutFt.real("from_offset").setValue(0)
-anExtrusionCutFt.selectionList("boolean_objects").append(modelAPI_ResultCompSolid(anExtrusionResult).subResult(1), None)
-anExtrusionCutFt.execute()
+anExtrusionCutFt.selectionList("main_objects").append(modelAPI_ResultCompSolid(anExtrusionResult).subResult(1), None)
aSession.finishOperation()
aSession.finishOperation()
dirx.setValue(1, 0, 0)
norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
-aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/TopFace_1")
+aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/To_Face_1")
+aSession.startOperation()
aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle")
anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("CircleCenter"))
aCircleRadius = aSketchCircle.real("CircleRadius")
anCircleCentr.setValue(0, 0)
aCircleRadius.setValue(10)
aSession.finishOperation()
+aSession.finishOperation()
aSession.startOperation()
+aCircleSketchFeature.execute() # execute for sketch should be called here, because it is not set as current feature, so it is disabled.
+anRevolutionFuseFt.selectionList("base").append(aCircleSketchFeature.firstResult(), None)
anRevolutionFuseFt.selection("axis_object").setValue(aLineSketchResult, aLineEdge)
anRevolutionFuseFt.string("CreationMethod").setValue("ByPlanesAndOffsets")
anRevolutionFuseFt.real("from_angle").setValue(0) #TODO: remove
anRevolutionFuseFt.real("to_offset").setValue(0)
anRevolutionFuseFt.selection("from_object").setValue(None, None)
anRevolutionFuseFt.real("from_offset").setValue(0)
-anRevolutionFuseFt.selectionList("boolean_objects").append(modelAPI_ResultCompSolid(anExtrusionResult).subResult(1), None)
-anRevolutionFuseFt.execute()
+anRevolutionFuseFt.selectionList("main_objects").append(modelAPI_ResultCompSolid(anExtrusionResult).subResult(1), None)
aSession.finishOperation()
aSession.finishOperation()
assert (len(anRevolutionFuseFt.results()) > 0)
aCurrentResult = modelAPI_ResultBody(anRevolutionFuseFt.firstResult())
assert (aCurrentResult is not None)
-
"""
TestExtrusion.py
Unit test of FeaturesPlugin_Extrusion class
-
+
class FeaturesPlugin_Extrusion : public ModelAPI_Feature
static const std::string MY_EXTRUSION_ID("Extrusion");
static const std::string LIST_ID("base");
anExtrusionFt.string("CreationMethod").setValue("ByPlanesAndOffsets")
anExtrusionFt.real("to_size").setValue(0) #TODO: remove
anExtrusionFt.real("from_size").setValue(0) #TODO: remove
-anExtrusionFt.selection("to_object").selectSubShape("face", "Extrusion_3_1/LateralFace_2")
+anExtrusionFt.selection("to_object").selectSubShape("face", "Extrusion_3_1/Generated_Face_2")
anExtrusionFt.real("to_offset").setValue(0)
-anExtrusionFt.selection("from_object").selectSubShape("face", "Extrusion_3_1/LateralFace_1")
+anExtrusionFt.selection("from_object").selectSubShape("face", "Extrusion_3_1/Generated_Face_1")
anExtrusionFt.real("from_offset").setValue(0)
anExtrusionFt.execute()
aSession.finishOperation()
-"""
- TestExtrusionCut.py
- Unit test of FeaturesPlugin_ExtrusionCut class
-
- class FeaturesPlugin_ExtrusionCut : public FeaturesPlugin_ExtrusionBoolean
- static const std::string MY_EXTRUSION_ID("ExtrusionCut");
- static const std::string MY_SKETCH_OBJECT_ID("sketch");
- static const std::string METHOD_ATTR("CreationMethod");
- static const std::string MY_TO_SIZE_ID("to_size");
- static const std::string MY_FROM_SIZE_ID("from_size");
- static const std::string MY_TO_OBJECT_ID("to_object");
- static const std::string MY_TO_OFFSET_ID("to_offset");
- static const std::string MY_FROM_OBJECT_ID("from_object");
- static const std::string MY_FROM_OFFSET_ID("from_offset");
- static const std::string MY_BOOLEAN_OBJECTS_ID("boolean_objects");
-
- data()->addAttribute(SKETCH_OBJECT_ID(), ModelAPI_AttributeReference::typeId());
- data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId());
- data()->addAttribute(TO_SIZE_ID(), ModelAPI_AttributeDouble::typeId());
- data()->addAttribute(FROM_SIZE_ID(), ModelAPI_AttributeDouble::typeId());
- data()->addAttribute(TO_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
- data()->addAttribute(TO_OFFSET_ID(), ModelAPI_AttributeDouble::typeId());
- data()->addAttribute(FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
- data()->addAttribute(FROM_OFFSET_ID(), ModelAPI_AttributeSelection::typeId());
- data()->addAttribute(BOOLEAN_OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId());
-"""
#=========================================================================
# Initialization of the test
#=========================================================================
dirx.setValue(1, 0, 0)
norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
-aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/TopFace_1")
+aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/To_Face_1")
+aSession.startOperation()
aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle")
anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("CircleCenter"))
aCircleRadius = aSketchCircle.real("CircleRadius")
anCircleCentr.setValue(0, 0)
aCircleRadius.setValue(10)
aSession.finishOperation()
+aSession.finishOperation()
aSession.startOperation()
+aCircleSketchFeature.execute() # execute for sketch should be called here, because it is not set as current feature, so it is disabled.
+anExtrusionCutFt.selectionList("base").append(aCircleSketchFeature.firstResult(), None)
anExtrusionCutFt.string("CreationMethod").setValue("BySizes")
anExtrusionCutFt.real("to_size").setValue(10)
anExtrusionCutFt.real("from_size").setValue(10)
anExtrusionCutFt.real("to_offset").setValue(0) #TODO: remove
anExtrusionCutFt.real("from_offset").setValue(0) #TODO: remove
-anExtrusionCutFt.selectionList("boolean_objects").append(anExtrusionResult, anExtrusionResult.shape())
-anExtrusionCutFt.execute()
+anExtrusionCutFt.selectionList("main_objects").append(anExtrusionResult, anExtrusionResult.shape())
aSession.finishOperation()
aSession.finishOperation()
-"""
- TestExtrusionFuse.py
- Unit test of FeaturesPlugin_ExtrusionFuse class
-
- class FeaturesPlugin_ExtrusionFuse : public FeaturesPlugin_ExtrusionBoolean
- static const std::string MY_EXTRUSION_ID("ExtrusionFuse");
- static const std::string MY_SKETCH_OBJECT_ID("sketch");
- static const std::string METHOD_ATTR("CreationMethod");
- static const std::string MY_TO_SIZE_ID("to_size");
- static const std::string MY_FROM_SIZE_ID("from_size");
- static const std::string MY_TO_OBJECT_ID("to_object");
- static const std::string MY_TO_OFFSET_ID("to_offset");
- static const std::string MY_FROM_OBJECT_ID("from_object");
- static const std::string MY_FROM_OFFSET_ID("from_offset");
- static const std::string MY_BOOLEAN_OBJECTS_ID("boolean_objects");
-
- data()->addAttribute(SKETCH_OBJECT_ID(), ModelAPI_AttributeReference::typeId());
- data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId());
- data()->addAttribute(TO_SIZE_ID(), ModelAPI_AttributeDouble::typeId());
- data()->addAttribute(FROM_SIZE_ID(), ModelAPI_AttributeDouble::typeId());
- data()->addAttribute(TO_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
- data()->addAttribute(TO_OFFSET_ID(), ModelAPI_AttributeDouble::typeId());
- data()->addAttribute(FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
- data()->addAttribute(FROM_OFFSET_ID(), ModelAPI_AttributeSelection::typeId());
- data()->addAttribute(BOOLEAN_OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId());
-"""
#=========================================================================
# Initialization of the test
#=========================================================================
dirx.setValue(1, 0, 0)
norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
-aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/TopFace_1")
+aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/To_Face_1")
+aSession.startOperation()
aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle")
anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("CircleCenter"))
aCircleRadius = aSketchCircle.real("CircleRadius")
anCircleCentr.setValue(0, 0)
aCircleRadius.setValue(10)
aSession.finishOperation()
+aSession.finishOperation()
aSession.startOperation()
+aCircleSketchFeature.execute() # execute for sketch should be called here, because it is not set as current feature, so it is disabled.
+anExtrusionFuseFt.selectionList("base").append(aCircleSketchFeature.firstResult(), None)
anExtrusionFuseFt.string("CreationMethod").setValue("BySizes")
anExtrusionFuseFt.real("to_size").setValue(10)
anExtrusionFuseFt.real("from_size").setValue(10)
anExtrusionFuseFt.real("to_offset").setValue(0) #TODO: remove
anExtrusionFuseFt.real("from_offset").setValue(0) #TODO: remove
-anExtrusionFuseFt.selectionList("boolean_objects").append(anExtrusionResult, anExtrusionResult.shape())
-anExtrusionFuseFt.execute()
+anExtrusionFuseFt.selectionList("main_objects").append(anExtrusionResult, anExtrusionResult.shape())
aSession.finishOperation()
aSession.finishOperation()
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_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_2&Extrusion_1_1/ToFace_1_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_2&Extrusion_1_1/LateralFace_1&Extrusion_1_1/ToFace_1_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_1&Extrusion_1_1/FromFace_1_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_2&Extrusion_1_1/FromFace_1_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_2&Extrusion_1_1/LateralFace_1&Extrusion_1_1/FromFace_1_1")
+aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1_1")
+aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1_1")
+aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1_1")
+aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1_1")
+aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1_1")
+aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1_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_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_1&Extrusion_1_1/ToFace_1_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_1&Extrusion_1_1/FromFace_1_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_2&Extrusion_1_1/ToFace_1_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_2&Extrusion_1_1/FromFace_1_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/ToFace_1_1")
+aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1")
+aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2")
+aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_1")
+aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1_1")
+aSelectionListAttr.append("Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1_1")
+aSelectionListAttr.append("Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1_1")
+aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1_1")
+aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1_1")
+aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1_1")
aSession.finishOperation()
#=========================================================================
# Check results
aGroupFeature = aSession.activeDocument().addFeature("Group")
aSelectionListAttr = aGroupFeature.selectionList("group_list")
aSelectionListAttr.setSelectionType("face")
-aSelectionListAttr.append("Extrusion_1_1/ToFace_1_1")
+aSelectionListAttr.append("Extrusion_1_1/To_Face_1_1")
aSession.finishOperation()
#=========================================================================
# Check results
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("face", "Extrusion_1_2/LateralFace_3")
+aPlacementFt.selection("placement_start_shape").selectSubShape("face", "Extrusion_1_1/Generated_Face_1")
+aPlacementFt.selection("placement_end_shape").selectSubShape("face", "Extrusion_1_2/Generated_Face_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("face", "Extrusion_1_1/LateralFace_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("edge", "Extrusion_1_2/ToFace_1_1&Extrusion_1_2/LateralFace_3")
+aPlacementFt.selection("placement_start_shape").selectSubShape("face", "Extrusion_1_1/Generated_Face_1")
+aPlacementFt.selection("placement_end_shape").selectSubShape("edge", "Extrusion_1_2/To_Face_1_1&Extrusion_1_2/Generated_Face_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("face", "Extrusion_1_1/LateralFace_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/ToFace_1_1&Extrusion_1_2/LateralFace_3&Extrusion_1_2/LateralFace_2")
+aPlacementFt.selection("placement_start_shape").selectSubShape("face", "Extrusion_1_1/Generated_Face_1")
+aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/To_Face_1_1&Extrusion_1_2/Generated_Face_3&Extrusion_1_2/Generated_Face_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_1&Extrusion_1_1/LateralFace_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("edge", "Extrusion_1_2/ToFace_1_1&Extrusion_1_2/LateralFace_3")
+aPlacementFt.selection("placement_start_shape").selectSubShape("edge", "Extrusion_1_1/To_Face_1_1&Extrusion_1_1/Generated_Face_1")
+aPlacementFt.selection("placement_end_shape").selectSubShape("edge", "Extrusion_1_2/To_Face_1_1&Extrusion_1_2/Generated_Face_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_1&Extrusion_1_1/LateralFace_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/ToFace_1_1&Extrusion_1_2/LateralFace_3&Extrusion_1_2/LateralFace_2")
+aPlacementFt.selection("placement_start_shape").selectSubShape("edge", "Extrusion_1_1/To_Face_1_1&Extrusion_1_1/Generated_Face_1")
+aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/To_Face_1_1&Extrusion_1_2/Generated_Face_3&Extrusion_1_2/Generated_Face_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_1&Extrusion_1_1/LateralFace_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/ToFace_1_1&Extrusion_1_2/LateralFace_3&Extrusion_1_2/LateralFace_2")
+aPlacementFt.selection("placement_start_shape").selectSubShape("vertex", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/From_Face_1_1&Extrusion_1_1/Generated_Face_1")
+aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/To_Face_1_1&Extrusion_1_2/Generated_Face_3&Extrusion_1_2/Generated_Face_2")
aPlacementFt.boolean("placement_reverse_direction").setValue(False)
aPlacementFt.boolean("placement_centering").setValue(True)
aPlacementFt.execute()
-"""
- TestRevolutionCut.py
- Unit test of FeaturesPlugin_RevolutionCut class
-
- class FeaturesPlugin_RevolutionCut : public FeaturesPlugin_RevolutionBoolean
- static const std::string MY_REVOLUTION_ID("RevolutionCut");
- static const std::string MY_SKETCH_OBJECT_ID("sketch");
- static const std::string MY_AXIS_ID("axis_object");
- static const std::string METHOD_ATTR("CreationMethod");
- static const std::string MY_TO_ANGLE_ID("to_angle");
- static const std::string MY_FROM_ANGLE_ID("from_angle");
- static const std::string MY_TO_OBJECT_ID("to_object");
- static const std::string MY_TO_OFFSET_ID("to_offset");
- static const std::string MY_FROM_OBJECT_ID("from_object");
- static const std::string MY_FROM_OFFSET_ID("from_offset");
- static const std::string MY_BOOLEAN_OBJECTS_ID("boolean_objects");
-
- data()->addAttribute(SKETCH_OBJECT_ID(), ModelAPI_AttributeReference::typeId());
- data()->addAttribute(AXIS_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
- data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId());
- data()->addAttribute(TO_ANGLE_ID(), ModelAPI_AttributeDouble::typeId());
- data()->addAttribute(FROM_ANGLE_ID(), ModelAPI_AttributeDouble::typeId());
- data()->addAttribute(TO_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
- data()->addAttribute(TO_OFFSET_ID(), ModelAPI_AttributeDouble::typeId());
- data()->addAttribute(FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
- data()->addAttribute(FROM_OFFSET_ID(), ModelAPI_AttributeSelection::typeId());
- data()->addAttribute(BOOLEAN_OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId());
-"""
#=========================================================================
# Initialization of the test
#=========================================================================
dirx.setValue(1, 0, 0)
norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
-aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/TopFace_1")
+aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/To_Face_1")
+aSession.startOperation()
aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle")
anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("CircleCenter"))
aCircleRadius = aSketchCircle.real("CircleRadius")
anCircleCentr.setValue(0, 0)
aCircleRadius.setValue(10)
aSession.finishOperation()
+aSession.finishOperation()
aSession.startOperation()
+aCircleSketchFeature.execute() # execute for sketch should be called here, because it is not set as current feature, so it is disabled.
+anRevolutionCutFt.selectionList("base").append(aCircleSketchFeature.firstResult(), None)
anRevolutionCutFt.selection("axis_object").setValue(aLineSketchResult, aLineEdge)
anRevolutionCutFt.string("CreationMethod").setValue("ByAngles")
anRevolutionCutFt.real("to_angle").setValue(50)
anRevolutionCutFt.real("from_angle").setValue(50)
anRevolutionCutFt.real("to_offset").setValue(0) #TODO: remove
anRevolutionCutFt.real("from_offset").setValue(0) #TODO: remove
-anRevolutionCutFt.selectionList("boolean_objects").append(anExtrusionResult, anExtrusionResult.shape())
-anRevolutionCutFt.execute()
+anRevolutionCutFt.selectionList("main_objects").append(anExtrusionResult, anExtrusionResult.shape())
aSession.finishOperation()
aSession.finishOperation()
"""
TestRevolutionFuse.py
Unit test of FeaturesPlugin_RevolutionFuse class
-
+
class FeaturesPlugin_RevolutionFuse : public FeaturesPlugin_RevolutionBoolean
static const std::string MY_REVOLUTION_ID("RevolutionFuse");
static const std::string MY_SKETCH_OBJECT_ID("sketch");
dirx.setValue(1, 0, 0)
norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
-aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/TopFace_1")
+aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/To_Face_1")
+aSession.startOperation()
aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle")
anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("CircleCenter"))
aCircleRadius = aSketchCircle.real("CircleRadius")
anCircleCentr.setValue(0, 0)
aCircleRadius.setValue(10)
aSession.finishOperation()
+aSession.finishOperation()
aSession.startOperation()
+aCircleSketchFeature.execute() # execute for sketch should be called here, because it is not set as current feature, so it is disabled.
+anRevolutionFuseFt.selectionList("base").append(aCircleSketchFeature.firstResult(), None)
anRevolutionFuseFt.selection("axis_object").setValue(aLineSketchResult, aLineEdge)
anRevolutionFuseFt.string("CreationMethod").setValue("ByAngles")
anRevolutionFuseFt.real("to_angle").setValue(50)
anRevolutionFuseFt.real("from_angle").setValue(50)
anRevolutionFuseFt.real("to_offset").setValue(0) #TODO: remove
anRevolutionFuseFt.real("from_offset").setValue(0) #TODO: remove
-anRevolutionFuseFt.selectionList("boolean_objects").append(anExtrusionResult, anExtrusionResult.shape())
-anRevolutionFuseFt.execute()
+anRevolutionFuseFt.selectionList("main_objects").append(anExtrusionResult, anExtrusionResult.shape())
aSession.finishOperation()
aSession.finishOperation()
"""
Test1064.py
Unit test for testing the Part sub-shapes naming, described in the issue 1064
-
+
"""
#=========================================================================
# Initialization of the test
aPlane = aPartSet.addFeature("Plane")
aPlane.string("CreationMethod").setValue("PlaneByFaceAndDistance")
aPlane.real("distance").setValue(0)
-aPlane.selection("planeFace").selectSubShape("face", "Part_1/Extrusion_1_1/LateralFace_3")
+aPlane.selection("planeFace").selectSubShape("face", "Part_1/Extrusion_1_1/Generated_Face_3")
aSession.finishOperation()
#=========================================================================
model.features.extrusion.Extrusion(self.part.addFeature("Extrusion"))
model.features.extrusion_boolean.ExtrusionBoolean(self.part.addFeature("ExtrusionCut"))
model.features.extrusion_boolean.ExtrusionBoolean(self.part.addFeature("ExtrusionFuse"))
- model.features.extrusion_sketch.ExtrusionSketch(self.part.addFeature("ExtrusionSketch"))
model.features.revolution.Revolution(self.part.addFeature("Revolution"))
model.features.revolution_boolean.RevolutionBoolean(self.part.addFeature("RevolutionCut"))
model.features.revolution_boolean.RevolutionBoolean(self.part.addFeature("RevolutionFuse"))
- model.features.revolution_sketch.RevolutionSketch(self.part.addFeature("RevolutionSketch"))
model.features.placement.Placement(self.part.addFeature("Placement"))
model.features.rotation.Rotation(self.part.addFeature("Rotation"))
model.features.translation.Translation(self.part.addFeature("Translation"))
# 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"
+thisface = "Extrusion_1_1/Generated_Face_2"
+thisxmin = "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2"
+thisxmax = "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1"
thiszmin = "Sketch_1/Edge5_1"
-thiszmax = "Extrusion_1_1/LateralFace_2&Extrusion_1_1/ToFace_1_1"
+thiszmax = "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1_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_1"
+thisface = "Extrusion_1_1/Generated_Face_2"
+thisxmin = "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2"
+thiszmax = "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1_1"
mystand = model.addSketch(mypart, thisface)
circle = mystand.addCircle(0, 25, 5)
def bottom_body():
# Create XOY sketch
- sketch = model.addSketch(part, "Extrusion_1_1/LateralFace_4")
+ sketch = model.addSketch(part, "Extrusion_1_1/Generated_Face_4")
# Create base polygon
points = [(0, 0), (0, L), (P, L), (P, 16 + 16), (P - 20, 16 + 16), (P - 20, 16), (P, 16), (P, 0)]
sketch.setCoincident(arc.endPoint(), h1.startPoint())
# Binding
- left_e = sketch.addLine("Extrusion_1_1/LateralFace_4&Extrusion_1_1/ToFace_1_1")
+ left_e = sketch.addLine("Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1_1")
sketch.setCoincident(left_e.startPoint(), left.endPoint())
sketch.setCoincident(left_e.endPoint(), left.startPoint())