]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
[Code coverage FeaturesPlugin]: Improve coverage for Boolean operations
authorazv <azv@opencascade.com>
Mon, 10 Dec 2018 12:55:34 +0000 (15:55 +0300)
committerazv <azv@opencascade.com>
Mon, 10 Dec 2018 12:55:57 +0000 (15:55 +0300)
12 files changed:
src/FeaturesPlugin/CMakeLists.txt
src/FeaturesPlugin/Test/TestBooleanCommon_ErrorMsg.py
src/FeaturesPlugin/Test/TestBooleanCut_Compound_Solid.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestBooleanCut_ErrorMsg.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestBooleanFill_ErrorMsg.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestBooleanFuse_CompSolid_Face.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestBooleanFuse_ErrorMsg.py
src/FeaturesPlugin/Test/TestBooleanSmash_CompSolid_Solid.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestBooleanSmash_ErrorMsg.py
src/FeaturesPlugin/Test/TestFillCompsolidPlane.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestMeasurementPresentation.py
src/FeaturesPlugin/Test/TestPartition_ErrorMsg.py

index 9896d68af33ac99f656d3b71f3b30c5fcd5ff43f..538b466a6abd1f11c4a6a596b5259f37ba24a689 100644 (file)
@@ -200,6 +200,7 @@ ADD_UNIT_TESTS(TestExtrusion.py
                TestBooleanSmash.py
                TestBooleanFill.py
                TestBooleanFillWithPlane.py
+               TestBooleanFill_ErrorMsg.py
                TestMultiBoolean.py
                TestSerialBoolean.py
                TestBoolean_ErrorMsg.py
@@ -257,6 +258,7 @@ ADD_UNIT_TESTS(TestExtrusion.py
                TestFillSolidCompFace.py
                TestFillSolidShell.py
                TestFillSolidCompShell.py
+               TestFillCompsolidPlane.py
                TestPartition2Faces.py
                TestPartition2Solids.py
                TestPartition2Wires.py
@@ -333,8 +335,11 @@ ADD_UNIT_TESTS(TestExtrusion.py
                TestBooleanCut_Wire_Face.py
                TestBooleanCut_Wire_Wire.py
                TestBooleanCut_WireCompound_WireCompound.py
+               TestBooleanCut_Compound_Solid.py
+               TestBooleanCut_ErrorMsg.py
                TestBooleanSmash_Face_Face.py
                TestBooleanSmash_SubSolid_Solid.py
+               TestBooleanSmash_CompSolid_Solid.py
                TestBooleanSmash_ErrorMsg.py
                TestBooleanFuse_SimpleMode.py
                TestBooleanFuse_RemoveEdges.py
@@ -399,6 +404,7 @@ ADD_UNIT_TESTS(TestExtrusion.py
                TestBooleanFuse_ShellCompound_ShellCompound.py
                TestBooleanFuse_Solid_Solid.py
                TestBooleanFuse_SolidCompound_SolidCompound.py
+               TestBooleanFuse_CompSolid_Face.py
                TestBooleanFuse_CompSolid_CompSolid.py
                TestBooleanFuse_CompSolidCompound_CompSolidCompound.py
                TestFillet.py
index 06c97a58ba9d4e51b0b52c3abc271aeebbc5349a..1c1143fbdc6fa73d9e8177b2b64b1cab1eb43e3c 100644 (file)
@@ -35,3 +35,14 @@ assert(Common_1.feature().error() != "")
 Part_1_doc.removeFeature(Common_1.feature())
 
 model.end()
+
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+aSession.startOperation()
+Common_1 = Part_1_doc.addFeature("Common")
+Common_1.execute()
+assert(Common_1.error() != "")
+aSession.finishOperation()
diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_Compound_Solid.py b/src/FeaturesPlugin/Test/TestBooleanCut_Compound_Solid.py
new file mode 100644 (file)
index 0000000..6e85899
--- /dev/null
@@ -0,0 +1,45 @@
+## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Box_2 = model.addBox(Part_1_doc, 10, 10, 10)
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_2_1")], model.selection("EDGE", "PartSet/OX"), 20)
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Translation_1_1")])
+Box_3 = model.addBox(Part_1_doc, 20, 6, 20)
+Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_3_1")], -5, 2, -5)
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Compound_1_1_1")], [model.selection("SOLID", "Translation_2_1")])
+model.do()
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Cut_1, 1)
+model.testNbSubResults(Cut_1, [3])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.SOLID, [3])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [18])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [72])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [144])
+model.testResultsVolumes(Cut_1, [1400])
diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_ErrorMsg.py b/src/FeaturesPlugin/Test/TestBooleanCut_ErrorMsg.py
new file mode 100644 (file)
index 0000000..2549803
--- /dev/null
@@ -0,0 +1,36 @@
+## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+aSession.startOperation()
+Cut_1 = aPart.addFeature("Cut")
+Cut_1.execute()
+assert(Cut_1.error() != "")
+aSession.finishOperation()
diff --git a/src/FeaturesPlugin/Test/TestBooleanFill_ErrorMsg.py b/src/FeaturesPlugin/Test/TestBooleanFill_ErrorMsg.py
new file mode 100644 (file)
index 0000000..612fdf4
--- /dev/null
@@ -0,0 +1,36 @@
+## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+aSession.startOperation()
+Fill_1 = aPart.addFeature("Fill")
+Fill_1.execute()
+assert(Fill_1.error() != "")
+aSession.finishOperation()
diff --git a/src/FeaturesPlugin/Test/TestBooleanFuse_CompSolid_Face.py b/src/FeaturesPlugin/Test/TestBooleanFuse_CompSolid_Face.py
new file mode 100644 (file)
index 0000000..90d0037
--- /dev/null
@@ -0,0 +1,66 @@
+## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+from GeomAPI import GeomAPI_Shape
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_1 = SketchProjection_1.createdFeature()
+SketchCircle_1 = Sketch_1.addCircle(52.27216563767099, 0, 18.66006927176168)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_1.center())
+SketchCircle_2 = Sketch_1.addCircle(79.68333887668101, 0, 24.16077154338278)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_2.center())
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
+SketchLine_2 = Sketch_2.addLine(73.13136007081269, -14.25937060400964, 2.118687665902372, -14.25937060400964)
+SketchLine_3 = Sketch_2.addLine(2.118687665902372, -14.25937060400964, 2.118687665902372, 26.70061277610758)
+SketchLine_4 = Sketch_2.addLine(2.118687665902372, 26.70061277610758, 73.13136007081269, 26.70061277610758)
+SketchLine_5 = Sketch_2.addLine(73.13136007081269, 26.70061277610758, 73.13136007081269, -14.25937060400964)
+SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_2.result())
+SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_3.result())
+SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_4.result())
+SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_5.result())
+model.do()
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r")])
+Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
+Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], [model.selection("FACE", "Face_1_1")])
+
+model.testNbResults(Fuse_1, 1)
+model.testNbSubResults(Fuse_1, [2])
+model.testNbSubShapes(Fuse_1, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [4])
+model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [16])
+model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [32])
+model.testResultsVolumes(Fuse_1, [785.398163397447774514148477465])
+
+Fuse_2 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_3"), model.selection("SOLID", "Extrusion_1_1_1")], [model.selection("FACE", "Fuse_1_1_1")])
+assert(Fuse_2.feature().error() != "")
+
+model.end()
index 17441ab13cb4b2d1ff3910236c9be6df17f79a37..1801cab5a10172294fdbdcb1eb2323ca96e6c03d 100644 (file)
@@ -39,3 +39,14 @@ Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Partition_1_1_1")]
 assert(Fuse_1.feature().error() != "")
 Part_1_doc.removeFeature(Fuse_1.feature())
 model.end()
