anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult())
assert (anExtrusionResult is not None)
+#=========================================================================
+# Create plane
+#=========================================================================
+aSession.startOperation()
+aPlaneFeature = aPart.addFeature("Plane")
+aPlaneFeature.string("creation_method").setValue("by_general_equation")
+aPlaneFeature.string("by_other_plane_option").setValue("by_distance_from_other") # TODO: remove
+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("base_objects").append(anExtrusionResult, anExtrusionResult.shape())
+aPartitionFt.selectionList("base_objects").append(aPlaneResult, None)
aPartitionFt.execute()
aSession.finishOperation()
+#=========================================================================
+# Test results
+#=========================================================================
+aFactory = ModelAPI_Session.get().validators()
+assert (aFactory.validate(aPartitionFt))
assert (len(aPartitionFt.results()) > 0)
aPartitionResult = modelAPI_ResultBody(aPartitionFt.firstResult())
assert (aPartitionResult is not None)
+aSession.undo()
+
+#=========================================================================
+# Create a partition
+#=========================================================================
+aSession.startOperation()
+aPartitionFt = aPart.addFeature("Partition")
+assert (aPartitionFt.getKind() == "Partition")
+aPartitionFt.selectionList("base_objects").append(anExtrusionResult, anExtrusionResult.shape())
+aPartitionFt.selectionList("base_objects").append(aPlaneResult, None)
+aPartitionFt.execute()
+aSession.finishOperation()
+
+#=========================================================================
+# Test results
+#=========================================================================
+aFactory = ModelAPI_Session.get().validators()
+assert (aFactory.validate(aPartitionFt))
+assert (len(aPartitionFt.results()) > 0)
+aPartitionResult = modelAPI_ResultBody(aPartitionFt.firstResult())
+assert (aPartitionResult is not None)
+
+import model
+assert(model.checkPythonDump())