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