From: azv Date: Mon, 18 Feb 2019 09:51:05 +0000 (+0300) Subject: Rename tests for moving groups X-Git-Tag: HighLevelObjectsHierarchy~13^2~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=96be6afd638f70819147729792a2e8b57f4510e7;p=modules%2Fshaper.git Rename tests for moving groups --- diff --git a/src/CollectionPlugin/CMakeLists.txt b/src/CollectionPlugin/CMakeLists.txt index ef4a7312c..d81832e39 100644 --- a/src/CollectionPlugin/CMakeLists.txt +++ b/src/CollectionPlugin/CMakeLists.txt @@ -108,15 +108,15 @@ ADD_UNIT_TESTS( TestGroup2.py TestField.py TestGroup1799.py - TestGroupMove.py - TestGroupMove2.py - TestGroupMove3.py - TestGroupMove4.py - TestGroupMove5.py - TestGroupMove6.py - TestGroupMove7.py - TestGroupMove8.py - TestGroupMove9.py + TestGroupMove01.py + TestGroupMove02.py + TestGroupMove03.py + TestGroupMove04.py + TestGroupMove05.py + TestGroupMove06.py + TestGroupMove07.py + TestGroupMove08.py + TestGroupMove09.py TestGroupMove10.py TestGroupMove11.py TestGroupMove12.py diff --git a/src/CollectionPlugin/Test/TestGroupMove.py b/src/CollectionPlugin/Test/TestGroupMove.py deleted file mode 100644 index 604989e39..000000000 --- a/src/CollectionPlugin/Test/TestGroupMove.py +++ /dev/null @@ -1,50 +0,0 @@ -## 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 -## - -# Test that box partitioned is splitted: group with edge becomes 2 edges group, -# group with not-touched vertex keeps this vertex. - -from salome.shaper import model -from ModelAPI import * - -model.begin() -partSet = model.moduleDocument() -Part_1 = model.addPart(partSet) -Part_1_doc = Part_1.document() -Box_1 = model.addBox(Part_1_doc, 20, 10, 10) -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Back"), 10, True) -Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]")]) -Group_2 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]")]) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")]) -model.do() -# move groups -Part_1_doc.moveFeature(Group_1.feature(), Partition_1.feature()) -Part_1_doc.moveFeature(Group_2.feature(), Group_1.feature()) -model.end() - -# Check groups -aFactory = ModelAPI_Session.get().validators() -selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 2) -assert(aFactory.validate(Group_1.feature())) - -selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 1) -assert(aFactory.validate(Group_2.feature())) diff --git a/src/CollectionPlugin/Test/TestGroupMove01.py b/src/CollectionPlugin/Test/TestGroupMove01.py new file mode 100644 index 000000000..604989e39 --- /dev/null +++ b/src/CollectionPlugin/Test/TestGroupMove01.py @@ -0,0 +1,50 @@ +## 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 +## + +# Test that box partitioned is splitted: group with edge becomes 2 edges group, +# group with not-touched vertex keeps this vertex. + +from salome.shaper import model +from ModelAPI import * + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Box_1 = model.addBox(Part_1_doc, 20, 10, 10) +Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Back"), 10, True) +Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]")]) +Group_2 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]")]) +Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")]) +model.do() +# move groups +Part_1_doc.moveFeature(Group_1.feature(), Partition_1.feature()) +Part_1_doc.moveFeature(Group_2.feature(), Group_1.feature()) +model.end() + +# Check groups +aFactory = ModelAPI_Session.get().validators() +selectionList = Group_1.feature().selectionList("group_list") +assert(selectionList.size() == 2) +assert(aFactory.validate(Group_1.feature())) + +selectionList = Group_2.feature().selectionList("group_list") +assert(selectionList.size() == 1) +assert(aFactory.validate(Group_2.feature())) diff --git a/src/CollectionPlugin/Test/TestGroupMove02.py b/src/CollectionPlugin/Test/TestGroupMove02.py new file mode 100644 index 000000000..46f1be056 --- /dev/null +++ b/src/CollectionPlugin/Test/TestGroupMove02.py @@ -0,0 +1,45 @@ +## 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 +## + +# Test that removed vertex, selected in the group makes empty group => invalid one + +from salome.shaper import model +from ModelAPI import * + +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, 20) +Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]"), model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]")) +Group_1 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]")]) +Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")]) +Remove_SubShapes_1 = model.addRemoveSubShapes(Part_1_doc, model.selection("COMPSOLID", "Partition_1_1")) +Remove_SubShapes_1.setSubShapesToKeep([model.selection("SOLID", "Partition_1_1_2")]) +model.do() +# move group +Part_1_doc.moveFeature(Group_1.feature(), Remove_SubShapes_1.feature()) +model.end() + +# Check group +aFactory = ModelAPI_Session.get().validators() +selectionList = Group_1.feature().selectionList("group_list") +assert(selectionList.size() == 0) +assert(aFactory.validate(Group_1.feature()) == False) diff --git a/src/CollectionPlugin/Test/TestGroupMove03.py b/src/CollectionPlugin/Test/TestGroupMove03.py new file mode 100644 index 000000000..f3c2bda62 --- /dev/null +++ b/src/CollectionPlugin/Test/TestGroupMove03.py @@ -0,0 +1,87 @@ +## 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 +## + +# Test that partition divides cylinder into 4 faces, there is no edges in a group moved to the end +# Based on the CEA report mail 04.12.2018, page 2 + +from SketchAPI import * + +from ModelAPI import * +from GeomAPI import * +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("XOZ")) +SketchArc_1 = Sketch_1.addArc(-1.103476974288834e-12, 24.99999999999979, 24.49489742783218, 30, 0, 50, False) +SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) +SketchLine_1 = SketchProjection_1.createdFeature() +SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.result()) +SketchLine_2 = Sketch_1.addLine(0, 50, -10, 50) +SketchLine_2.setAuxiliary(True) +SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_2.startPoint()) +SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result()) +SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_2.result()) +SketchLine_3 = Sketch_1.addLine(24.49489742783218, 30, 24.49489742783218, 5) +SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_3.startPoint()) +SketchLine_4 = Sketch_1.addLine(24.49489742783218, 5, 34.49489742783218, 5) +SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) +SketchLine_5 = Sketch_1.addLine(34.49489742783218, 5, 34.49489742783218, 0) +SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) +SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) +SketchLine_6 = SketchProjection_2.createdFeature() +SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.result()) +SketchLine_7 = Sketch_1.addLine(34.49489742783218, 0, 0, 0) +SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_7.startPoint()) +SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint()) +SketchLine_8 = Sketch_1.addLine(0, 50, 0, 0) +SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_8.startPoint()) +SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.endPoint()) +SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_4.result()) +SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result()) +SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result()) +SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_4.result(), 10) +SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_5.result(), 5) +SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_3.result(), 25) +SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_8.result(), 50) +SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_2.result(), 10) +SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 25) +model.do() +Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2r-SketchLine_8f-SketchLine_7r-SketchLine_5r-SketchLine_4r-SketchLine_3r")], model.selection("EDGE", "PartSet/OZ"), 360, 0) +Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3")]) +Partition_1_objects = [model.selection("SOLID", "Revolution_1_1"), model.selection("FACE", "PartSet/XOZ"), model.selection("FACE", "PartSet/YOZ")] +Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects) +model.do() + +# move group +Part_1_doc.moveFeature(Group_1.feature(), Partition_1.feature()) +model.end() + +# Check group: result must be four faces +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.FACE) + +assert(model.checkPythonDump()) diff --git a/src/CollectionPlugin/Test/TestGroupMove04.py b/src/CollectionPlugin/Test/TestGroupMove04.py new file mode 100644 index 000000000..4755468a8 --- /dev/null +++ b/src/CollectionPlugin/Test/TestGroupMove04.py @@ -0,0 +1,64 @@ +## 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 +## + +# Test of deep nested results history. Cylinders divided to two by cut, then each divided to +# two by partition by plane, then resulting compsolids are collected in compound. +# Checking that group on initial extrusion moved to the end contains the corresponding +# results, but divided. + +from salome.shaper import model +from ModelAPI 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(-4.602216748768477, 10.94581280788177, 9.660420057801511) +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0) +Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2")]) +Group_2 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")]) +Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 1, True) +Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) +SketchCircle_2 = Sketch_2.addCircle(-5.643073116097736, 11.91382008305256, 15.03576198961618) +model.do() +Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2r")], model.selection(), 2, -4) +Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_2_1")]) +Partition_1 = model.addPartition(Part_1_doc, [model.selection("COMPOUND", "Cut_1_1"), model.selection("FACE", "Plane_1")]) +Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1"), model.selection("COMPSOLID", "Partition_1_2")]) +model.do() +# move groups to the end +Part_1_doc.moveFeature(Group_1.feature(), Compound_1.feature()) +Part_1_doc.moveFeature(Group_2.feature(), Group_1.feature()) +model.end() + +aFactory = ModelAPI_Session.get().validators() +# check group 1: cylindical face is divided to 6 (because of seam edge) +selectionList = Group_1.feature().selectionList("group_list") +assert(selectionList.size() == 6) +assert(aFactory.validate(Group_1.feature())) + +# check group 2: solid is divided to 4 solids +selectionList = Group_2.feature().selectionList("group_list") +assert(selectionList.size() == 4) +assert(aFactory.validate(Group_2.feature())) + +assert(model.checkPythonDump()) diff --git a/src/CollectionPlugin/Test/TestGroupMove05.py b/src/CollectionPlugin/Test/TestGroupMove05.py new file mode 100644 index 000000000..400fdaba6 --- /dev/null +++ b/src/CollectionPlugin/Test/TestGroupMove05.py @@ -0,0 +1,103 @@ +## 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 +## + +# Test of deep nested results history. +# Faces and edges of a box has been collected to groups. After that, the box has been copied. +# Check that groups moved to the end contain corresponding results. + +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) +Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Box_1_1")]) +Group_2_objects = [model.selection("FACE", "Box_1_1/Back"), model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Right"), model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Bottom"), model.selection("FACE", "Box_1_1/Front")] +Group_2 = model.addGroup(Part_1_doc, Group_2_objects) +Group_3_objects = [model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]")] +Group_3 = model.addGroup(Part_1_doc, Group_3_objects) +LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 15, 2) +model.do() +# move groups to the end +Part_1_doc.moveFeature(Group_1.feature(), LinearCopy_1.feature()) +Part_1_doc.moveFeature(Group_2.feature(), Group_1.feature()) +Part_1_doc.moveFeature(Group_3.feature(), Group_2.feature()) +model.end() + +from ModelAPI import * + +aFactory = ModelAPI_Session.get().validators() +# check group 1: all solids in compound should be selected +selectionList = Group_1.feature().selectionList("group_list") +assert(selectionList.size() == 2) +assert(aFactory.validate(Group_1.feature())) +# check group 2: number of faces is multiplied twice than original +selectionList = Group_2.feature().selectionList("group_list") +assert(selectionList.size() == 12) +assert(aFactory.validate(Group_2.feature())) +# check group 3: number of edges is multiplied twice than original +selectionList = Group_3.feature().selectionList("group_list") +assert(selectionList.size() == 24) +assert(aFactory.validate(Group_3.feature())) + +model.begin() +LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 15, 2, model.selection("EDGE", "PartSet/OZ"), 15, 2) +# move groups to the end +Part_1_doc.moveFeature(Group_1.feature(), LinearCopy_2.feature()) +Part_1_doc.moveFeature(Group_2.feature(), Group_1.feature()) +Part_1_doc.moveFeature(Group_3.feature(), Group_2.feature()) +model.end() + +# check group 1: all solids in compound should be selected +selectionList = Group_1.feature().selectionList("group_list") +assert(selectionList.size() == 8) +assert(aFactory.validate(Group_1.feature())) +# check group 2: number of faces is multiplied twice than original +selectionList = Group_2.feature().selectionList("group_list") +assert(selectionList.size() == 48) +assert(aFactory.validate(Group_2.feature())) +# check group 3: number of edges is multiplied twice than original +selectionList = Group_3.feature().selectionList("group_list") +assert(selectionList.size() == 96) +assert(aFactory.validate(Group_3.feature())) + +model.begin() +AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "LinearCopy_2_1_1_1"), model.selection("SOLID", "LinearCopy_2_1_1_2")], model.selection("EDGE", "PartSet/OZ"), 2) +# move groups to the end +Part_1_doc.moveFeature(Group_1.feature(), AngularCopy_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 group 1: all solids in compound should be selected +selectionList = Group_1.feature().selectionList("group_list") +assert(selectionList.size() == 4) +assert(aFactory.validate(Group_1.feature())) +# check group 2: number of faces is multiplied twice than original +selectionList = Group_2.feature().selectionList("group_list") +assert(selectionList.size() == 24) +assert(aFactory.validate(Group_2.feature())) +# check group 3: number of edges is multiplied twice than original +selectionList = Group_3.feature().selectionList("group_list") +assert(selectionList.size() == 48) +assert(aFactory.validate(Group_3.feature())) + +assert(model.checkPythonDump()) diff --git a/src/CollectionPlugin/Test/TestGroupMove06.py b/src/CollectionPlugin/Test/TestGroupMove06.py new file mode 100644 index 000000000..5229e0c27 --- /dev/null +++ b/src/CollectionPlugin/Test/TestGroupMove06.py @@ -0,0 +1,128 @@ +## 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 +## + +# Test of deep nested results history. +# Copied boxes are involved to Fill operation. +# Check the groups of initial boxes moved to the end contain the corresponding +# results, but divided. + +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) +Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]")) +LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "Axis_1"), 10, 2) +Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "LinearCopy_1_1_1")]) +Group_2_objects = [model.selection("FACE", "LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Back"), model.selection("FACE", "LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Top"), model.selection("FACE", "LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Right"), model.selection("FACE", "LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Left"), model.selection("FACE", "LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Bottom"), model.selection("FACE", "LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Front")] +Group_2 = model.addGroup(Part_1_doc, Group_2_objects) +Group_3_objects = [model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Right]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Left]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Top]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Top]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Top]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Left]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Right]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Top]")] +Group_3 = model.addGroup(Part_1_doc, Group_3_objects) +Group_4 = model.addGroup(Part_1_doc, [model.selection("SOLID", "LinearCopy_1_1_2")]) +Group_5_objects = [model.selection("FACE", "LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Back"), model.selection("FACE", "LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Top"), model.selection("FACE", "LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Right"), model.selection("FACE", "LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Left"), model.selection("FACE", "LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Bottom"), model.selection("FACE", "LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Front")] +Group_5 = model.addGroup(Part_1_doc, Group_5_objects) +Group_6_objects = [model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Right]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Left]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Top]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Right][LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Left][LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Top]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Left][LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Right][LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Top]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Left]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Right]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Top]")] +Group_6 = model.addGroup(Part_1_doc, Group_6_objects) +Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Left"), model.selection("FACE", "LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Right")) +Fill_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "LinearCopy_1_1_1")], [model.selection("SOLID", "LinearCopy_1_1_2"), model.selection("FACE", "Plane_1")]) +model.do() +# move groups to the end +Part_1_doc.moveFeature(Group_1.feature(), Fill_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()) +Part_1_doc.moveFeature(Group_5.feature(), Group_4.feature()) +Part_1_doc.moveFeature(Group_6.feature(), Group_5.feature()) +model.end() + +from ModelAPI import * + +aFactory = ModelAPI_Session.get().validators() + +# groups related to original box should be split +selectionList = Group_1.feature().selectionList("group_list") +assert(selectionList.size() == 3) +assert(aFactory.validate(Group_1.feature())) + +selectionList = Group_2.feature().selectionList("group_list") +assert(selectionList.size() == 13) +assert(aFactory.validate(Group_2.feature())) + +selectionList = Group_3.feature().selectionList("group_list") +assert(selectionList.size() == 19) +assert(aFactory.validate(Group_3.feature())) + +# groups related to the copied box should contain only the elements connected with the original box +selectionList = Group_4.feature().selectionList("group_list") +assert(selectionList.size() == 1) +assert(aFactory.validate(Group_4.feature())) + +selectionList = Group_5.feature().selectionList("group_list") +assert(selectionList.size() == 3) +assert(aFactory.validate(Group_5.feature())) + +selectionList = Group_6.feature().selectionList("group_list") +assert(selectionList.size() == 3) +assert(aFactory.validate(Group_6.feature())) + + +model.begin() +Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Fill_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top"), model.selection("EDGE", "[Fill_1_1_2/Modified_Face&Box_1_1/Right][(Fill_1_1_2/Modified_Face&Box_1_1/Right)(Fill_1_1_2/Modified_Face&Plane_1/Plane_1)(Fill_1_1_2/Modified_Face&Box_1_1/Front)(Fill_1_1_2/Modified_Face&Box_1_1/Top)2(Fill_1_1_2/Modified_Face&Box_1_1/Left)2]")]) +Fill_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Fill_1_1_2")], [model.selection("FACE", "Filling_1_1")]) +model.do() +# move groups to the end once again +Part_1_doc.moveFeature(Group_1.feature(), Fill_2.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()) +Part_1_doc.moveFeature(Group_5.feature(), Group_4.feature()) +Part_1_doc.moveFeature(Group_6.feature(), Group_5.feature()) +model.end() + +# groups related to original box should be split +selectionList = Group_1.feature().selectionList("group_list") +assert(selectionList.size() == 4) +assert(aFactory.validate(Group_1.feature())) + +selectionList = Group_2.feature().selectionList("group_list") +assert(selectionList.size() == 16) +assert(aFactory.validate(Group_2.feature())) + +selectionList = Group_3.feature().selectionList("group_list") +# one of edges should disappear, due to its belonging to the face of the filling +assert(selectionList.size() == 18) +assert(aFactory.validate(Group_3.feature())) + +# groups related to the copied box should be split correspondingly +selectionList = Group_4.feature().selectionList("group_list") +assert(selectionList.size() == 1) +assert(aFactory.validate(Group_4.feature())) + +selectionList = Group_5.feature().selectionList("group_list") +assert(selectionList.size() == 6) +assert(aFactory.validate(Group_5.feature())) + +selectionList = Group_6.feature().selectionList("group_list") +assert(selectionList.size() == 5) +assert(aFactory.validate(Group_6.feature())) + +assert(model.checkPythonDump()) diff --git a/src/CollectionPlugin/Test/TestGroupMove07.py b/src/CollectionPlugin/Test/TestGroupMove07.py new file mode 100644 index 000000000..04c84e272 --- /dev/null +++ b/src/CollectionPlugin/Test/TestGroupMove07.py @@ -0,0 +1,83 @@ +## 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 +## + +# Test of deep nested results history. +# Faces and edges of a box has been collected to groups. After that, the box has been symmetried. +# Check that groups moved to the end contain corresponding results. + +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) +Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Box_1_1")]) +Group_2_objects = [model.selection("FACE", "Box_1_1/Back"), model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Right"), model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Bottom"), model.selection("FACE", "Box_1_1/Front")] +Group_2 = model.addGroup(Part_1_doc, Group_2_objects) +Group_3_objects = [model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]")] +Group_3 = model.addGroup(Part_1_doc, Group_3_objects) +Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("FACE", "Box_1_1/Left"), False) +model.do() +# move groups to the end +Part_1_doc.moveFeature(Group_1.feature(), Symmetry_1.feature()) +Part_1_doc.moveFeature(Group_2.feature(), Group_1.feature()) +Part_1_doc.moveFeature(Group_3.feature(), Group_2.feature()) +model.end() + +from ModelAPI import * + +aFactory = ModelAPI_Session.get().validators() +# check group 1: solids should be selected +selectionList = Group_1.feature().selectionList("group_list") +assert(selectionList.size() == 1) +assert(aFactory.validate(Group_1.feature())) +# check group 2: number of faces is the same +selectionList = Group_2.feature().selectionList("group_list") +assert(selectionList.size() == 6) +assert(aFactory.validate(Group_2.feature())) +# check group 3: number of edges is the same +selectionList = Group_3.feature().selectionList("group_list") +assert(selectionList.size() == 12) +assert(aFactory.validate(Group_3.feature())) + +model.begin() +Symmetry_2 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Symmetry_1_1")], model.selection("VERTEX", "[Symmetry_1_1/MF:Symmetried_Face&Box_1_1/Front][Symmetry_1_1/MF:Symmetried_Face&Box_1_1/Left][Symmetry_1_1/MF:Symmetried_Face&Box_1_1/Bottom]"), True) +model.do() +# move groups to the end +Part_1_doc.moveFeature(Group_1.feature(), Symmetry_2.feature()) +Part_1_doc.moveFeature(Group_2.feature(), Group_1.feature()) +Part_1_doc.moveFeature(Group_3.feature(), Group_2.feature()) +model.end() + +# check group 1: all solids in compound should be selected +selectionList = Group_1.feature().selectionList("group_list") +assert(selectionList.size() == 2) +assert(aFactory.validate(Group_1.feature())) +# check group 2: number of faces is multiplied twice than original +selectionList = Group_2.feature().selectionList("group_list") +assert(selectionList.size() == 12) +assert(aFactory.validate(Group_2.feature())) +# check group 3: number of edges is multiplied twice than original +selectionList = Group_3.feature().selectionList("group_list") +assert(selectionList.size() == 24) +assert(aFactory.validate(Group_3.feature())) + +assert(model.checkPythonDump()) diff --git a/src/CollectionPlugin/Test/TestGroupMove08.py b/src/CollectionPlugin/Test/TestGroupMove08.py new file mode 100644 index 000000000..91fbcc384 --- /dev/null +++ b/src/CollectionPlugin/Test/TestGroupMove08.py @@ -0,0 +1,128 @@ +## 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 +## + +# Test of deep nested results history. Fillet operation. +# Check the groups of initial solids moved to the end contain the corresponding +# results, but divided. + +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) +Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Box_1_1")]) +Group_2_objects = [model.selection("FACE", "Box_1_1/Back"), model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Right"), model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Bottom"), model.selection("FACE", "Box_1_1/Front")] +Group_2 = model.addGroup(Part_1_doc, Group_2_objects) +Group_3_objects = [model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]")] +Group_3 = model.addGroup(Part_1_doc, Group_3_objects) +Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]"), model.selection("EDGE", "PartSet/OZ"), 5, 10) +Group_4 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")]) +Group_5_objects = [model.selection("FACE", "Cylinder_1_1/Face_1"), model.selection("FACE", "Cylinder_1_1/Face_2"), model.selection("FACE", "Cylinder_1_1/Face_3")] +Group_5 = model.addGroup(Part_1_doc, Group_5_objects) +Group_6_objects = [model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]"), model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_3]"), model.selection("EDGE", "([Cylinder_1_1/Face_1][Cylinder_1_1/Face_2])([Cylinder_1_1/Face_1][Cylinder_1_1/Face_3])")] +Group_6 = model.addGroup(Part_1_doc, Group_6_objects) +Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]")], 2) +model.do() +# move groups to the end +Part_1_doc.moveFeature(Group_1.feature(), Fillet_1.feature()) +Part_1_doc.moveFeature(Group_2.feature(), Group_1.feature()) +Part_1_doc.moveFeature(Group_3.feature(), Group_2.feature()) +model.end() + +from ModelAPI import * + +aFactory = ModelAPI_Session.get().validators() + +# groups related to original box should be split +selectionList = Group_1.feature().selectionList("group_list") +assert(selectionList.size() == 1) +assert(aFactory.validate(Group_1.feature())) + +selectionList = Group_2.feature().selectionList("group_list") +assert(selectionList.size() == 6) +assert(aFactory.validate(Group_2.feature())) + +selectionList = Group_3.feature().selectionList("group_list") +assert(selectionList.size() == 11) +assert(aFactory.validate(Group_3.feature())) + +model.begin() +Fillet_2 = model.addFillet(Part_1_doc, [model.selection("FACE", "Cylinder_1_1/Face_2")], 2) +model.do() +# move groups to the end +Part_1_doc.moveFeature(Group_4.feature(), Fillet_2.feature()) +Part_1_doc.moveFeature(Group_5.feature(), Group_4.feature()) +Part_1_doc.moveFeature(Group_6.feature(), Group_5.feature()) +model.end() + +# groups related to original cylinder should be split +selectionList = Group_4.feature().selectionList("group_list") +assert(selectionList.size() == 1) +assert(aFactory.validate(Group_4.feature())) + +selectionList = Group_5.feature().selectionList("group_list") +assert(selectionList.size() == 3) +assert(aFactory.validate(Group_5.feature())) + +selectionList = Group_6.feature().selectionList("group_list") +assert(selectionList.size() == 2) # edge selected for the fillet become removed +assert(aFactory.validate(Group_6.feature())) + +model.begin() +Fillet_3 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Fillet_1_1/MF:Fillet_Face&Box_1_1/Front][Fillet_1_1/MF:Fillet_Face&Box_1_1/Left]")], 1, 2) +model.do() +# move groups to the end +Part_1_doc.moveFeature(Group_1.feature(), Fillet_3.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()) +Part_1_doc.moveFeature(Group_5.feature(), Group_4.feature()) +Part_1_doc.moveFeature(Group_6.feature(), Group_5.feature()) +model.end() + +# groups related to original box should be split +selectionList = Group_1.feature().selectionList("group_list") +assert(selectionList.size() == 1) +assert(aFactory.validate(Group_1.feature())) + +selectionList = Group_2.feature().selectionList("group_list") +assert(selectionList.size() == 6) +assert(aFactory.validate(Group_2.feature())) + +selectionList = Group_3.feature().selectionList("group_list") +assert(selectionList.size() == 9) +assert(aFactory.validate(Group_3.feature())) + +# groups related to original cylinder should stay untouched +selectionList = Group_4.feature().selectionList("group_list") +assert(selectionList.size() == 1) +assert(aFactory.validate(Group_4.feature())) + +selectionList = Group_5.feature().selectionList("group_list") +assert(selectionList.size() == 3) +assert(aFactory.validate(Group_5.feature())) + +selectionList = Group_6.feature().selectionList("group_list") +assert(selectionList.size() == 2) +assert(aFactory.validate(Group_6.feature())) + +assert(model.checkPythonDump()) diff --git a/src/CollectionPlugin/Test/TestGroupMove09.py b/src/CollectionPlugin/Test/TestGroupMove09.py new file mode 100644 index 000000000..f8b338348 --- /dev/null +++ b/src/CollectionPlugin/Test/TestGroupMove09.py @@ -0,0 +1,75 @@ +## 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 +## + +# Test of deep nested results history. FuseFaces operation. +# Check the groups of initial solids moved to the end contain the corresponding +# results, but merged faces. + +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) +Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) +Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1"), model.selection("SOLID", "Box_1_1")]) +Union_1_objects = [model.selection("SOLID", "Partition_1_1_1"), model.selection("SOLID", "Partition_1_1_2"), model.selection("SOLID", "Partition_1_1_3")] +Union_1 = model.addUnion(Part_1_doc, Union_1_objects) +Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Union_1_1")]) +Group_2_objects = [model.selection("FACE", "Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1"), model.selection("FACE", "Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_2"), model.selection("FACE", "Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_3"), model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Bottom&Cylinder_1_1/Face_3"), model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Top&Cylinder_1_1/Face_2"), model.selection("FACE", "Partition_1_1_3/Modified_Face&Box_1_1/Back"), model.selection("FACE", "Partition_1_1_3/Modified_Face&Box_1_1/Bottom"), model.selection("FACE", "Partition_1_1_3/Modified_Face&Box_1_1/Top"), model.selection("FACE", "Box_1_1/Right"), model.selection("FACE", "Partition_1_1_3/Modified_Face&Box_1_1/Left"), model.selection("FACE", "Box_1_1/Front")] +Group_2 = model.addGroup(Part_1_doc, Group_2_objects) +Group_3_objects = [model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_3]"), model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_2][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1]"), model.selection("EDGE", "([Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_3])(Partition_1_1_3/Generated_Edge&Box_1_1/Back&Cylinder_1_1/Face_1)([Partition_1_1_3/Modified_Face&Box_1_1/Back][Partition_1_1_3/Modified_Face&Box_1_1/Bottom])([Partition_1_1_3/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Bottom&Cylinder_1_1/Face_3])_Union_1_1"), model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Back][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Back][Box_1_1/Right]"), model.selection("EDGE", "Partition_1_1_3/Generated_Edge&Box_1_1/Back&Cylinder_1_1/Face_1"), model.selection("EDGE", "([Partition_1_1_2/Modified_Face&Box_1_1/Top&Cylinder_1_1/Face_2][Partition_1_1_3/Modified_Face&Box_1_1/Top])([Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_2][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1])([Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Back])(Partition_1_1_3/Generated_Edge&Box_1_1/Back&Cylinder_1_1/Face_1)_Union_1_1"), model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Back]"), model.selection("EDGE", "([Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_3/Modified_Face&Box_1_1/Left])([Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_3])([Partition_1_1_3/Modified_Face&Box_1_1/Left][Partition_1_1_3/Modified_Face&Box_1_1/Bottom])([Partition_1_1_3/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Bottom&Cylinder_1_1/Face_3])_Union_1_1"), model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Bottom&Cylinder_1_1/Face_3]"), model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Top&Cylinder_1_1/Face_2][Partition_1_1_3/Modified_Face&Box_1_1/Top]"), model.selection("EDGE", "([Partition_1_1_2/Modified_Face&Box_1_1/Top&Cylinder_1_1/Face_2][Partition_1_1_3/Modified_Face&Box_1_1/Top])([Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_2][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1])([Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Left])([Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_3/Modified_Face&Box_1_1/Left])_Union_1_1"), model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_3/Modified_Face&Box_1_1/Left]"), model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Right][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Left][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left]"), model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Front]"), model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Box_1_1/Front]")] +Group_3 = model.addGroup(Part_1_doc, Group_3_objects) +Group_4_objects = [model.selection("VERTEX", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left]"), model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Top&Cylinder_1_1/Face_2][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_2][Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_3/Modified_Face&Box_1_1/Left]"), model.selection("VERTEX", "[Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]"), model.selection("VERTEX", "[_weak_name_10_Union_1_1]e[_weak_name_4_Union_1_1]e"), model.selection("VERTEX", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Box_1_1/Right][Box_1_1/Front]"), model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_3/Modified_Face&Box_1_1/Left][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_3][Partition_1_1_3/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Bottom&Cylinder_1_1/Face_3]"), model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Top&Cylinder_1_1/Face_2][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_2][Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_3/Modified_Face&Box_1_1/Back]"), model.selection("VERTEX", "[Box_1_1/Right][Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]"), model.selection("VERTEX", "[_weak_name_3_Union_1_1]e[_weak_name_9_Union_1_1]e"), model.selection("VERTEX", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Back][Box_1_1/Right]"), model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_3/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_3][Partition_1_1_3/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Bottom&Cylinder_1_1/Face_3]"), model.selection("VERTEX", "[Partition_1_1_3/Modified_Face&Box_1_1/Back][Box_1_1/Right][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]")] +Group_4 = model.addGroup(Part_1_doc, Group_4_objects) +FusionFaces_1 = model.addFusionFaces(Part_1_doc, model.selection("SOLID", "Union_1_1")) +model.do() +# move groups to the end +Part_1_doc.moveFeature(Group_1.feature(), FusionFaces_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() + +from ModelAPI import * + +aFactory = ModelAPI_Session.get().validators() + +# number of solids should be the same +selectionList = Group_1.feature().selectionList("group_list") +assert(selectionList.size() == 1) +assert(aFactory.validate(Group_1.feature())) + +# same-plane faces should be merged +selectionList = Group_2.feature().selectionList("group_list") +assert(selectionList.size() == 11) +assert(aFactory.validate(Group_2.feature())) + +# shared edges of merged faces should be deleted +selectionList = Group_3.feature().selectionList("group_list") +assert(selectionList.size() == 15) +assert(aFactory.validate(Group_3.feature())) + +selectionList = Group_4.feature().selectionList("group_list") +assert(selectionList.size() == 10) +assert(aFactory.validate(Group_4.feature())) + +assert(model.checkPythonDump()) diff --git a/src/CollectionPlugin/Test/TestGroupMove2.py b/src/CollectionPlugin/Test/TestGroupMove2.py deleted file mode 100644 index 46f1be056..000000000 --- a/src/CollectionPlugin/Test/TestGroupMove2.py +++ /dev/null @@ -1,45 +0,0 @@ -## 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 -## - -# Test that removed vertex, selected in the group makes empty group => invalid one - -from salome.shaper import model -from ModelAPI import * - -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, 20) -Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]"), model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]")) -Group_1 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]")]) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")]) -Remove_SubShapes_1 = model.addRemoveSubShapes(Part_1_doc, model.selection("COMPSOLID", "Partition_1_1")) -Remove_SubShapes_1.setSubShapesToKeep([model.selection("SOLID", "Partition_1_1_2")]) -model.do() -# move group -Part_1_doc.moveFeature(Group_1.feature(), Remove_SubShapes_1.feature()) -model.end() - -# Check group -aFactory = ModelAPI_Session.get().validators() -selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 0) -assert(aFactory.validate(Group_1.feature()) == False) diff --git a/src/CollectionPlugin/Test/TestGroupMove3.py b/src/CollectionPlugin/Test/TestGroupMove3.py deleted file mode 100644 index f3c2bda62..000000000 --- a/src/CollectionPlugin/Test/TestGroupMove3.py +++ /dev/null @@ -1,87 +0,0 @@ -## 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 -## - -# Test that partition divides cylinder into 4 faces, there is no edges in a group moved to the end -# Based on the CEA report mail 04.12.2018, page 2 - -from SketchAPI import * - -from ModelAPI import * -from GeomAPI import * -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("XOZ")) -SketchArc_1 = Sketch_1.addArc(-1.103476974288834e-12, 24.99999999999979, 24.49489742783218, 30, 0, 50, False) -SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False) -SketchLine_1 = SketchProjection_1.createdFeature() -SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.result()) -SketchLine_2 = Sketch_1.addLine(0, 50, -10, 50) -SketchLine_2.setAuxiliary(True) -SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_2.startPoint()) -SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result()) -SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_2.result()) -SketchLine_3 = Sketch_1.addLine(24.49489742783218, 30, 24.49489742783218, 5) -SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_3.startPoint()) -SketchLine_4 = Sketch_1.addLine(24.49489742783218, 5, 34.49489742783218, 5) -SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint()) -SketchLine_5 = Sketch_1.addLine(34.49489742783218, 5, 34.49489742783218, 0) -SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint()) -SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False) -SketchLine_6 = SketchProjection_2.createdFeature() -SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.result()) -SketchLine_7 = Sketch_1.addLine(34.49489742783218, 0, 0, 0) -SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_7.startPoint()) -SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_7.endPoint()) -SketchLine_8 = Sketch_1.addLine(0, 50, 0, 0) -SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_8.startPoint()) -SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_8.endPoint()) -SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_4.result()) -SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result()) -SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result()) -SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_4.result(), 10) -SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_5.result(), 5) -SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_3.result(), 25) -SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_8.result(), 50) -SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_2.result(), 10) -SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 25) -model.do() -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2r-SketchLine_8f-SketchLine_7r-SketchLine_5r-SketchLine_4r-SketchLine_3r")], model.selection("EDGE", "PartSet/OZ"), 360, 0) -Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3")]) -Partition_1_objects = [model.selection("SOLID", "Revolution_1_1"), model.selection("FACE", "PartSet/XOZ"), model.selection("FACE", "PartSet/YOZ")] -Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects) -model.do() - -# move group -Part_1_doc.moveFeature(Group_1.feature(), Partition_1.feature()) -model.end() - -# Check group: result must be four faces -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.FACE) - -assert(model.checkPythonDump()) diff --git a/src/CollectionPlugin/Test/TestGroupMove4.py b/src/CollectionPlugin/Test/TestGroupMove4.py deleted file mode 100644 index 4755468a8..000000000 --- a/src/CollectionPlugin/Test/TestGroupMove4.py +++ /dev/null @@ -1,64 +0,0 @@ -## 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 -## - -# Test of deep nested results history. Cylinders divided to two by cut, then each divided to -# two by partition by plane, then resulting compsolids are collected in compound. -# Checking that group on initial extrusion moved to the end contains the corresponding -# results, but divided. - -from salome.shaper import model -from ModelAPI 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(-4.602216748768477, 10.94581280788177, 9.660420057801511) -model.do() -Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0) -Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2")]) -Group_2 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")]) -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 1, True) -Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY")) -SketchCircle_2 = Sketch_2.addCircle(-5.643073116097736, 11.91382008305256, 15.03576198961618) -model.do() -Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2r")], model.selection(), 2, -4) -Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_2_1")]) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("COMPOUND", "Cut_1_1"), model.selection("FACE", "Plane_1")]) -Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1"), model.selection("COMPSOLID", "Partition_1_2")]) -model.do() -# move groups to the end -Part_1_doc.moveFeature(Group_1.feature(), Compound_1.feature()) -Part_1_doc.moveFeature(Group_2.feature(), Group_1.feature()) -model.end() - -aFactory = ModelAPI_Session.get().validators() -# check group 1: cylindical face is divided to 6 (because of seam edge) -selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 6) -assert(aFactory.validate(Group_1.feature())) - -# check group 2: solid is divided to 4 solids -selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 4) -assert(aFactory.validate(Group_2.feature())) - -assert(model.checkPythonDump()) diff --git a/src/CollectionPlugin/Test/TestGroupMove5.py b/src/CollectionPlugin/Test/TestGroupMove5.py deleted file mode 100644 index 400fdaba6..000000000 --- a/src/CollectionPlugin/Test/TestGroupMove5.py +++ /dev/null @@ -1,103 +0,0 @@ -## 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 -## - -# Test of deep nested results history. -# Faces and edges of a box has been collected to groups. After that, the box has been copied. -# Check that groups moved to the end contain corresponding results. - -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) -Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Box_1_1")]) -Group_2_objects = [model.selection("FACE", "Box_1_1/Back"), model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Right"), model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Bottom"), model.selection("FACE", "Box_1_1/Front")] -Group_2 = model.addGroup(Part_1_doc, Group_2_objects) -Group_3_objects = [model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]")] -Group_3 = model.addGroup(Part_1_doc, Group_3_objects) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 15, 2) -model.do() -# move groups to the end -Part_1_doc.moveFeature(Group_1.feature(), LinearCopy_1.feature()) -Part_1_doc.moveFeature(Group_2.feature(), Group_1.feature()) -Part_1_doc.moveFeature(Group_3.feature(), Group_2.feature()) -model.end() - -from ModelAPI import * - -aFactory = ModelAPI_Session.get().validators() -# check group 1: all solids in compound should be selected -selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 2) -assert(aFactory.validate(Group_1.feature())) -# check group 2: number of faces is multiplied twice than original -selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 12) -assert(aFactory.validate(Group_2.feature())) -# check group 3: number of edges is multiplied twice than original -selectionList = Group_3.feature().selectionList("group_list") -assert(selectionList.size() == 24) -assert(aFactory.validate(Group_3.feature())) - -model.begin() -LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OY"), 15, 2, model.selection("EDGE", "PartSet/OZ"), 15, 2) -# move groups to the end -Part_1_doc.moveFeature(Group_1.feature(), LinearCopy_2.feature()) -Part_1_doc.moveFeature(Group_2.feature(), Group_1.feature()) -Part_1_doc.moveFeature(Group_3.feature(), Group_2.feature()) -model.end() - -# check group 1: all solids in compound should be selected -selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 8) -assert(aFactory.validate(Group_1.feature())) -# check group 2: number of faces is multiplied twice than original -selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 48) -assert(aFactory.validate(Group_2.feature())) -# check group 3: number of edges is multiplied twice than original -selectionList = Group_3.feature().selectionList("group_list") -assert(selectionList.size() == 96) -assert(aFactory.validate(Group_3.feature())) - -model.begin() -AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "LinearCopy_2_1_1_1"), model.selection("SOLID", "LinearCopy_2_1_1_2")], model.selection("EDGE", "PartSet/OZ"), 2) -# move groups to the end -Part_1_doc.moveFeature(Group_1.feature(), AngularCopy_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 group 1: all solids in compound should be selected -selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 4) -assert(aFactory.validate(Group_1.feature())) -# check group 2: number of faces is multiplied twice than original -selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 24) -assert(aFactory.validate(Group_2.feature())) -# check group 3: number of edges is multiplied twice than original -selectionList = Group_3.feature().selectionList("group_list") -assert(selectionList.size() == 48) -assert(aFactory.validate(Group_3.feature())) - -assert(model.checkPythonDump()) diff --git a/src/CollectionPlugin/Test/TestGroupMove6.py b/src/CollectionPlugin/Test/TestGroupMove6.py deleted file mode 100644 index 5229e0c27..000000000 --- a/src/CollectionPlugin/Test/TestGroupMove6.py +++ /dev/null @@ -1,128 +0,0 @@ -## 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 -## - -# Test of deep nested results history. -# Copied boxes are involved to Fill operation. -# Check the groups of initial boxes moved to the end contain the corresponding -# results, but divided. - -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) -Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]")) -LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "Axis_1"), 10, 2) -Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "LinearCopy_1_1_1")]) -Group_2_objects = [model.selection("FACE", "LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Back"), model.selection("FACE", "LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Top"), model.selection("FACE", "LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Right"), model.selection("FACE", "LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Left"), model.selection("FACE", "LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Bottom"), model.selection("FACE", "LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Front")] -Group_2 = model.addGroup(Part_1_doc, Group_2_objects) -Group_3_objects = [model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Right]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Left]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Back][LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Top]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Top]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Left][LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Right][LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Top]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Left]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Right]"), model.selection("EDGE", "[LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Front][LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Top]")] -Group_3 = model.addGroup(Part_1_doc, Group_3_objects) -Group_4 = model.addGroup(Part_1_doc, [model.selection("SOLID", "LinearCopy_1_1_2")]) -Group_5_objects = [model.selection("FACE", "LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Back"), model.selection("FACE", "LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Top"), model.selection("FACE", "LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Right"), model.selection("FACE", "LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Left"), model.selection("FACE", "LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Bottom"), model.selection("FACE", "LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Front")] -Group_5 = model.addGroup(Part_1_doc, Group_5_objects) -Group_6_objects = [model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Right]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Left]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Back][LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Top]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Right][LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Left][LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Top]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Left][LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Right][LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Top]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Left]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Right]"), model.selection("EDGE", "[LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Front][LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Top]")] -Group_6 = model.addGroup(Part_1_doc, Group_6_objects) -Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Left"), model.selection("FACE", "LinearCopy_1_1_1/MF:Translated_Face&Box_1_1/Right")) -Fill_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "LinearCopy_1_1_1")], [model.selection("SOLID", "LinearCopy_1_1_2"), model.selection("FACE", "Plane_1")]) -model.do() -# move groups to the end -Part_1_doc.moveFeature(Group_1.feature(), Fill_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()) -Part_1_doc.moveFeature(Group_5.feature(), Group_4.feature()) -Part_1_doc.moveFeature(Group_6.feature(), Group_5.feature()) -model.end() - -from ModelAPI import * - -aFactory = ModelAPI_Session.get().validators() - -# groups related to original box should be split -selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 3) -assert(aFactory.validate(Group_1.feature())) - -selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 13) -assert(aFactory.validate(Group_2.feature())) - -selectionList = Group_3.feature().selectionList("group_list") -assert(selectionList.size() == 19) -assert(aFactory.validate(Group_3.feature())) - -# groups related to the copied box should contain only the elements connected with the original box -selectionList = Group_4.feature().selectionList("group_list") -assert(selectionList.size() == 1) -assert(aFactory.validate(Group_4.feature())) - -selectionList = Group_5.feature().selectionList("group_list") -assert(selectionList.size() == 3) -assert(aFactory.validate(Group_5.feature())) - -selectionList = Group_6.feature().selectionList("group_list") -assert(selectionList.size() == 3) -assert(aFactory.validate(Group_6.feature())) - - -model.begin() -Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Fill_1_1_2/Generated_Edge&Plane_1/Plane_1&Box_1_1/Top"), model.selection("EDGE", "[Fill_1_1_2/Modified_Face&Box_1_1/Right][(Fill_1_1_2/Modified_Face&Box_1_1/Right)(Fill_1_1_2/Modified_Face&Plane_1/Plane_1)(Fill_1_1_2/Modified_Face&Box_1_1/Front)(Fill_1_1_2/Modified_Face&Box_1_1/Top)2(Fill_1_1_2/Modified_Face&Box_1_1/Left)2]")]) -Fill_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Fill_1_1_2")], [model.selection("FACE", "Filling_1_1")]) -model.do() -# move groups to the end once again -Part_1_doc.moveFeature(Group_1.feature(), Fill_2.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()) -Part_1_doc.moveFeature(Group_5.feature(), Group_4.feature()) -Part_1_doc.moveFeature(Group_6.feature(), Group_5.feature()) -model.end() - -# groups related to original box should be split -selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 4) -assert(aFactory.validate(Group_1.feature())) - -selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 16) -assert(aFactory.validate(Group_2.feature())) - -selectionList = Group_3.feature().selectionList("group_list") -# one of edges should disappear, due to its belonging to the face of the filling -assert(selectionList.size() == 18) -assert(aFactory.validate(Group_3.feature())) - -# groups related to the copied box should be split correspondingly -selectionList = Group_4.feature().selectionList("group_list") -assert(selectionList.size() == 1) -assert(aFactory.validate(Group_4.feature())) - -selectionList = Group_5.feature().selectionList("group_list") -assert(selectionList.size() == 6) -assert(aFactory.validate(Group_5.feature())) - -selectionList = Group_6.feature().selectionList("group_list") -assert(selectionList.size() == 5) -assert(aFactory.validate(Group_6.feature())) - -assert(model.checkPythonDump()) diff --git a/src/CollectionPlugin/Test/TestGroupMove7.py b/src/CollectionPlugin/Test/TestGroupMove7.py deleted file mode 100644 index 04c84e272..000000000 --- a/src/CollectionPlugin/Test/TestGroupMove7.py +++ /dev/null @@ -1,83 +0,0 @@ -## 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 -## - -# Test of deep nested results history. -# Faces and edges of a box has been collected to groups. After that, the box has been symmetried. -# Check that groups moved to the end contain corresponding results. - -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) -Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Box_1_1")]) -Group_2_objects = [model.selection("FACE", "Box_1_1/Back"), model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Right"), model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Bottom"), model.selection("FACE", "Box_1_1/Front")] -Group_2 = model.addGroup(Part_1_doc, Group_2_objects) -Group_3_objects = [model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]")] -Group_3 = model.addGroup(Part_1_doc, Group_3_objects) -Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("FACE", "Box_1_1/Left"), False) -model.do() -# move groups to the end -Part_1_doc.moveFeature(Group_1.feature(), Symmetry_1.feature()) -Part_1_doc.moveFeature(Group_2.feature(), Group_1.feature()) -Part_1_doc.moveFeature(Group_3.feature(), Group_2.feature()) -model.end() - -from ModelAPI import * - -aFactory = ModelAPI_Session.get().validators() -# check group 1: solids should be selected -selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 1) -assert(aFactory.validate(Group_1.feature())) -# check group 2: number of faces is the same -selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 6) -assert(aFactory.validate(Group_2.feature())) -# check group 3: number of edges is the same -selectionList = Group_3.feature().selectionList("group_list") -assert(selectionList.size() == 12) -assert(aFactory.validate(Group_3.feature())) - -model.begin() -Symmetry_2 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Symmetry_1_1")], model.selection("VERTEX", "[Symmetry_1_1/MF:Symmetried_Face&Box_1_1/Front][Symmetry_1_1/MF:Symmetried_Face&Box_1_1/Left][Symmetry_1_1/MF:Symmetried_Face&Box_1_1/Bottom]"), True) -model.do() -# move groups to the end -Part_1_doc.moveFeature(Group_1.feature(), Symmetry_2.feature()) -Part_1_doc.moveFeature(Group_2.feature(), Group_1.feature()) -Part_1_doc.moveFeature(Group_3.feature(), Group_2.feature()) -model.end() - -# check group 1: all solids in compound should be selected -selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 2) -assert(aFactory.validate(Group_1.feature())) -# check group 2: number of faces is multiplied twice than original -selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 12) -assert(aFactory.validate(Group_2.feature())) -# check group 3: number of edges is multiplied twice than original -selectionList = Group_3.feature().selectionList("group_list") -assert(selectionList.size() == 24) -assert(aFactory.validate(Group_3.feature())) - -assert(model.checkPythonDump()) diff --git a/src/CollectionPlugin/Test/TestGroupMove8.py b/src/CollectionPlugin/Test/TestGroupMove8.py deleted file mode 100644 index 91fbcc384..000000000 --- a/src/CollectionPlugin/Test/TestGroupMove8.py +++ /dev/null @@ -1,128 +0,0 @@ -## 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 -## - -# Test of deep nested results history. Fillet operation. -# Check the groups of initial solids moved to the end contain the corresponding -# results, but divided. - -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) -Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Box_1_1")]) -Group_2_objects = [model.selection("FACE", "Box_1_1/Back"), model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Box_1_1/Right"), model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Box_1_1/Bottom"), model.selection("FACE", "Box_1_1/Front")] -Group_2 = model.addGroup(Part_1_doc, Group_2_objects) -Group_3_objects = [model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]")] -Group_3 = model.addGroup(Part_1_doc, Group_3_objects) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Group_4 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")]) -Group_5_objects = [model.selection("FACE", "Cylinder_1_1/Face_1"), model.selection("FACE", "Cylinder_1_1/Face_2"), model.selection("FACE", "Cylinder_1_1/Face_3")] -Group_5 = model.addGroup(Part_1_doc, Group_5_objects) -Group_6_objects = [model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]"), model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_3]"), model.selection("EDGE", "([Cylinder_1_1/Face_1][Cylinder_1_1/Face_2])([Cylinder_1_1/Face_1][Cylinder_1_1/Face_3])")] -Group_6 = model.addGroup(Part_1_doc, Group_6_objects) -Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]")], 2) -model.do() -# move groups to the end -Part_1_doc.moveFeature(Group_1.feature(), Fillet_1.feature()) -Part_1_doc.moveFeature(Group_2.feature(), Group_1.feature()) -Part_1_doc.moveFeature(Group_3.feature(), Group_2.feature()) -model.end() - -from ModelAPI import * - -aFactory = ModelAPI_Session.get().validators() - -# groups related to original box should be split -selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 1) -assert(aFactory.validate(Group_1.feature())) - -selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 6) -assert(aFactory.validate(Group_2.feature())) - -selectionList = Group_3.feature().selectionList("group_list") -assert(selectionList.size() == 11) -assert(aFactory.validate(Group_3.feature())) - -model.begin() -Fillet_2 = model.addFillet(Part_1_doc, [model.selection("FACE", "Cylinder_1_1/Face_2")], 2) -model.do() -# move groups to the end -Part_1_doc.moveFeature(Group_4.feature(), Fillet_2.feature()) -Part_1_doc.moveFeature(Group_5.feature(), Group_4.feature()) -Part_1_doc.moveFeature(Group_6.feature(), Group_5.feature()) -model.end() - -# groups related to original cylinder should be split -selectionList = Group_4.feature().selectionList("group_list") -assert(selectionList.size() == 1) -assert(aFactory.validate(Group_4.feature())) - -selectionList = Group_5.feature().selectionList("group_list") -assert(selectionList.size() == 3) -assert(aFactory.validate(Group_5.feature())) - -selectionList = Group_6.feature().selectionList("group_list") -assert(selectionList.size() == 2) # edge selected for the fillet become removed -assert(aFactory.validate(Group_6.feature())) - -model.begin() -Fillet_3 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Fillet_1_1/MF:Fillet_Face&Box_1_1/Front][Fillet_1_1/MF:Fillet_Face&Box_1_1/Left]")], 1, 2) -model.do() -# move groups to the end -Part_1_doc.moveFeature(Group_1.feature(), Fillet_3.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()) -Part_1_doc.moveFeature(Group_5.feature(), Group_4.feature()) -Part_1_doc.moveFeature(Group_6.feature(), Group_5.feature()) -model.end() - -# groups related to original box should be split -selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 1) -assert(aFactory.validate(Group_1.feature())) - -selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 6) -assert(aFactory.validate(Group_2.feature())) - -selectionList = Group_3.feature().selectionList("group_list") -assert(selectionList.size() == 9) -assert(aFactory.validate(Group_3.feature())) - -# groups related to original cylinder should stay untouched -selectionList = Group_4.feature().selectionList("group_list") -assert(selectionList.size() == 1) -assert(aFactory.validate(Group_4.feature())) - -selectionList = Group_5.feature().selectionList("group_list") -assert(selectionList.size() == 3) -assert(aFactory.validate(Group_5.feature())) - -selectionList = Group_6.feature().selectionList("group_list") -assert(selectionList.size() == 2) -assert(aFactory.validate(Group_6.feature())) - -assert(model.checkPythonDump()) diff --git a/src/CollectionPlugin/Test/TestGroupMove9.py b/src/CollectionPlugin/Test/TestGroupMove9.py deleted file mode 100644 index f8b338348..000000000 --- a/src/CollectionPlugin/Test/TestGroupMove9.py +++ /dev/null @@ -1,75 +0,0 @@ -## 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 -## - -# Test of deep nested results history. FuseFaces operation. -# Check the groups of initial solids moved to the end contain the corresponding -# results, but merged faces. - -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) -Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1"), model.selection("SOLID", "Box_1_1")]) -Union_1_objects = [model.selection("SOLID", "Partition_1_1_1"), model.selection("SOLID", "Partition_1_1_2"), model.selection("SOLID", "Partition_1_1_3")] -Union_1 = model.addUnion(Part_1_doc, Union_1_objects) -Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Union_1_1")]) -Group_2_objects = [model.selection("FACE", "Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1"), model.selection("FACE", "Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_2"), model.selection("FACE", "Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_3"), model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Bottom&Cylinder_1_1/Face_3"), model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_1_1/Top&Cylinder_1_1/Face_2"), model.selection("FACE", "Partition_1_1_3/Modified_Face&Box_1_1/Back"), model.selection("FACE", "Partition_1_1_3/Modified_Face&Box_1_1/Bottom"), model.selection("FACE", "Partition_1_1_3/Modified_Face&Box_1_1/Top"), model.selection("FACE", "Box_1_1/Right"), model.selection("FACE", "Partition_1_1_3/Modified_Face&Box_1_1/Left"), model.selection("FACE", "Box_1_1/Front")] -Group_2 = model.addGroup(Part_1_doc, Group_2_objects) -Group_3_objects = [model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_3]"), model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_2][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1]"), model.selection("EDGE", "([Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_3])(Partition_1_1_3/Generated_Edge&Box_1_1/Back&Cylinder_1_1/Face_1)([Partition_1_1_3/Modified_Face&Box_1_1/Back][Partition_1_1_3/Modified_Face&Box_1_1/Bottom])([Partition_1_1_3/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Bottom&Cylinder_1_1/Face_3])_Union_1_1"), model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Back][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Back][Box_1_1/Right]"), model.selection("EDGE", "Partition_1_1_3/Generated_Edge&Box_1_1/Back&Cylinder_1_1/Face_1"), model.selection("EDGE", "([Partition_1_1_2/Modified_Face&Box_1_1/Top&Cylinder_1_1/Face_2][Partition_1_1_3/Modified_Face&Box_1_1/Top])([Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_2][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1])([Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Back])(Partition_1_1_3/Generated_Edge&Box_1_1/Back&Cylinder_1_1/Face_1)_Union_1_1"), model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Back]"), model.selection("EDGE", "([Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_3/Modified_Face&Box_1_1/Left])([Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_3])([Partition_1_1_3/Modified_Face&Box_1_1/Left][Partition_1_1_3/Modified_Face&Box_1_1/Bottom])([Partition_1_1_3/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Bottom&Cylinder_1_1/Face_3])_Union_1_1"), model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Bottom&Cylinder_1_1/Face_3]"), model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_1_1/Top&Cylinder_1_1/Face_2][Partition_1_1_3/Modified_Face&Box_1_1/Top]"), model.selection("EDGE", "([Partition_1_1_2/Modified_Face&Box_1_1/Top&Cylinder_1_1/Face_2][Partition_1_1_3/Modified_Face&Box_1_1/Top])([Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_2][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1])([Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Left])([Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_3/Modified_Face&Box_1_1/Left])_Union_1_1"), model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_3/Modified_Face&Box_1_1/Left]"), model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Box_1_1/Right]"), model.selection("EDGE", "[Box_1_1/Right][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Left][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left]"), model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Left]"), model.selection("EDGE", "[Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Front]"), model.selection("EDGE", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Box_1_1/Front]")] -Group_3 = model.addGroup(Part_1_doc, Group_3_objects) -Group_4_objects = [model.selection("VERTEX", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left]"), model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Top&Cylinder_1_1/Face_2][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_2][Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_3/Modified_Face&Box_1_1/Left]"), model.selection("VERTEX", "[Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Left][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]"), model.selection("VERTEX", "[_weak_name_10_Union_1_1]e[_weak_name_4_Union_1_1]e"), model.selection("VERTEX", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Box_1_1/Right][Box_1_1/Front]"), model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_3/Modified_Face&Box_1_1/Left][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_3][Partition_1_1_3/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Bottom&Cylinder_1_1/Face_3]"), model.selection("VERTEX", "[Partition_1_1_2/Modified_Face&Box_1_1/Top&Cylinder_1_1/Face_2][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_2][Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_3/Modified_Face&Box_1_1/Back]"), model.selection("VERTEX", "[Box_1_1/Right][Box_1_1/Front][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]"), model.selection("VERTEX", "[_weak_name_3_Union_1_1]e[_weak_name_9_Union_1_1]e"), model.selection("VERTEX", "[Partition_1_1_3/Modified_Face&Box_1_1/Top][Partition_1_1_3/Modified_Face&Box_1_1/Back][Box_1_1/Right]"), model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_1][Partition_1_1_3/Modified_Face&Box_1_1/Back][Partition_1_1_1/Modified_Face&Cylinder_1_1/Face_3][Partition_1_1_3/Modified_Face&Box_1_1/Bottom][Partition_1_1_2/Modified_Face&Box_1_1/Bottom&Cylinder_1_1/Face_3]"), model.selection("VERTEX", "[Partition_1_1_3/Modified_Face&Box_1_1/Back][Box_1_1/Right][Partition_1_1_3/Modified_Face&Box_1_1/Bottom]")] -Group_4 = model.addGroup(Part_1_doc, Group_4_objects) -FusionFaces_1 = model.addFusionFaces(Part_1_doc, model.selection("SOLID", "Union_1_1")) -model.do() -# move groups to the end -Part_1_doc.moveFeature(Group_1.feature(), FusionFaces_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() - -from ModelAPI import * - -aFactory = ModelAPI_Session.get().validators() - -# number of solids should be the same -selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 1) -assert(aFactory.validate(Group_1.feature())) - -# same-plane faces should be merged -selectionList = Group_2.feature().selectionList("group_list") -assert(selectionList.size() == 11) -assert(aFactory.validate(Group_2.feature())) - -# shared edges of merged faces should be deleted -selectionList = Group_3.feature().selectionList("group_list") -assert(selectionList.size() == 15) -assert(aFactory.validate(Group_3.feature())) - -selectionList = Group_4.feature().selectionList("group_list") -assert(selectionList.size() == 10) -assert(aFactory.validate(Group_4.feature())) - -assert(model.checkPythonDump())