From: dbv Date: Fri, 8 Apr 2016 14:41:38 +0000 (+0300) Subject: Test fixes X-Git-Tag: V_2.3.0~256 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3c7b09f34c4d3432c707e6f85e8e0c94dcb9fcdf;p=modules%2Fshaper.git Test fixes --- diff --git a/src/ConstructionPlugin/Test/TestAxisCreation.py b/src/ConstructionPlugin/Test/TestAxisCreation.py index 22040ad59..34039691e 100644 --- a/src/ConstructionPlugin/Test/TestAxisCreation.py +++ b/src/ConstructionPlugin/Test/TestAxisCreation.py @@ -125,7 +125,7 @@ anAxisFeature = aPart.addFeature("Axis") 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() diff --git a/src/FeaturesPlugin/Test/TestCompositeFeaturesOnCompSolids.py b/src/FeaturesPlugin/Test/TestCompositeFeaturesOnCompSolids.py index 627423ffd..ba38dd2f2 100644 --- a/src/FeaturesPlugin/Test/TestCompositeFeaturesOnCompSolids.py +++ b/src/FeaturesPlugin/Test/TestCompositeFeaturesOnCompSolids.py @@ -113,14 +113,18 @@ dirx = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")) 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) @@ -132,8 +136,7 @@ aFromResult = aFromPlaneFeature.firstResult() 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() @@ -187,14 +190,18 @@ dirx = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")) 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 @@ -203,8 +210,7 @@ anRevolutionFuseFt.selection("to_object").setValue(aToResult, None) 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() @@ -216,4 +222,3 @@ assert (aFactory.validate(anRevolutionFuseFt)) assert (len(anRevolutionFuseFt.results()) > 0) aCurrentResult = modelAPI_ResultBody(anRevolutionFuseFt.firstResult()) assert (aCurrentResult is not None) - diff --git a/src/FeaturesPlugin/Test/TestExtrusion.py b/src/FeaturesPlugin/Test/TestExtrusion.py index b6122f30a..da1d1f953 100644 --- a/src/FeaturesPlugin/Test/TestExtrusion.py +++ b/src/FeaturesPlugin/Test/TestExtrusion.py @@ -1,7 +1,7 @@ """ 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"); @@ -228,9 +228,9 @@ anExtrusionFt.selectionList("base").append( 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() diff --git a/src/FeaturesPlugin/Test/TestExtrusionCut.py b/src/FeaturesPlugin/Test/TestExtrusionCut.py index 5a4d6ca53..e880babc7 100644 --- a/src/FeaturesPlugin/Test/TestExtrusionCut.py +++ b/src/FeaturesPlugin/Test/TestExtrusionCut.py @@ -1,29 +1,3 @@ -""" - 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 #========================================================================= @@ -114,21 +88,24 @@ dirx = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")) 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() diff --git a/src/FeaturesPlugin/Test/TestExtrusionFuse.py b/src/FeaturesPlugin/Test/TestExtrusionFuse.py index a926bb863..5832c3baa 100644 --- a/src/FeaturesPlugin/Test/TestExtrusionFuse.py +++ b/src/FeaturesPlugin/Test/TestExtrusionFuse.py @@ -1,29 +1,3 @@ -""" - 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 #========================================================================= @@ -114,21 +88,24 @@ dirx = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")) 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() diff --git a/src/FeaturesPlugin/Test/TestGroup.py b/src/FeaturesPlugin/Test/TestGroup.py index 34adc5240..382c02416 100644 --- a/src/FeaturesPlugin/Test/TestGroup.py +++ b/src/FeaturesPlugin/Test/TestGroup.py @@ -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_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 @@ -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_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 @@ -155,7 +155,7 @@ aSession.startOperation() 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 diff --git a/src/FeaturesPlugin/Test/TestPlacement.py b/src/FeaturesPlugin/Test/TestPlacement.py index 47790a2cb..58e328fa9 100644 --- a/src/FeaturesPlugin/Test/TestPlacement.py +++ b/src/FeaturesPlugin/Test/TestPlacement.py @@ -111,8 +111,8 @@ assert (anExtrusionResult is not None) 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() @@ -130,8 +130,8 @@ aSession.undo() 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() @@ -149,8 +149,8 @@ aSession.undo() 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() @@ -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_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() @@ -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_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() @@ -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_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() diff --git a/src/FeaturesPlugin/Test/TestRevolutionCut.py b/src/FeaturesPlugin/Test/TestRevolutionCut.py index bbbdd2123..ca8f2b57b 100644 --- a/src/FeaturesPlugin/Test/TestRevolutionCut.py +++ b/src/FeaturesPlugin/Test/TestRevolutionCut.py @@ -1,31 +1,3 @@ -""" - 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 #========================================================================= @@ -142,22 +114,25 @@ dirx = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")) 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() diff --git a/src/FeaturesPlugin/Test/TestRevolutionFuse.py b/src/FeaturesPlugin/Test/TestRevolutionFuse.py index 3a9e3e728..369c413a0 100644 --- a/src/FeaturesPlugin/Test/TestRevolutionFuse.py +++ b/src/FeaturesPlugin/Test/TestRevolutionFuse.py @@ -1,7 +1,7 @@ """ 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"); @@ -142,22 +142,25 @@ dirx = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")) 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() diff --git a/src/ModelAPI/Test/Test1064.py b/src/ModelAPI/Test/Test1064.py index 2ee908ba8..934a0779c 100644 --- a/src/ModelAPI/Test/Test1064.py +++ b/src/ModelAPI/Test/Test1064.py @@ -1,7 +1,7 @@ """ Test1064.py Unit test for testing the Part sub-shapes naming, described in the issue 1064 - + """ #========================================================================= # Initialization of the test @@ -73,7 +73,7 @@ aSession.setActiveDocument(aPartSet) 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() #========================================================================= diff --git a/src/PythonAPI/Test/TestFeatures.py b/src/PythonAPI/Test/TestFeatures.py index e043fe9da..edd7d86b5 100644 --- a/src/PythonAPI/Test/TestFeatures.py +++ b/src/PythonAPI/Test/TestFeatures.py @@ -55,11 +55,9 @@ class FeaturesTestCase(FeaturesFixture): 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")) diff --git a/src/PythonAPI/examples/MakeBrick1.py b/src/PythonAPI/examples/MakeBrick1.py index b698f0a50..ba828e87f 100644 --- a/src/PythonAPI/examples/MakeBrick1.py +++ b/src/PythonAPI/examples/MakeBrick1.py @@ -44,11 +44,11 @@ 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" +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) diff --git a/src/PythonAPI/examples/MakeBrick2.py b/src/PythonAPI/examples/MakeBrick2.py index 03c07c4ee..279509cae 100644 --- a/src/PythonAPI/examples/MakeBrick2.py +++ b/src/PythonAPI/examples/MakeBrick2.py @@ -43,9 +43,9 @@ 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_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) diff --git a/src/PythonAPI/examples/Platine.py b/src/PythonAPI/examples/Platine.py index 47d7bf30d..edec616e0 100644 --- a/src/PythonAPI/examples/Platine.py +++ b/src/PythonAPI/examples/Platine.py @@ -54,7 +54,7 @@ def vertical_body(): 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)] @@ -87,7 +87,7 @@ def bottom_body(): 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())