1 # Copyright (C) 2020 CEA/DEN, EDF R&D
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.
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.
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
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 from salome.shaper import model
23 partSet = model.moduleDocument()
26 Part_1 = model.addPart(partSet)
27 Part_1_doc = Part_1.document()
30 Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
31 Box_1.setName("boîte")
32 Box_1.result().setName("boîte")
35 Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), 10)
36 Sphere_1.setName("sphère")
37 Sphere_1.result().setName("sphère")
40 Shell_1_objects = [model.selection("FACE", "boîte/Left"),
41 model.selection("FACE", "boîte/Back"),
42 model.selection("FACE", "boîte/Bottom")]
43 Shell_1 = model.addShell(Part_1_doc, Shell_1_objects)
46 Cut_1 = model.addCut(Part_1_doc, [model.selection("SHELL", "boîte")], [model.selection("COMPOUND", "all-in-sphère")], keepSubResults = True)
47 Cut_1.result().subResult(0).setName("Cut_1_1_1")
48 Cut_1.result().subResult(1).setName("Cut_1_1_2")
49 Cut_1.result().subResult(2).setName("Cut_1_1_3")
55 model.testNbResults(Cut_1, 1)
56 model.testNbSubResults(Cut_1, [3])
57 model.testNbSubShapes(Cut_1, GeomAPI_Shape.SOLID, [0])
58 model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [3])
59 model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [9])
60 model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [18])
61 model.testResultsVolumes(Cut_1, [64.38055098])
63 assert(model.checkPythonDump())