+
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+aSession.startOperation()
+Fuse_1 = Part_1_doc.addFeature("Fuse")
+Fuse_1.execute()
+assert(Fuse_1.error() != "")
+aSession.finishOperation()
diff --git a/src/FeaturesPlugin/Test/TestBooleanSmash_CompSolid_Solid.py b/src/FeaturesPlugin/Test/TestBooleanSmash_CompSolid_Solid.py
new file mode 100644 (file)
index 0000000..4819afe
--- /dev/null
@@ -0,0 +1,44 @@
+## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(-0.820365148699405, 7.40718257641344, 6.028904154999336)
+SketchCircle_2 = Sketch_1.addCircle(10.62009910116713, 13.94078752172051, 10.99163472554975)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+Smash_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2")], [model.selection("SOLID", "Box_1_1")])
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Smash_1, 1)
+model.testNbSubResults(Smash_1, [4])
+model.testNbSubShapes(Smash_1, GeomAPI_Shape.SOLID, [4])
+model.testNbSubShapes(Smash_1, GeomAPI_Shape.FACE, [28])
+model.testNbSubShapes(Smash_1, GeomAPI_Shape.EDGE, [120])
+model.testNbSubShapes(Smash_1, GeomAPI_Shape.VERTEX, [240])
+model.testResultsVolumes(Smash_1, [4980.404017506245509139262139797])
index b4a0fbceae61c324b9ce31cc14b48fc4680aec9e..519b542e2ac0b79cb9862e51b621077b3f2463da 100644 (file)
@@ -58,3 +58,14 @@ assert(Smash_1.feature().error() != "")
 Part_1_doc.removeFeature(Smash_1.feature())
 
 model.end()
