]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Added unit-tests for High Level Objects History task for features Compound, Common...
authormpv <mpv@opencascade.com>
Mon, 11 Feb 2019 09:23:28 +0000 (12:23 +0300)
committermpv <mpv@opencascade.com>
Mon, 11 Feb 2019 09:23:28 +0000 (12:23 +0300)
src/BuildPlugin/CMakeLists.txt
src/BuildPlugin/Test/TestCompound_History.py [new file with mode: 0644]
src/FeaturesPlugin/CMakeLists.txt
src/FeaturesPlugin/Test/TestBooleanCommon_SolidsHistory.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestBooleanCut_SolidsHistory.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestBooleanSmash_SolidsHistory.py [new file with mode: 0644]
src/FeaturesPlugin/Test/TestPartition_SolidsHistory.py [new file with mode: 0644]

index e1a122a0981503fab6543232e671f2955b1f37aa..ac7d7d63f6bb1a365e8e43c3a21629aac6a0d974 100644 (file)
@@ -120,6 +120,7 @@ ADD_UNIT_TESTS(TestVertex.py
                TestCompSolid.py
                TestCompound.py
                TestCompound_ErrorMsg.py
+               TestCompound_History.py
                TestSubShapes.py
                TestSubShapes_ErrorMsg.py
                TestFilling.py
diff --git a/src/BuildPlugin/Test/TestCompound_History.py b/src/BuildPlugin/Test/TestCompound_History.py
new file mode 100644 (file)
index 0000000..a0b494b
--- /dev/null
@@ -0,0 +1,73 @@
+## Copyright (C) 2014-2017  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>
+##
+
+# Test that the history of compound works correctly after movement of groups after this compound feature
+
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+from ModelAPI import *
+from GeomAPI import *
+
+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"))
+SketchPoint_1 = Sketch_1.addPoint(-19.03078817733991, 40.92241379310347)
+SketchLine_1 = Sketch_1.addLine(-0.7463054187192111, 38.55911330049261, -18.03571428571429, 28.48399014778325)
+SketchCircle_1 = Sketch_1.addCircle(-2.238916256157633, 23.13546798029557, 5.523556488740459)
+model.do()
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchPoint_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection(), 10, 0)
+Group_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("VERTEX", "Edge_1_1/Modified_Vertex&Sketch_1/SketchLine_1_EndVertex"), model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]")]
+Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
+Group_2 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]")])
+Group_3 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")])
+Compound_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), model.selection("SOLID", "Extrusion_1_1")]
+Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects)
+model.do()
+# move groups after the compound
+Part_1_doc.moveFeature(Group_1.feature(), Compound_1.feature())
+Part_1_doc.moveFeature(Group_2.feature(), Group_1.feature())
+Part_1_doc.moveFeature(Group_3.feature(), Group_2.feature())
+model.end()
+
+# check groups are correct
+aFactory = ModelAPI_Session.get().validators()
+selectionList = Group_1.feature().selectionList("group_list")
+assert(selectionList.size() == 3)
+assert(aFactory.validate(Group_1.feature()))
+for i in range(3):
+  assert(Group_1.groupList().value(i).value().shapeType() == GeomAPI_Shape.VERTEX)
+
+selectionList = Group_2.feature().selectionList("group_list")
+assert(selectionList.size() == 2)
+assert(aFactory.validate(Group_2.feature()))
+for i in range(2):
+  assert(Group_2.groupList().value(i).value().shapeType() == GeomAPI_Shape.EDGE)
+
+selectionList = Group_3.feature().selectionList("group_list")
+assert(selectionList.size() == 1)
+assert(aFactory.validate(Group_3.feature()))
+assert(Group_3.groupList().value(0).value().shapeType() == GeomAPI_Shape.SOLID)
+
+assert(model.checkPythonDump())
index 4584ba1d87b3a80e0e7be0a9ec9fe79148e97974..d9e923df2755d2e90f8042b7d36c14082d7b1437 100644 (file)
@@ -357,10 +357,12 @@ ADD_UNIT_TESTS(TestExtrusion.py
                TestBooleanCut_WireCompound_WireCompound.py
                TestBooleanCut_Compound_Solid.py
                TestBooleanCut_ErrorMsg.py
+               TestBooleanCut_SolidsHistory.py
                TestBooleanSmash_Face_Face.py
                TestBooleanSmash_SubSolid_Solid.py
                TestBooleanSmash_CompSolid_Solid.py
                TestBooleanSmash_ErrorMsg.py
+               TestBooleanSmash_SolidsHistory.py
                TestBooleanFuse_SimpleMode.py
                TestBooleanFuse_RemoveEdges.py
                TestBooleanFuse_ErrorMsg.py
@@ -390,6 +392,7 @@ ADD_UNIT_TESTS(TestExtrusion.py
                TestBooleanCommon_CompSolidCompound_Shell.py
                TestBooleanCommon_CompSolidCompound_CompSolidCompound.py
                TestBooleanCommon_ErrorMsg.py
+               TestBooleanCommon_SolidsHistory.py
                Test2596.py
                Test2592.py
                Test2588.py
@@ -412,6 +415,7 @@ ADD_UNIT_TESTS(TestExtrusion.py
                TestPartitionSubCompsolidWithPlane3.py
                TestPartitionSubCompsolidWithPlane4.py
                TestPartitionSubCompsolidWithPlane5.py
+               TestPartition_SolidsHistory.py
                TestBooleanFuse_Vertex_Vertex.py
                TestBooleanFuse_VertexCompound_VertexCompound.py
                TestBooleanFuse_Edge_Edge.py
diff --git a/src/FeaturesPlugin/Test/TestBooleanCommon_SolidsHistory.py b/src/FeaturesPlugin/Test/TestBooleanCommon_SolidsHistory.py
new file mode 100644 (file)
index 0000000..b59c018
--- /dev/null
@@ -0,0 +1,132 @@
+## Copyright (C) 2014-2017  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>
+##
+
+# Test that the history of Common operation works correctly after movement of groups after this Common feature:
+
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+from ModelAPI import *
+from GeomAPI import *
+from SketchAPI import *
+
+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"))
+SketchCircle_1 = Sketch_1.addCircle(5, 5, 7.071067811865464)
+SketchCircle_2 = Sketch_1.addCircle(0, 10, 7.071067811865464)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchCircle_2.results()[1])
+SketchCircle_3 = Sketch_1.addCircle(-5, 5, 7.071067811865464)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchCircle_3.results()[1])
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchCircle_3.center(), SketchCircle_2.results()[1])
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchCircle_1.results()[1], SketchCircle_2.center())
+SketchCircle_4 = Sketch_1.addCircle(0, 0, 7.071067811865464)
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchCircle_4.center(), SketchCircle_3.results()[1])
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchCircle_4.results()[1], SketchCircle_3.center())
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchCircle_4.results()[1], SketchCircle_1.center())
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchCircle_1.center(), SketchCircle_3.center(), 10, True)
+SketchConstraintDistance_2 = Sketch_1.setDistance(SketchCircle_2.center(), SketchCircle_4.center(), 10, True)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchCircle_4.center(), SketchAPI_Point(SketchPoint_1).coordinates())
+SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
+SketchLine_1 = SketchProjection_2.createdFeature()
+SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchLine_1.result())
+model.do()
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_2 = Sketch_2.addLine(-5, 5, 0, 0)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchCircle_3_2__cc"), False)
+SketchPoint_2 = SketchProjection_3.createdFeature()
+SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_2.startPoint(), SketchPoint_2.result())
+SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchCircle_4_2__cc"), False)
+SketchPoint_3 = SketchProjection_4.createdFeature()
+SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchPoint_3.result())
+SketchLine_3 = Sketch_2.addLine(0, 0, 5, 5)
+SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchProjection_5 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchCircle_1_2__cc"), False)
+SketchPoint_4 = SketchProjection_5.createdFeature()
+SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchPoint_4.result())
+SketchLine_4 = Sketch_2.addLine(-5, 5, 5, 5)
+SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_2.startPoint(), SketchLine_4.startPoint())
+SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.endPoint())
+SketchArc_1 = Sketch_2.addArc(-1.474514954580286e-16, 5, -5, 5, 5, 5, True)
+SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_4.result(), SketchArc_1.center())
+SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_2.startPoint(), SketchArc_1.startPoint())
+SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchArc_1.endPoint())
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection(), 10, 0)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_2")], model.selection(), 5, 5)
+Group_1_objects = [model.selection("SOLID", "Extrusion_1_1_13"), model.selection("SOLID", "Extrusion_1_1_10"), model.selection("SOLID", "Extrusion_1_1_7"), model.selection("SOLID", "Extrusion_1_1_9"), model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_5"), model.selection("SOLID", "Extrusion_1_1_4"), model.selection("SOLID", "Extrusion_1_1_12"), model.selection("SOLID", "Extrusion_1_1_11"), model.selection("SOLID", "Extrusion_1_1_8"), model.selection("SOLID", "Extrusion_1_1_3"), model.selection("SOLID", "Extrusion_1_1_6"), model.selection("SOLID", "Extrusion_1_1_2")]
+Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
+Group_2 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1_2"), model.selection("SOLID", "Extrusion_2_1_1")])
+Group_3_objects = [model.selection("FACE", "Extrusion_1_1_7/From_Face"), model.selection("FACE", "Extrusion_1_1_1/From_Face"), model.selection("FACE", "Extrusion_1_1_9/From_Face"), model.selection("FACE", "Extrusion_1_1_12/From_Face"), model.selection("FACE", "Extrusion_1_1_4/From_Face"), model.selection("FACE", "Extrusion_1_1_5/From_Face"), model.selection("FACE", "Extrusion_1_1_8/From_Face"), model.selection("FACE", "Extrusion_1_1_11/From_Face"), model.selection("FACE", "Extrusion_1_1_6/From_Face"), model.selection("FACE", "Extrusion_1_1_2/From_Face"), model.selection("FACE", "Extrusion_1_1_3/From_Face"), model.selection("FACE", "Extrusion_1_1_10/From_Face")]
+Group_3 = model.addGroup(Part_1_doc, Group_3_objects)
+Group_4_objects = [model.selection("FACE", "Extrusion_2_1_2/Generated_Face&Sketch_2/SketchLine_4"), model.selection("FACE", "Extrusion_2_1_2/Generated_Face&Sketch_2/SketchArc_1_2"), model.selection("FACE", "Extrusion_2_1_2/From_Face"), model.selection("FACE", "Extrusion_2_1_2/To_Face"), model.selection("FACE", "Extrusion_2_1_1/Generated_Face&Sketch_2/SketchLine_2"), model.selection("FACE", "Extrusion_2_1_1/To_Face"), model.selection("FACE", "Extrusion_2_1_1/From_Face"), model.selection("FACE", "Extrusion_2_1_1/Generated_Face&Sketch_2/SketchLine_4"), model.selection("FACE", "Extrusion_2_1_1/Generated_Face&Sketch_2/SketchLine_3")]
+Group_4 = model.addGroup(Part_1_doc, Group_4_objects)
+Common_1 = model.addCommon(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPSOLID", "Extrusion_2_1")])
+Common_1.result().subResult(0).setColor(254, 254, 127)
+Common_1.result().subResult(1).setColor(204, 102, 204)
+Common_1.result().subResult(2).setColor(51, 102, 102)
+Common_1.result().subResult(3).setColor(0, 153, 0)
+Common_1.result().subResult(4).setColor(254, 0, 0)
+Common_1.result().subResult(5).setColor(204, 0, 204)
+Common_1.result().subResult(6).setColor(102, 0, 0)
+Common_1.result().subResult(7).setColor(0, 0, 153)
+Common_1.result().subResult(8).setColor(0, 0, 204)
+Common_1.result().subResult(9).setColor(0, 0, 204)
+Common_1.result().subResult(10).setColor(0, 153, 0)
+Common_1.result().subResult(11).setColor(127, 127, 254)
+model.do()
+# move groups after the Common
+Part_1_doc.moveFeature(Group_1.feature(), Common_1.feature())
+Part_1_doc.moveFeature(Group_2.feature(), Group_1.feature())
+Part_1_doc.moveFeature(Group_3.feature(), Group_2.feature())
+Part_1_doc.moveFeature(Group_4.feature(), Group_3.feature())
+model.end()
+
+# check groups are correct
+aFactory = ModelAPI_Session.get().validators()
+selectionList = Group_1.feature().selectionList("group_list")
+assert(selectionList.size() == 12)
+assert(aFactory.validate(Group_1.feature()))
+for i in range(12):
+  assert(Group_1.groupList().value(i).value().shapeType() == GeomAPI_Shape.SOLID)
+
+selectionList = Group_2.feature().selectionList("group_list")
+assert(selectionList.size() == 12)
+assert(aFactory.validate(Group_2.feature()))
+for i in range(12):
+  assert(Group_2.groupList().value(i).value().shapeType() == GeomAPI_Shape.SOLID)
+
+selectionList = Group_3.feature().selectionList("group_list")
+assert(selectionList.size() == 12)
+assert(aFactory.validate(Group_3.feature()))
+for i in range(12):
+  assert(Group_3.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE)
+
+selectionList = Group_4.feature().selectionList("group_list")
+assert(selectionList.size() == 22)
+assert(aFactory.validate(Group_4.feature()))
+for i in range(22):
+  assert(Group_4.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE)
+
+assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING))
diff --git a/src/FeaturesPlugin/Test/TestBooleanCut_SolidsHistory.py b/src/FeaturesPlugin/Test/TestBooleanCut_SolidsHistory.py
new file mode 100644 (file)
index 0000000..5fc9567
--- /dev/null
@@ -0,0 +1,77 @@
+## Copyright (C) 2014-2017  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>
+##
+
+# Test that the history of Cut operation works correctly after movement of groups after this Cut feature:
+# cut tools are deleted, cut objects are correctly transformed to and divided if needed
+
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+from ModelAPI import *
+from GeomAPI import *
+
+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"))
+SketchCircle_1 = Sketch_1.addCircle(-10.57884322822754, 25.90966115484096, 9.63424990252037)
+SketchLine_1 = Sketch_1.addLine(-18.29572175958338, 20.14177099321736, -2.288684850537554, 30.81802598002054)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1])
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1])
+model.do()
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_2 = Sketch_2.addLine(7.424373233594292, 20.04016872303595, -10.19950738916256, 28.60837438423646)
+SketchLine_3 = Sketch_2.addLine(-10.19950738916256, 28.60837438423646, 10.7835313495703, 29.11992811073657)
+SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchLine_4 = Sketch_2.addLine(10.7835313495703, 29.11992811073657, 7.424373233594292, 20.04016872303595)
+SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_2.startPoint(), SketchLine_4.endPoint())
+SketchLine_5 = Sketch_2.addLine(-10.19950738916256, 28.60837438423646, 9.111243103183778, 24.59975538297626)
+SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_4.result())
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1"), model.selection("COMPOUND", "all-in-Sketch_2")], model.selection(), 10, 0)
+Group_1_objects = [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_2_2"), model.selection("SOLID", "Extrusion_1_2_1")]
+Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
+Group_2_objects = [model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1"), model.selection("FACE", "Extrusion_1_1_2/To_Face"), model.selection("FACE", "Extrusion_1_2_2/To_Face")]
+Group_2 = model.addGroup(Part_1_doc, Group_2_objects)
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2")], [model.selection("SOLID", "Extrusion_1_2_2")])
+model.do()
+# move groups after the Cut
+Part_1_doc.moveFeature(Group_1.feature(), Cut_1.feature())
+Part_1_doc.moveFeature(Group_2.feature(), Group_1.feature())
+model.end()
+
+# check groups are correct
+aFactory = ModelAPI_Session.get().validators()
+selectionList = Group_1.feature().selectionList("group_list")
+assert(selectionList.size() == 2)
+assert(aFactory.validate(Group_1.feature()))
+for i in range(2):
+  assert(Group_1.groupList().value(i).value().shapeType() == GeomAPI_Shape.SOLID)
+
+selectionList = Group_2.feature().selectionList("group_list")
+assert(selectionList.size() == 3)
+assert(aFactory.validate(Group_2.feature()))
+for i in range(3):
+  assert(Group_2.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE)
+
+assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/TestBooleanSmash_SolidsHistory.py b/src/FeaturesPlugin/Test/TestBooleanSmash_SolidsHistory.py
new file mode 100644 (file)
index 0000000..44354bf
--- /dev/null
@@ -0,0 +1,122 @@
+## Copyright (C) 2014-2017  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>
+##
+
+# Test that the history of Smash operation works correctly after movement of groups after this Smash feature
+
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+from ModelAPI import *
+from GeomAPI import *
+
+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"))
+SketchLine_1 = Sketch_1.addLine(26.49384236453203, 25.42805779478775, -23.25985221674878, 25.42805779478775)
+SketchLine_2 = Sketch_1.addLine(-23.25985221674878, 25.42805779478775, -23.25985221674878, -22.79086009461325)
+SketchLine_3 = Sketch_1.addLine(-23.25985221674878, -22.79086009461325, 26.49384236453203, -22.79086009461325)
+SketchLine_4 = Sketch_1.addLine(26.49384236453203, -22.79086009461325, 26.49384236453203, 25.42805779478775)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+SketchLine_5 = Sketch_1.addLine(-23.25985221674878, -22.79086009461325, -4.602216748768477, 25.42805779478775)
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_1.result())
+SketchLine_6 = Sketch_1.addLine(-4.602216748768477, 25.42805779478775, 8.458128078817737, -22.79086009461324)
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_3.result())
+SketchLine_7 = Sketch_1.addLine(8.458128078817737, -22.79086009461324, 26.49384236453203, 25.42805779478775)
+SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
+SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_7.endPoint())
+model.do()
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_8 = Sketch_2.addLine(38.18596059113301, 15.79679802955666, -30.91800131851275, 15.79679802955666)
+SketchLine_9 = Sketch_2.addLine(-30.91800131851275, 15.79679802955666, -30.91800131851275, -10.07512315270936)
+SketchLine_10 = Sketch_2.addLine(-30.91800131851275, -10.07512315270936, 38.18596059113301, -10.07512315270936)
+SketchLine_11 = Sketch_2.addLine(38.18596059113301, -10.07512315270936, 38.18596059113301, 15.79679802955666)
+SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_8.startPoint())
+SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
+SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
+SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint())
+SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_8.result())
+SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_9.result())
+SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_10.result())
+SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_11.result())
+SketchLine_12 = Sketch_2.addLine(38.18596059113301, 15.79679802955666, -30.91800131851275, 1.368226600985215)
+SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_8.startPoint(), SketchLine_12.startPoint())
+SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_9.result())
+SketchLine_13 = Sketch_2.addLine(-30.91800131851275, 1.368226600985215, 38.18596059113301, -10.07512315270936)
+SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint())
+SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_13.endPoint())
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection(), 10, 0)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_2")], model.selection(), 5, 5)
+Group_1_objects = [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_4"), model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_1_1_3")]
+Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
+Group_2_objects = [model.selection("SOLID", "Extrusion_2_1_2"), model.selection("SOLID", "Extrusion_2_1_3"), model.selection("SOLID", "Extrusion_2_1_1")]
+Group_2 = model.addGroup(Part_1_doc, Group_2_objects)
+Group_3_objects = [model.selection("FACE", "Extrusion_1_1_4/From_Face"), model.selection("FACE", "Extrusion_1_1_2/From_Face"), model.selection("FACE", "Extrusion_1_1_4/Generated_Face&Sketch_1/SketchLine_3"), model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1"), model.selection("FACE", "Extrusion_1_1_4/To_Face"), model.selection("FACE", "Extrusion_1_1_2/To_Face")]
+Group_3 = model.addGroup(Part_1_doc, Group_3_objects)
+Group_4_objects = [model.selection("FACE", "Extrusion_2_1_2/To_Face"), model.selection("FACE", "Extrusion_2_1_3/To_Face"), model.selection("FACE", "Extrusion_2_1_1/To_Face")]
+Group_4 = model.addGroup(Part_1_doc, Group_4_objects)
+Smash_1_objects_1 = [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_4"), model.selection("SOLID", "Extrusion_1_1_2")]
+Smash_1 = model.addSmash(Part_1_doc, Smash_1_objects_1, [model.selection("SOLID", "Extrusion_2_1_1"), model.selection("SOLID", "Extrusion_2_1_2")])
+model.do()
+# move groups after the Smash
+Part_1_doc.moveFeature(Group_1.feature(), Smash_1.feature())
+Part_1_doc.moveFeature(Group_2.feature(), Group_1.feature())
+Part_1_doc.moveFeature(Group_3.feature(), Group_2.feature())
+Part_1_doc.moveFeature(Group_4.feature(), Group_3.feature())
+model.end()
+
+# check groups are correct
+aFactory = ModelAPI_Session.get().validators()
+selectionList = Group_1.feature().selectionList("group_list")
+assert(selectionList.size() == 4)
+assert(aFactory.validate(Group_1.feature()))
+for i in range(4):
+  assert(Group_1.groupList().value(i).value().shapeType() == GeomAPI_Shape.SOLID)
+
+selectionList = Group_2.feature().selectionList("group_list")
+assert(selectionList.size() == 2)
+assert(aFactory.validate(Group_2.feature()))
+for i in range(2):
+  assert(Group_2.groupList().value(i).value().shapeType() == GeomAPI_Shape.SOLID)
+
+selectionList = Group_3.feature().selectionList("group_list")
+assert(selectionList.size() == 10)
+assert(aFactory.validate(Group_3.feature()))
+for i in range(10):
+  assert(Group_3.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE)
+
+selectionList = Group_4.feature().selectionList("group_list")
+assert(selectionList.size() == 10)
+assert(aFactory.validate(Group_4.feature()))
+for i in range(10):
+  assert(Group_4.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE)
+
+assert(model.checkPythonDump())
diff --git a/src/FeaturesPlugin/Test/TestPartition_SolidsHistory.py b/src/FeaturesPlugin/Test/TestPartition_SolidsHistory.py
new file mode 100644 (file)
index 0000000..ea7a2da
--- /dev/null
@@ -0,0 +1,91 @@
+## Copyright (C) 2014-2017  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>
+##
+
+# Test that partition of solid works correctly after movement of groups after this partition
+
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+from ModelAPI import *
+from GeomAPI import *
+
+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"))
+SketchLine_1 = Sketch_1.addLine(-16.04556650246306, 45.15147783251232, -31.59359605911331, 45.15147783251232)
+SketchLine_2 = Sketch_1.addLine(-31.59359605911331, 45.15147783251232, -31.59359605911331, 29.10591133004927)
+SketchLine_3 = Sketch_1.addLine(-31.59359605911331, 29.10591133004927, -16.04556650246306, 29.10591133004927)
+SketchLine_4 = Sketch_1.addLine(-16.04556650246306, 29.10591133004927, -16.04556650246306, 45.15147783251232)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+SketchLine_5 = Sketch_1.addLine(12.4384236453202, 13.06034482758621, -5.846059113300496, 13.06034482758621)
+SketchLine_6 = Sketch_1.addLine(-5.846059113300496, 13.06034482758621, -5.846059113300496, -6.965517241379309)
+SketchLine_7 = Sketch_1.addLine(-5.846059113300496, -6.965517241379309, 12.4384236453202, -6.965517241379309)
+SketchLine_8 = Sketch_1.addLine(12.4384236453202, -6.965517241379309, 12.4384236453202, 13.06034482758621)
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
+SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result())
+SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result())
+SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result())
+SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_8.result())
+model.do()
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_2.addCircle(-10.81448298196523, 20.3003568426161, 15.58088381891068)
+SketchLine_9 = Sketch_2.addLine(-19.86849367207068, 32.98061042849822, 0.2083042015703297, 9.288449501673265)
+SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_9.startPoint(), SketchCircle_1.results()[1])
+SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchCircle_1.results()[1])
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1"), model.selection("COMPOUND", "Sketch_2")], model.selection(), 10, 0)
+Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_3_2")])
+Group_2_objects = [model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"), model.selection("FACE", "Extrusion_1_3_2/Generated_Face&Sketch_2/SketchCircle_1_2"), model.selection("FACE", "Extrusion_1_3_1/Generated_Face&Sketch_2/SketchCircle_1_2&weak_name_1"), model.selection("FACE", "Extrusion_1_2/To_Face")]
+Group_2 = model.addGroup(Part_1_doc, Group_2_objects)
+Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2"), model.selection("COMPSOLID", "Extrusion_1_3")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
+model.do()
+# move groups after the partitiion
+Part_1_doc.moveFeature(Group_1.feature(), Partition_1.feature())
+Part_1_doc.moveFeature(Group_2.feature(), Group_1.feature())
+model.end()
+
+# check groups are correct
+aFactory = ModelAPI_Session.get().validators()
+selectionList = Group_1.feature().selectionList("group_list")
+assert(selectionList.size() == 5)
+assert(aFactory.validate(Group_1.feature()))
+for i in range(5):
+  assert(Group_1.groupList().value(i).value().shapeType() == GeomAPI_Shape.SOLID)
+
+selectionList = Group_2.feature().selectionList("group_list")
+assert(selectionList.size() == 10)
+assert(aFactory.validate(Group_2.feature()))
+for i in range(10):
+  assert(Group_2.groupList().value(i).value().shapeType() == GeomAPI_Shape.FACE)
+
+assert(model.checkPythonDump())