Salome HOME
9326fcce73b16126de8082804b1b00ee9736d5ed
[modules/shaper.git] / src / Locale / Test / TestUTF8.py
1 # Copyright (C) 2020-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
25 ### Create Part
26 Part_1 = model.addPart(partSet)
27 Part_1_doc = Part_1.document()
28
29 ### Create Box
30 Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
31 Box_1.setName("boîte")
32 Box_1.result().setName("boîte")
33
34 ### Create Sphere
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")
38
39 ### Create Shell
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)
44
45 ### Create Cut
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")
50
51 model.end()
52
53 from GeomAPI import *
54
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, [0.0])
62 model.testResultsAreas(Cut_1, [64.38055098])
63
64 assert(model.checkPythonDump())