From: dbv Date: Tue, 30 Jun 2015 22:53:31 +0000 (+0300) Subject: Tests update X-Git-Tag: V_1.3.0~143 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5e549018037587649f6b8ed59809605f419649eb;p=modules%2Fshaper.git Tests update --- diff --git a/src/FeaturesPlugin/Test/TestBoolean.py b/src/FeaturesPlugin/Test/TestBoolean.py index 9393bee87..c83eb2f2b 100644 --- a/src/FeaturesPlugin/Test/TestBoolean.py +++ b/src/FeaturesPlugin/Test/TestBoolean.py @@ -92,8 +92,11 @@ for eachSketchFeature in [aCircleSketchFeature, aTriangleSketchFeature]: anExtrusionFt = aPart.addFeature("Extrusion") anExtrusionFt.selectionList("base").append( aSketchResult, aSketchFaces[0]) + anExtrusionFt.string("CreationMethod").setValue("BySizes") anExtrusionFt.real("from_size").setValue(0) anExtrusionFt.real("to_size").setValue(50) + anExtrusionFt.real("to_offset").setValue(0) #TODO: remove + anExtrusionFt.real("from_offset").setValue(0) #TODO: remove anExtrusionFt.execute() extrudedObjects.append(modelAPI_ResultBody(anExtrusionFt.firstResult())) aSession.finishOperation() diff --git a/src/FeaturesPlugin/Test/TestExtrusion.py b/src/FeaturesPlugin/Test/TestExtrusion.py index b74979c8b..2e8e6312d 100644 --- a/src/FeaturesPlugin/Test/TestExtrusion.py +++ b/src/FeaturesPlugin/Test/TestExtrusion.py @@ -5,16 +5,22 @@ class FeaturesPlugin_Extrusion : public ModelAPI_Feature static const std::string MY_EXTRUSION_ID("Extrusion"); static const std::string LIST_ID("base"); + 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"); - data()->addAttribute(FeaturesPlugin_Extrusion::LIST_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(FeaturesPlugin_Extrusion::FROM_SIZE_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(FeaturesPlugin_Extrusion::TO_SIZE_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(FeaturesPlugin_Extrusion::FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(FeaturesPlugin_Extrusion::TO_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(LIST_ID(), ModelAPI_AttributeSelection::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()); """ #========================================================================= # Initialization of the test @@ -77,8 +83,11 @@ assert (anExtrusionFt.getKind() == "Extrusion") # selection type FACE=4 anExtrusionFt.selectionList("base").append( aCircleSketchResult, aCircleSketchFaces[0]) -anExtrusionFt.real("from_size").setValue(0) +anExtrusionFt.string("CreationMethod").setValue("BySizes") anExtrusionFt.real("to_size").setValue(50) +anExtrusionFt.real("from_size").setValue(0) +anExtrusionFt.real("to_offset").setValue(0) #TODO: remove +anExtrusionFt.real("from_offset").setValue(0) #TODO: remove anExtrusionFt.execute() aSession.finishOperation() assert (anExtrusionFt.real("to_size").value() == 50.0) @@ -118,14 +127,17 @@ assert (anExtrusionFt.getKind() == "Extrusion") # selection type FACE=4 anExtrusionFt.selectionList("base").append( aCircleSketchResult, aCircleSketchFaces[0]) -aFromResult = aFromPlaneFeature.firstResult() -aFromShape = modelAPI_ResultConstruction(aFromResult).shape() -anExtrusionFt.selection("from_object").setValue(aFromResult, aFromShape) -anExtrusionFt.real("from_size").setValue(10) +anExtrusionFt.string("CreationMethod").setValue("ByPlanesAndOffsets") +anExtrusionFt.real("to_size").setValue(0) #TODO: remove +anExtrusionFt.real("from_size").setValue(0) #TODO: remove aToResult = aToPlaneFeature.firstResult() aToShape = modelAPI_ResultConstruction(aToResult).shape() anExtrusionFt.selection("to_object").setValue(aToResult, aToShape) -anExtrusionFt.real("to_size").setValue(10) +anExtrusionFt.real("to_offset").setValue(10) +aFromResult = aFromPlaneFeature.firstResult() +aFromShape = modelAPI_ResultConstruction(aFromResult).shape() +anExtrusionFt.selection("from_object").setValue(aFromResult, aFromShape) +anExtrusionFt.real("from_offset").setValue(10) anExtrusionFt.execute() aSession.finishOperation() @@ -193,8 +205,11 @@ assert (aClampExtrusionFt.getKind() == "Extrusion") # selection type FACE=4 aClampExtrusionFt.selectionList("base").append( aClampSketchResult, aClampSketchFaces[0]) -aClampExtrusionFt.real("from_size").setValue(0) +aClampExtrusionFt.string("CreationMethod").setValue("BySizes") aClampExtrusionFt.real("to_size").setValue(70) +aClampExtrusionFt.real("from_size").setValue(0) +aClampExtrusionFt.real("to_offset").setValue(0) #TODO: remove +aClampExtrusionFt.real("from_offset").setValue(0) #TODO: remove aClampExtrusionFt.execute() aSession.finishOperation() @@ -210,11 +225,13 @@ assert (anExtrusionFt.getKind() == "Extrusion") # selection type FACE=4 anExtrusionFt.selectionList("base").append( aCircleSketchResult, aCircleSketchFaces[0]) -aClampResult = aClampExtrusionFt.firstResult() -anExtrusionFt.selection("from_object").selectSubShape("face", "Extrusion_3/LateralFace_1") -anExtrusionFt.real("from_size").setValue(0) +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/LateralFace_2") -anExtrusionFt.real("to_size").setValue(0) +anExtrusionFt.real("to_offset").setValue(0) +anExtrusionFt.selection("from_object").selectSubShape("face", "Extrusion_3/LateralFace_1") +anExtrusionFt.real("from_offset").setValue(0) anExtrusionFt.execute() aSession.finishOperation() diff --git a/src/FeaturesPlugin/Test/TestMultiBoolean.py b/src/FeaturesPlugin/Test/TestMultiBoolean.py index bb185acb6..e4577bd4d 100644 --- a/src/FeaturesPlugin/Test/TestMultiBoolean.py +++ b/src/FeaturesPlugin/Test/TestMultiBoolean.py @@ -90,8 +90,11 @@ for i in xrange(0, N * N): anExtrusionFt.selectionList("base").append( aSketchResult, aSketchFaces[0]) + anExtrusionFt.string("CreationMethod").setValue("BySizes") anExtrusionFt.real("from_size").setValue(0) anExtrusionFt.real("to_size").setValue(10) + anExtrusionFt.real("to_offset").setValue(0) #TODO: remove + anExtrusionFt.real("from_offset").setValue(0) #TODO: remove # v1.0.2 from master # anExtrusionFt.selection("extrusion_face").setValue( # aSketchResult, aSketchFaces[0]) @@ -151,8 +154,11 @@ GeomAlgoAPI_SketchBuilder.createFaces( aBox = aPart.addFeature("Extrusion") aBox.selectionList("base").append( aSketchResult, aSketchFaces[0]) +aBox.string("CreationMethod").setValue("BySizes") aBox.real("from_size").setValue(0) aBox.real("to_size").setValue(10) +aBox.real("to_offset").setValue(0) #TODO: remove +aBox.real("from_offset").setValue(0) #TODO: remove # v 1.0.2 from master # aBox.selection("extrusion_face").setValue( # aSketchResult, aSketchFaces[0]) @@ -177,6 +183,7 @@ for i in xrange(0, N * N): aBooleanFt.integer("bool_type").setValue(kBooleanTypeCut) aBooleanFt.execute() aCurrentResult = modelAPI_ResultBody(aBooleanFt.firstResult()) + assert (len(aBooleanFt.results()) > 0) aSession.finishOperation() #========================================================================= diff --git a/src/FeaturesPlugin/Test/TestRevolution.py b/src/FeaturesPlugin/Test/TestRevolution.py index f0806e666..7a6b0c408 100644 --- a/src/FeaturesPlugin/Test/TestRevolution.py +++ b/src/FeaturesPlugin/Test/TestRevolution.py @@ -6,17 +6,23 @@ static const std::string MY_REVOLUTION_ID("Revolution"); static const std::string MY_GROUP_LIST_ID("base"); static const std::string MY_TO_OBJECT_ID("axis_object"); - static const std::string MY_TO_ANGLE_ID("to_angle"); + 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"); - data()->addAttribute(FeaturesPlugin_Revolution::LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); - data()->addAttribute(FeaturesPlugin_Revolution::AXIS_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(FeaturesPlugin_Revolution::FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(FeaturesPlugin_Revolution::FROM_ANGLE_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(FeaturesPlugin_Revolution::TO_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(FeaturesPlugin_Revolution::TO_ANGLE_ID(), ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(LIST_ID(), ModelAPI_AttributeSelectionList::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_AttributeDouble::typeId()); """ #========================================================================= # Initialization of the test @@ -106,8 +112,11 @@ assert (aRevolFt.getKind() == "Revolution") aRevolFt.selectionList("base").append( aCircleSketchResult, aCircleSketchFaces[0]) aRevolFt.selection("axis_object").setValue(aLineSketchResult, aLineEdge) +aRevolFt.string("CreationMethod").setValue("ByAngles") aRevolFt.real("from_angle").setValue(10) aRevolFt.real("to_angle").setValue(10) +aRevolFt.real("to_offset").setValue(0) #TODO: remove +aRevolFt.real("from_offset").setValue(0) #TODO: remove aRevolFt.execute() aSession.finishOperation() assert (aRevolFt.real("from_angle").value() == 10.0) diff --git a/src/GeomAPI/GeomAPI.i b/src/GeomAPI/GeomAPI.i index 95c6a128a..0d79eec6c 100644 --- a/src/GeomAPI/GeomAPI.i +++ b/src/GeomAPI/GeomAPI.i @@ -90,6 +90,7 @@ %include "GeomAPI_Pnt.h" %include "GeomAPI_Pnt2d.h" %include "GeomAPI_Shape.h" +%include "GeomAPI_ShapeExplorer.h" %include "GeomAPI_Vertex.h" %include "GeomAPI_XY.h" %include "GeomAPI_XYZ.h"