]> SALOME platform Git repositories - modules/shaper.git/blob - test.API/SHAPER/Transformations/TestTranslation_4.py
Salome HOME
Merge branch 'master' into cgt/devCEA
[modules/shaper.git] / test.API / SHAPER / Transformations / TestTranslation_4.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 Translation feature.
23 Written on High API.
24 """
25 from salome.shaper import model
26
27 model.begin()
28 partSet = model.moduleDocument()
29 Part_1 = model.addPart(partSet)
30 Part_1_doc = Part_1.document()
31
32 # Boxes
33 Box_1 = model.addBox(Part_1_doc, 10, 20, 10)
34 Box_2 = model.addBox(Part_1_doc, 10, 20, 10)
35 Box_3 = model.addBox(Part_1_doc, 10, 20, 10)
36 Box_4 = model.addBox(Part_1_doc, 10, 20, 10)
37 Box_5 = model.addBox(Part_1_doc, 10, 20, 10)
38 Box_6 = model.addBox(Part_1_doc, 10, 20, 10)
39 Box_7 = model.addBox(Part_1_doc, 10, 20, 10)
40 Box_8 = model.addBox(Part_1_doc, 10, 20, 10)
41
42 # Parameters
43 model.addParameter(Part_1_doc, "dx", "10")
44 model.addParameter(Part_1_doc, "dy", "15")
45 model.addParameter(Part_1_doc, "dz", "-5")
46
47 # Translations
48 Translation_91 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], 10, 20, 15)
49 Translation_92 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_2_1")], 0, 20, 15)
50 Translation_93 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_3_1")], 10, 0, 15)
51 Translation_94 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_4_1")], 10, 20, 0)
52 Translation_95 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_5_1")], -10, 20, 15)
53 Translation_96 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_6_1")], 10, -20, 15)
54 Translation_97 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_7_1")], 10, 20, -15)
55 Translation_98 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_8_1")], "dx", "dy", "dz")
56 model.do()
57 model.end()
58
59 # Checks
60 from GeomAPI import GeomAPI_Shape
61
62 model.testNbResults(Translation_91, 1)
63 model.testNbSubResults(Translation_91, [0])
64 model.testNbSubShapes(Translation_91, GeomAPI_Shape.SOLID, [1])
65 model.testNbSubShapes(Translation_91, GeomAPI_Shape.FACE, [6])
66 model.testHaveNamingFaces(Translation_91, model, Part_1_doc)
67
68 model.testNbResults(Translation_92, 1)
69 model.testNbSubResults(Translation_92, [0])
70 model.testNbSubShapes(Translation_92, GeomAPI_Shape.SOLID, [1])
71 model.testNbSubShapes(Translation_92, GeomAPI_Shape.FACE, [6])
72 model.testHaveNamingFaces(Translation_92, model, Part_1_doc)
73
74 model.testNbResults(Translation_93, 1)
75 model.testNbSubResults(Translation_93, [0])
76 model.testNbSubShapes(Translation_93, GeomAPI_Shape.SOLID, [1])
77 model.testNbSubShapes(Translation_93, GeomAPI_Shape.FACE, [6])
78 model.testHaveNamingFaces(Translation_93, model, Part_1_doc)
79
80 model.testNbResults(Translation_94, 1)
81 model.testNbSubResults(Translation_94, [0])
82 model.testNbSubShapes(Translation_94, GeomAPI_Shape.SOLID, [1])
83 model.testNbSubShapes(Translation_94, GeomAPI_Shape.FACE, [6])
84 model.testHaveNamingFaces(Translation_94, model, Part_1_doc)
85
86 model.testNbResults(Translation_95, 1)
87 model.testNbSubResults(Translation_95, [0])
88 model.testNbSubShapes(Translation_95, GeomAPI_Shape.SOLID, [1])
89 model.testNbSubShapes(Translation_95, GeomAPI_Shape.FACE, [6])
90 model.testHaveNamingFaces(Translation_95, model, Part_1_doc)
91
92 model.testNbResults(Translation_96, 1)
93 model.testNbSubResults(Translation_96, [0])
94 model.testNbSubShapes(Translation_96, GeomAPI_Shape.SOLID, [1])
95 model.testNbSubShapes(Translation_96, GeomAPI_Shape.FACE, [6])
96 model.testHaveNamingFaces(Translation_96, model, Part_1_doc)
97
98 model.testNbResults(Translation_97, 1)
99 model.testNbSubResults(Translation_97, [0])
100 model.testNbSubShapes(Translation_97, GeomAPI_Shape.SOLID, [1])
101 model.testNbSubShapes(Translation_97, GeomAPI_Shape.FACE, [6])
102 model.testHaveNamingFaces(Translation_97, model, Part_1_doc)
103
104 model.testNbResults(Translation_98, 1)
105 model.testNbSubResults(Translation_98, [0])
106 model.testNbSubShapes(Translation_98, GeomAPI_Shape.SOLID, [1])
107 model.testNbSubShapes(Translation_98, GeomAPI_Shape.FACE, [6])
108 model.testHaveNamingFaces(Translation_98, model, Part_1_doc)