Salome HOME
Copyright update 2022
[modules/shaper.git] / src / FeaturesPlugin / Test / TestRevolutionOfCompound.py
1 # Copyright (C) 2018-2022  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 Part_1 = model.addPart(partSet)
26 Part_1_doc = Part_1.document()
27 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
28 SketchCircle_1 = Sketch_1.addCircle(15, -20, 8)
29 SketchCircle_2 = Sketch_1.addCircle(35, -35, 15)
30 model.do()
31 Compound_1 = model.addCompound(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f")])
32 Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], model.selection("EDGE", "PartSet/OX"), model.selection(), 0, model.selection("FACE", "PartSet/XOZ"), 0)
33 model.do()
34
35 Part_2 = model.addPart(partSet)
36 Part_2_doc = Part_2.document()
37 Sketch_2 = model.addSketch(Part_2_doc, model.defaultPlane("XOY"))
38 SketchCircle_3 = Sketch_2.addCircle(15, -20, 8)
39 SketchCircle_4 = Sketch_2.addCircle(35, -35, 15)
40 model.do()
41 Compound_2 = model.addCompound(Part_2_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f")])
42 Revolution_2 = model.addRevolution(Part_2_doc, [model.selection("COMPOUND", "Compound_1_1")], model.selection("EDGE", "PartSet/OX"), 90, 0)
43 model.do()
44
45 Part_3 = model.addPart(partSet)
46 Part_3_doc = Part_3.document()
47 Sketch_3 = model.addSketch(Part_3_doc, model.defaultPlane("XOY"))
48 SketchCircle_5 = Sketch_3.addCircle(15, -20, 8)
49 SketchCircle_6 = Sketch_3.addCircle(35, -35, 15)
50 model.do()
51 Compound_3 = model.addCompound(Part_3_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f")])
52 Revolution_3 = model.addRevolution(Part_3_doc, [model.selection("COMPOUND", "Compound_1_1")], model.selection("EDGE", "PartSet/OX"), model.selection("FACE", "PartSet/XOY"), 0, model.selection("FACE", "PartSet/XOZ"), 0)
53 model.do()
54
55 model.end()
56
57 from GeomAPI import GeomAPI_Shape
58
59 model.testNbResults(Revolution_1, 1)
60 model.testNbSubResults(Revolution_1, [0])
61 model.testNbSubShapes(Revolution_1, GeomAPI_Shape.SOLID, [1])
62 model.testNbSubShapes(Revolution_1, GeomAPI_Shape.FACE, [3])
63 model.testNbSubShapes(Revolution_1, GeomAPI_Shape.EDGE, [8])
64 model.testNbSubShapes(Revolution_1, GeomAPI_Shape.VERTEX, [16])
65 model.testResultsVolumes(Revolution_1, [38861.56734363])
66
67 model.testNbResults(Revolution_2, 1)
68 model.testNbSubResults(Revolution_2, [2])
69 model.testNbSubShapes(Revolution_2, GeomAPI_Shape.SOLID, [2])
70 model.testNbSubShapes(Revolution_2, GeomAPI_Shape.FACE, [6])
71 model.testNbSubShapes(Revolution_2, GeomAPI_Shape.EDGE, [12])
72 model.testNbSubShapes(Revolution_2, GeomAPI_Shape.VERTEX, [24])
73 model.testResultsVolumes(Revolution_2, [45178.11414513])
74
75 model.testNbResults(Revolution_3, 1)
76 model.testNbSubResults(Revolution_3, [0])
77 model.testNbSubShapes(Revolution_3, GeomAPI_Shape.SOLID, [1])
78 model.testNbSubShapes(Revolution_3, GeomAPI_Shape.FACE, [3])
79 model.testNbSubShapes(Revolution_3, GeomAPI_Shape.EDGE, [6])
80 model.testNbSubShapes(Revolution_3, GeomAPI_Shape.VERTEX, [12])
81 model.testResultsVolumes(Revolution_3, [38861.56733864])
82
83 assert(model.checkPythonDump())