Salome HOME
4362271d70618ce5bda7449cb39baf5b54ac49bc
[modules/shaper.git] / src / ModelAPI / Test / Test19989.py
1 # Copyright (C) 2014-2023  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 from salome.shaper import model
21
22 model.begin()
23 partSet = model.moduleDocument()
24 Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY"))
25 SketchCircle_1 = Sketch_1.addCircle(12, 10, 8)
26 model.do()
27 Sketch_2 = model.addSketch(partSet, model.defaultPlane("XOY"))
28 SketchCircle_2 = Sketch_2.addCircle(24, 10, 8)
29 model.do()
30 Part_1 = model.addPart(partSet)
31 Part_1_doc = Part_1.document()
32 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "PartSet/Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0)
33 Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "PartSet/Sketch_2/Face-SketchCircle_2_2r")], model.selection(), 12, 0)
34 Fuse_1 = model.addFuse(Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_1"), model.selection("COMPOUND", "all-in-Extrusion_2")], keepSubResults = True)
35 ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), [model.selection("COMPOUND", "all-in-Fuse_1")])
36 Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face"))
37 SketchCircle_3 = Sketch_3.addCircle(32, 10, 2)
38 ExtrusionCut_1.setNestedSketch(Sketch_3)
39 Group_1 = model.addGroup(Part_1_doc, "Faces", [model.selection("FACE", "Extrusion_2_1/To_Face")])
40 model.end()
41
42 # cause the update in the history for the group
43 model.begin()
44 Part_1_doc.setCurrentFeature(Fuse_1.feature(), True)
45 model.do()
46 Part_1_doc.setCurrentFeature(Group_1.feature(), True)
47 model.end()
48
49 assert(ExtrusionCut_1.feature().firstResult().shape().isSubShape(Group_1.groupList().value(0).value()))
50
51 assert(model.checkPythonDump())