Salome HOME
Merge remote-tracking branch 'origin/Toolbars_Management'
[modules/shaper.git] / src / ModelAPI / Test / TestWeakNamingSortOrder.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 *
23
24 model.begin()
25 partSet = model.moduleDocument()
26
27 Part_1 = model.addPart(partSet)
28 Part_1_doc = Part_1.document()
29 Point_2 = model.addPoint(Part_1_doc, 10, 0, 0)
30 Point_3 = model.addPoint(Part_1_doc, 0, 10, 0)
31 Point_4 = model.addPoint(Part_1_doc, 20, 10, 0)
32 Point_5 = model.addPoint(Part_1_doc, 10, 20, 0)
33 Polyline_1 = model.addPolyline3D(Part_1_doc, [model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_4")], False)
34 Polyline_2 = model.addPolyline3D(Part_1_doc, [model.selection("VERTEX", "Point_2"), model.selection("VERTEX", "Point_3")], False)
35 Compound_1 = model.addCompound(Part_1_doc, [model.selection("WIRE", "Polyline_1_1"), model.selection("WIRE", "Polyline_2_1")])
36 Translation_1 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Compound_1_1_2", 1)], model.selection("EDGE", "PartSet/OY"), 10)
37 model.do()
38
39 model.testNbResults(Translation_1, 1)
40 model.testNbSubResults(Translation_1, [0])
41 model.testNbSubShapes(Translation_1, GeomAPI_Shape.SOLID, [0])
42 model.testNbSubShapes(Translation_1, GeomAPI_Shape.FACE, [0])
43 model.testNbSubShapes(Translation_1, GeomAPI_Shape.EDGE, [1])
44 model.testNbSubShapes(Translation_1, GeomAPI_Shape.VERTEX, [2])
45
46
47 Part_2 = model.addPart(partSet)
48 Part_2_doc = Part_2.document()
49 Box_1 = model.addBox(Part_2_doc, 10, 10, 10)
50 Box_2 = model.addBox(Part_2_doc, 4, 4, 4)
51 Translation_2 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Box_2_1")], 3, 3, 3)
52 Compound_2 = model.addCompound(Part_2_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Translation_1_1")])
53 Translation_3 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Compound_1_1", 0)], 10, 0, 0)
54 model.do()
55
56 model.testNbResults(Translation_3, 1)
57 model.testNbSubResults(Translation_3, [2])
58 model.testNbSubShapes(Translation_3, GeomAPI_Shape.SOLID, [2])
59 model.testNbSubShapes(Translation_3, GeomAPI_Shape.FACE, [12])
60 model.testNbSubShapes(Translation_3, GeomAPI_Shape.EDGE, [48])
61 model.testNbSubShapes(Translation_3, GeomAPI_Shape.VERTEX, [96])
62 model.testResultsVolumes(Translation_3, [1064])
63
64
65 Part_3 = model.addPart(partSet)
66 Part_3_doc = Part_3.document()
67 Box_3 = model.addBox(Part_3_doc, 10, 10, 10)
68 Box_4 = model.addBox(Part_3_doc, 10, 10, 10)
69 Point_6 = model.addPoint(Part_3_doc, 5, 5, 0)
70 Point_7 = model.addPoint(Part_3_doc, 5, 5, 10)
71 Axis_4 = model.addAxis(Part_3_doc, model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2"))
72 Rotation_1 = model.addRotation(Part_3_doc, [model.selection("SOLID", "Box_2_1")], model.selection("EDGE", "Axis_1"), 45)
73 Compound_3 = model.addCompound(Part_3_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Rotation_1_1")])
74 Translation_4 = model.addTranslation(Part_3_doc, [model.selection("SOLID", "Compound_1_1", 1)], 10, 0, 0)
75 model.do()
76
77 model.testNbResults(Translation_4, 1)
78 model.testNbSubResults(Translation_4, [0])
79 model.testNbSubShapes(Translation_4, GeomAPI_Shape.SOLID, [1])
80 model.testNbSubShapes(Translation_4, GeomAPI_Shape.FACE, [6])
81 model.testNbSubShapes(Translation_4, GeomAPI_Shape.EDGE, [24])
82 model.testNbSubShapes(Translation_4, GeomAPI_Shape.VERTEX, [48])
83 model.testResultsVolumes(Translation_4, [1000])
84
85
86 Part_4 = model.addPart(partSet)
87 Part_4_doc = Part_4.document()
88 Box_5 = model.addBox(Part_4_doc, 10, 10, 10)
89 Box_6 = model.addBox(Part_4_doc, 10, 10, 10)
90 Compound_4 = model.addCompound(Part_4_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Box_2_1")])
91 Translation_5 = model.addTranslation(Part_4_doc, [model.selection("SOLID", "Compound_1_1", 1)], model.selection("EDGE", "PartSet/OZ"), 10)
92 model.do()
93
94 model.testNbResults(Translation_5, 1)
95 model.testNbSubResults(Translation_5, [0])
96 model.testNbSubShapes(Translation_5, GeomAPI_Shape.SOLID, [1])
97 model.testNbSubShapes(Translation_5, GeomAPI_Shape.FACE, [6])
98 model.testNbSubShapes(Translation_5, GeomAPI_Shape.EDGE, [24])
99 model.testNbSubShapes(Translation_5, GeomAPI_Shape.VERTEX, [48])
100 model.testResultsVolumes(Translation_5, [1000])
101
102 model.end()