Salome HOME
updated copyright message
[modules/shaper.git] / src / CollectionPlugin / Test / TestGroupMove20.py
1 # Copyright (C) 2014-2023  CEA, EDF
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 based on DBC mail 04.03.2019. If the selected solid was not modified by
21 # the following Split operation, this selection disappears after movement to the end.
22
23 from GeomAPI import *
24 from ModelAPI import *
25 from salome.shaper import model
26
27 model.begin()
28 partSet = model.moduleDocument()
29 Part_1 = model.addPart(partSet)
30 Part_1_doc = Part_1.document()
31 Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
32 Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), 2, True)
33 Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), 7, True)
34 Split_1 = model.addSplit(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("FACE", "Plane_2")])
35 Group_1 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Split_1_1_1")])
36 Split_2 = model.addSplit(Part_1_doc, [model.selection("COMPSOLID", "Split_1_1")], [model.selection("FACE", "Plane_1")])
37 model.do()
38
39 # move group
40 Part_1_doc.moveFeature(Group_1.feature(), Split_2.feature())
41 model.end()
42
43 # Check group: result must be four faces
44 aFactory = ModelAPI_Session.get().validators()
45 selectionList = Group_1.feature().selectionList("group_list")
46 assert(selectionList.size() == 1)
47 assert(aFactory.validate(Group_1.feature()))
48 assert(Group_1.groupList().value(0).value().shapeType() == GeomAPI_Shape.SOLID)
49
50 assert(model.checkPythonDump())