]> SALOME platform Git repositories - modules/shaper.git/blob - src/GDMLPlugin/Test/TestEllipsoid.py
Salome HOME
3f7080d2049e952fc411c607a1c3282b58634bf5
[modules/shaper.git] / src / GDMLPlugin / Test / TestEllipsoid.py
1 ## Copyright (C) 2018-20xx  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
18 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 ##
20
21 from salome.shaper import model
22 from GeomAPI import GeomAPI_Shape
23
24 model.begin()
25 partSet = model.moduleDocument()
26
27 Part_1 = model.addPart(partSet)
28 Part_1_doc = Part_1.document()
29 Ellipsoid_1 = model.addEllipsoid(Part_1_doc, 10, 20, 40)
30
31 model.testNbResults(Ellipsoid_1, 1)
32 model.testNbSubResults(Ellipsoid_1, [0])
33 model.testNbSubShapes(Ellipsoid_1, GeomAPI_Shape.SOLID, [1])
34 model.testNbSubShapes(Ellipsoid_1, GeomAPI_Shape.FACE, [1])
35 model.testNbSubShapes(Ellipsoid_1, GeomAPI_Shape.EDGE, [4])
36 model.testNbSubShapes(Ellipsoid_1, GeomAPI_Shape.VERTEX, [8])
37 model.testResultsVolumes(Ellipsoid_1, [4188.80255909031])
38
39 Part_2 = model.addPart(partSet)
40 Part_2_doc = Part_2.document()
41 Ellipsoid_2 = model.addEllipsoid(Part_2_doc, 20, 10, 30, 5, 5)
42
43 model.testNbResults(Ellipsoid_2, 1)
44 model.testNbSubResults(Ellipsoid_2, [0])
45 model.testNbSubShapes(Ellipsoid_2, GeomAPI_Shape.SOLID, [1])
46 model.testNbSubShapes(Ellipsoid_2, GeomAPI_Shape.FACE, [3])
47 model.testNbSubShapes(Ellipsoid_2, GeomAPI_Shape.EDGE, [6])
48 model.testNbSubShapes(Ellipsoid_2, GeomAPI_Shape.VERTEX, [12])
49 model.testResultsVolumes(Ellipsoid_2, [1512.62177363772])
50
51 Part_3 = model.addPart(partSet)
52 Part_3_doc = Part_3.document()
53 Ellipsoid_3 = model.addEllipsoid(Part_3_doc, 20, 20, 40)
54 Ellipsoid_3.setZCut1(5)
55
56 model.testNbResults(Ellipsoid_3, 1)
57 model.testNbSubResults(Ellipsoid_3, [0])
58 model.testNbSubShapes(Ellipsoid_3, GeomAPI_Shape.SOLID, [1])
59 model.testNbSubShapes(Ellipsoid_3, GeomAPI_Shape.FACE, [2])
60 model.testNbSubShapes(Ellipsoid_3, GeomAPI_Shape.EDGE, [7])
61 model.testNbSubShapes(Ellipsoid_3, GeomAPI_Shape.VERTEX, [14])
62 model.testResultsVolumes(Ellipsoid_3, [5726.87643051263])
63
64 Part_4 = model.addPart(partSet)
65 Part_4_doc = Part_4.document()
66 Ellipsoid_4 = model.addEllipsoid(Part_4_doc, 20, 20, 40)
67 Ellipsoid_4.setZCut2(5)
68
69 model.testNbResults(Ellipsoid_4, 1)
70 model.testNbSubResults(Ellipsoid_4, [0])
71 model.testNbSubShapes(Ellipsoid_4, GeomAPI_Shape.SOLID, [1])
72 model.testNbSubShapes(Ellipsoid_4, GeomAPI_Shape.FACE, [2])
73 model.testNbSubShapes(Ellipsoid_4, GeomAPI_Shape.EDGE, [7])
74 model.testNbSubShapes(Ellipsoid_4, GeomAPI_Shape.VERTEX, [14])
75 model.testResultsVolumes(Ellipsoid_4, [5726.87643051263])
76
77 model.end()
78
79 assert(model.checkPythonDump())