]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Tests update
authordbv <dbv@opencascade.com>
Tue, 30 Jun 2015 22:53:31 +0000 (01:53 +0300)
committerdbv <dbv@opencascade.com>
Tue, 30 Jun 2015 22:53:31 +0000 (01:53 +0300)
src/FeaturesPlugin/Test/TestBoolean.py
src/FeaturesPlugin/Test/TestExtrusion.py
src/FeaturesPlugin/Test/TestMultiBoolean.py
src/FeaturesPlugin/Test/TestRevolution.py
src/GeomAPI/GeomAPI.i

index 9393bee87f2948ae48ebf3cb56b00c22be88b392..c83eb2f2b54816da15651c3ada20dfab72c5d604 100644 (file)
@@ -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()
index b74979c8bec7e4196c115598e93908905591623d..2e8e6312d1bbb48ef7dcb2f5819bb4f11228e63c 100644 (file)
@@ -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()
 
index bb185acb6558952d6838bdf952693526f5a3193d..e4577bd4df64e71f992fbfc8dcf96719822e96d0 100644 (file)
@@ -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()
 
 #=========================================================================
index f0806e666acd6be26a9e89f034a9e89e1068c99d..7a6b0c40864753733d08665ce0f3329d53f49e30 100644 (file)
@@ -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)
index 95c6a128a30394602e9ef47af8a048b197911a93..0d79eec6c8e94814fe36e61c63a7d777101c13c4 100644 (file)
@@ -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"