]> SALOME platform Git repositories - modules/shaper.git/blob - test.API/SHAPER/Transformations/TestMultiRotation.py
Salome HOME
Merge remote-tracking branch 'origin/cbr/export_to_geom_via_xao'
[modules/shaper.git] / test.API / SHAPER / Transformations / TestMultiRotation.py
1 ## Copyright (C) 2014-2017  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 """
22 Test case for MultiRotation feature.
23 Written on High API.
24 """
25
26 from salome.shaper import model
27
28 model.begin()
29 partSet = model.moduleDocument()
30 Part_1 = model.addPart(partSet)
31 Part_1_doc = Part_1.document()
32
33 #Init
34 Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
35 Box_2 = model.addBox(Part_1_doc, 10, 10, 10)
36 Box_3 = model.addBox(Part_1_doc, 10, 10, 10)
37 Box_4 = model.addBox(Part_1_doc, 10, 10, 10)
38 Box_5 = model.addBox(Part_1_doc, 10, 10, 10)
39 Box_6 = model.addBox(Part_1_doc, 10, 10, 10)
40 Axis_1 = model.selection("EDGE", "edge")
41
42 # Tests
43 MultiRotation_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OZ"), 5)
44 MultiRotation_2 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Box_2_1")], model.selection("EDGE", "PartSet/OZ"), 0)
45 MultiRotation_3 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Box_3_1")], model.selection("EDGE", "PartSet/OZ"), -3)
46 MultiRotation_4 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Box_4_1")], model.selection("EDGE", "PartSet/OY"), 90, 4)
47 MultiRotation_5 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Box_5_1")], model.selection("EDGE", "PartSet/OY"), -75, 4)
48 MultiRotation_6 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Box_6_1")], Axis_1, 4)
49
50 model.do()
51 model.end()
52
53 # Check
54 from GeomAPI import GeomAPI_Shape
55
56 model.testNbResults(MultiRotation_1, 1)
57 model.testNbSubResults(MultiRotation_1, [5])
58 model.testNbSubShapes(MultiRotation_1, GeomAPI_Shape.COMPOUND, [1])
59 model.testNbSubShapes(MultiRotation_1, GeomAPI_Shape.SOLID, [5])
60 model.testNbSubShapes(MultiRotation_1, GeomAPI_Shape.FACE, [30])
61 model.testHaveNamingFaces(MultiRotation_1, model, Part_1_doc)
62
63 model.testNbResults(MultiRotation_4, 1)
64 model.testNbSubResults(MultiRotation_4, [4])
65 model.testNbSubShapes(MultiRotation_4, GeomAPI_Shape.COMPOUND, [1])
66 model.testNbSubShapes(MultiRotation_4, GeomAPI_Shape.SOLID, [4])
67 model.testNbSubShapes(MultiRotation_4, GeomAPI_Shape.FACE, [24])
68 model.testHaveNamingFaces(MultiRotation_4, model, Part_1_doc)
69
70 model.testNbResults(MultiRotation_5, 1)
71 model.testNbSubResults(MultiRotation_5, [4])
72 model.testNbSubShapes(MultiRotation_5, GeomAPI_Shape.COMPOUND, [1])
73 model.testNbSubShapes(MultiRotation_5, GeomAPI_Shape.SOLID, [4])
74 model.testNbSubShapes(MultiRotation_5, GeomAPI_Shape.FACE, [24])
75 model.testHaveNamingFaces(MultiRotation_5, model, Part_1_doc)
76
77 model.testNbResults(MultiRotation_2, 0)
78 assert(MultiRotation_2.feature().error() == "Multirotation builder :: the number of copies for the angular direction is null or negative.")
79
80 model.testNbResults(MultiRotation_3, 0)
81 assert(MultiRotation_3.feature().error() == "Multirotation builder :: the number of copies for the angular direction is null or negative.")
82
83 model.testNbResults(MultiRotation_6, 0)
84 assert(MultiRotation_6.feature().error() == "Attribute \"axis_angular\" is not initialized.")