Salome HOME
Tests update
authordbv <dbv@opencascade.com>
Wed, 9 Sep 2015 09:05:42 +0000 (12:05 +0300)
committerdbv <dbv@opencascade.com>
Wed, 9 Sep 2015 09:06:36 +0000 (12:06 +0300)
src/FeaturesPlugin/Test/TestPartition.py
src/FeaturesPlugin/Test/TestRevolution.py

index 84c70c49c9f97c7a9896ff1dc090a70ed00031b9..6b8c5da5cb151278528e2b7774f4964007c125ee 100644 (file)
@@ -75,15 +75,27 @@ assert (len(anExtrusionFt.results()) > 0)
 anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult())
 assert (anExtrusionResult is not None)
 
+#=========================================================================
+# Create plane
+#=========================================================================
+aSession.startOperation()
+aPlaneFeature = aPart.addFeature("Plane")
+aPlaneFeature.string("CreationMethod").setValue("PlaneByGeneralEquation")
+aPlaneFeature.real("A").setValue(0.)
+aPlaneFeature.real("B").setValue(1.)
+aPlaneFeature.real("C").setValue(0.)
+aPlaneFeature.real("D").setValue(1.)
+aSession.finishOperation()
+aPlaneResult = aPlaneFeature.firstResult()
+
 #=========================================================================
 # Create a partition
 #=========================================================================
-aXOZPlane = modelAPI_Result(aDocument.objectByName("Construction", "XOZ"))
 aSession.startOperation()
 aPartitionFt = aPart.addFeature("Partition")
 assert (aPartitionFt.getKind() == "Partition")
 aPartitionFt.selectionList("main_objects").append(anExtrusionResult, anExtrusionResult.shape())
-aPartitionFt.selectionList("tool_objects").append(aXOZPlane, None)
+aPartitionFt.selectionList("tool_objects").append(aPlaneResult, None)
 aPartitionFt.execute()
 aSession.finishOperation()
 
index 1dd1ee277a11be158a18a06f663d8869a67c6917..9bb13f88f7b456006a1b78494739a0af5aadfb07 100644 (file)
@@ -128,33 +128,31 @@ aRevolResult = modelAPI_ResultBody(aRevolFt.firstResult())
 assert (aRevolResult is not None)
 
 #=========================================================================
-# Create a first plane
+# Create bounding planes
 #=========================================================================
-aXOYPlane = modelAPI_Result(aDocument.objectByName("Construction", "XOY"))
+# Create from plane
 aSession.startOperation()
-aPlaneFeature = aPart.addFeature("Plane")
-aPlaneFeatureData = aPlaneFeature.data()
-assert(aPlaneFeatureData is not None)
-aPlaneFeatureData.string("CreationMethod").setValue("PlaneByFaceAndDistance")
-aPlaneFeatureData.selection("planeFace").setValue(aXOYPlane, None)
-aPlaneFeatureData.real("distance").setValue(50)
-aPlaneFeature.execute()
+aFromPlaneFeature = aPart.addFeature("Plane")
+aFromPlaneFeature.string("CreationMethod").setValue("PlaneByGeneralEquation")
+aFromPlaneFeature.real("A").setValue(0.)
+aFromPlaneFeature.real("B").setValue(0.)
+aFromPlaneFeature.real("C").setValue(1.)
+aFromPlaneFeature.real("D").setValue(50.)
 aSession.finishOperation()
-aPlane1Result = aPlaneFeature.firstResult();
+aFromResult = aFromPlaneFeature.firstResult()
+aFromShape = modelAPI_ResultConstruction(aFromResult).shape()
 
-#=========================================================================
-# Create a second plane
-#=========================================================================
+# Create to plane
 aSession.startOperation()
-aPlaneFeature = aPart.addFeature("Plane")
-aPlaneFeatureData = aPlaneFeature.data()
-assert(aPlaneFeatureData is not None)
-aPlaneFeatureData.string("CreationMethod").setValue("PlaneByFaceAndDistance")
-aPlaneFeatureData.selection("planeFace").setValue(aXOYPlane, None)
-aPlaneFeatureData.real("distance").setValue(-50)
-aPlaneFeature.execute()
+aToPlaneFeature = aPart.addFeature("Plane")
+aToPlaneFeature.string("CreationMethod").setValue("PlaneByGeneralEquation")
+aToPlaneFeature.real("A").setValue(0.)
+aToPlaneFeature.real("B").setValue(0.)
+aToPlaneFeature.real("C").setValue(1.)
+aToPlaneFeature.real("D").setValue(-50.)
 aSession.finishOperation()
-aPlane2Result = aPlaneFeature.firstResult();
+aToResult = aToPlaneFeature.firstResult()
+aToShape = modelAPI_ResultConstruction(aToResult).shape()
 
 #=========================================================================
 # Test revol between bounding planes
@@ -169,9 +167,9 @@ aRevolFt.selection("axis_object").setValue(aLineSketchResult, aLineEdge)
 aRevolFt.string("CreationMethod").setValue("ByPlanesAndOffsets")
 aRevolFt.real("from_angle").setValue(0) #TODO: remove
 aRevolFt.real("to_angle").setValue(0) #TODO: remove
-aRevolFt.selection("to_object").setValue(aPlane1Result, None)
+aRevolFt.selection("to_object").setValue(aToResult, None)
 aRevolFt.real("to_offset").setValue(0)
-aRevolFt.selection("from_object").setValue(aPlane2Result, None)
+aRevolFt.selection("from_object").setValue(aFromResult, None)
 aRevolFt.real("from_offset").setValue(0)
 aRevolFt.execute()
 aSession.finishOperation()