Salome HOME
3c9a4cace7d1f0389f3ad3c3d05865c49aafb894
[modules/shaper.git] / src / CollectionPlugin / Test / Test18739.py
1 # Copyright (C) 2014-2021  CEA/DEN, EDF R&D
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 # Test of move to the end and split on LinearCopy: check that order in result is correct
21
22 from salome.shaper import model
23
24 model.begin()
25 partSet = model.moduleDocument()
26 Part_1 = model.addPart(partSet)
27 Part_1_doc = Part_1.document()
28 model.addParameter(Part_1_doc, "d", "8")
29 model.addParameter(Part_1_doc, "nb", "3")
30 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
31 SketchCircle_1 = Sketch_1.addCircle(-34, 28, 1)
32 SketchCircle_2 = Sketch_1.addCircle(-34, 28, 3)
33 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchCircle_2.center())
34 model.do()
35 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_2_2f-SketchCircle_1_2r_wire_2")], model.selection(), 2, -1)
36 Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_2_2f-SketchCircle_1_2r_wire")], model.selection(), 5, 0)
37 Partition_1 = model.addPartition(Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_1"), model.selection("COMPOUND", "all-in-Extrusion_2")])
38 Group_1 = model.addGroup(Part_1_doc, "Solids", [model.selection("SOLID", "Partition_1_1_1")])
39 LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1")], model.selection("EDGE", "PartSet/OX"), "d", "nb", model.selection("EDGE", "PartSet/OY"), "d", "nb")
40 model.do()
41 Part_1_doc.moveFeature(Group_1.feature(), LinearCopy_1.feature(), True)
42 model.end()
43
44 for a in range(9):
45   aGroup = Part_1_doc.objectByName("Features", "Group_1_" + str(a + 1))
46   aSelName = aGroup.data().selectionList("group_list").value(0).context().data().name()
47   assert(aSelName == "LinearCopy_1_1_" + str(a + 1) + "_1")