+
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+aSession.startOperation()
+Smash_1 = Part_1_doc.addFeature("Smash")
+Smash_1.execute()
+assert(Smash_1.error() != "")
+aSession.finishOperation()
diff --git a/src/FeaturesPlugin/Test/TestFillCompsolidPlane.py b/src/FeaturesPlugin/Test/TestFillCompsolidPlane.py
new file mode 100644 (file)
index 0000000..5558109
--- /dev/null
@@ -0,0 +1,48 @@
+## Copyright (C) 2018-20xx  CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_1 = SketchProjection_1.createdFeature()
+SketchCircle_1 = Sketch_1.addCircle(11.92861402549826, 0, 16.05621803603458)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_1.center())
+SketchCircle_2 = Sketch_1.addCircle(37.8779560884558, 0, 17.74637067763095)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_2.center())
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2")], [model.selection("FACE", "PartSet/XOZ")])
+model.do()
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Fill_1, 1)
+model.testNbSubResults(Fill_1, [5])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.SOLID, [5])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.FACE, [25])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.EDGE, [90])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.VERTEX, [180])
+model.testResultsVolumes(Fill_1, [16831.622023411000554915517568588])
index c64660c8af54427875c80d6dcbf245c1dae61935..97d2f80eff5f6a9b4ea2d6d0f3d16331a154c139 100644 (file)
@@ -47,7 +47,10 @@ aSession.startOperation()
 aMeasurement = Part_1_doc.addFeature("Measurement")
 aMeasurement.string("MeasureKind").setValue("Length")
 aMeasurement.selection("edge_for_length").selectSubShape("EDGE", "Sketch_1/SketchLine_1")
-assert(featureToPresentation(aMeasurement).getAISObject(None) is not None)
+anAIS = featureToPresentation(aMeasurement).getAISObject(None)
+assert(anAIS is not None)
+anAIS = featureToPresentation(aMeasurement).getAISObject(anAIS)
+assert(anAIS is not None)
 aSession.finishOperation()
 
 aSession.startOperation()
@@ -55,14 +58,20 @@ aMeasurement = Part_1_doc.addFeature("Measurement")
 aMeasurement.string("MeasureKind").setValue("Distance")
 aMeasurement.selection("distance_from").selectSubShape("VERTEX", "Sketch_1/SketchLine_1_StartVertex")
 aMeasurement.selection("distance_to").selectSubShape("EDGE", "Sketch_1/SketchLine_2")
-assert(featureToPresentation(aMeasurement).getAISObject(None) is not None)
+anAIS = featureToPresentation(aMeasurement).getAISObject(None)
+assert(anAIS is not None)
+anAIS = featureToPresentation(aMeasurement).getAISObject(anAIS)
+assert(anAIS is not None)
 aSession.finishOperation()
 
 aSession.startOperation()
 aMeasurement = Part_1_doc.addFeature("Measurement")
 aMeasurement.string("MeasureKind").setValue("Radius")
 aMeasurement.selection("circular").selectSubShape("EDGE", "Sketch_1/SketchArc_1_2")
-assert(featureToPresentation(aMeasurement).getAISObject(None) is not None)
+anAIS = featureToPresentation(aMeasurement).getAISObject(None)
+assert(anAIS is not None)
+anAIS = featureToPresentation(aMeasurement).getAISObject(anAIS)
+assert(anAIS is not None)
 aSession.finishOperation()
 
 aSession.startOperation()
@@ -70,7 +79,10 @@ aMeasurement = Part_1_doc.addFeature("Measurement")
 aMeasurement.string("MeasureKind").setValue("Angle")
 aMeasurement.selection("angle_from").selectSubShape("EDGE", "Sketch_1/SketchLine_1")
 aMeasurement.selection("angle_to").selectSubShape("EDGE", "Sketch_1/SketchLine_2")
-assert(featureToPresentation(aMeasurement).getAISObject(None) is not None)
+anAIS = featureToPresentation(aMeasurement).getAISObject(None)
+assert(anAIS is not None)
+anAIS = featureToPresentation(aMeasurement).getAISObject(anAIS)
+assert(anAIS is not None)
 aSession.finishOperation()
 
 aSession.startOperation()
@@ -79,5 +91,8 @@ aMeasurement.string("MeasureKind").setValue("AngleBy3Points")
 aMeasurement.selection("angle_point_1").selectSubShape("VERTEX", "Sketch_1/SketchLine_1_StartVertex")
 aMeasurement.selection("angle_point_2").selectSubShape("VERTEX", "Sketch_1/SketchLine_1_EndVertex")
 aMeasurement.selection("angle_point_3").selectSubShape("VERTEX", "Sketch_1/SketchLine_2_EndVertex")
-assert(featureToPresentation(aMeasurement).getAISObject(None) is not None)
+anAIS = featureToPresentation(aMeasurement).getAISObject(None)
+assert(anAIS is not None)
+anAIS = featureToPresentation(aMeasurement).getAISObject(anAIS)
+assert(anAIS is not None)
 aSession.finishOperation()
index 40782a434327fa8e46fe33c67545bd34eb8b13d0..9addcbe6a6f8ead8c2f74b609b6adc943cd236a7 100644 (file)
@@ -45,3 +45,14 @@ assert(Partition_1.feature().error() != "")
 Part_1_doc.removeFeature(Partition_1.feature())
 
 model.end()
+
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+aSession.startOperation()
+Partition_1 = Part_1_doc.addFeature("Partition")
+Partition_1.execute()
+assert(Partition_1.error() != "")
+aSession.finishOperation()