Salome HOME
Update copyrights
[modules/shaper.git] / test.API / SHAPER / Transformations / TestTranslation_3.py
1 # Copyright (C) 2014-2019  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 """
21 Test case for Translation feature.
22 Written on High API.
23 """
24 from salome.shaper import model
25
26 model.begin()
27 partSet = model.moduleDocument()
28 Part_1 = model.addPart(partSet)
29 Part_1_doc = Part_1.document()
30
31 # Boxes
32 Box_1 = model.addBox(Part_1_doc, 10, 20, 10)
33
34 ####################
35 # Sketches
36 # Sketch contenant un triangle
37 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
38 SketchLine_1 = Sketch_1.addLine(105.8795836373178, 106.9780351893485, -55.30451701345322, -118.6797057217308)
39 SketchLine_2 = Sketch_1.addLine(-55.30451701345322, -118.6797057217308, -134.9484255703047, 86.11891628160174)
40 SketchLine_3 = Sketch_1.addLine(-134.9484255703047, 86.11891628160174, 105.8795836373178, 106.9780351893485)
41 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
42 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
43 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint())
44
45 # Sketch contenant un cercle et une ligne droite ne coupant pas le cercle, tous deux contenus dans l'une des faces de la box 1
46 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Top"))
47 SketchCircle_1 = Sketch_2.addCircle(3.625538020086079, 17.57352941176471, 2.190441696184978)
48 SketchLine_4 = Sketch_2.addLine(2.442711482557598, 6.454964041059345, 8.035432938365913, 18.18483116518828)
49
50 # Sketch contenant une ligne droite
51 Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
52 SketchLine_5 = Sketch_3.addLine(-42.70592498087446, -19.7671890801643, 76.68536514422158, 72.47712556405142)
53
54 # Sketch contenant 2 lignes droites independantes
55 Sketch_4 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
56 SketchLine_6 = Sketch_4.addLine(64.56241032998567, 126.9727403156384, -187.948350071736, -65.2797704447633)
57 SketchLine_7 = Sketch_4.addLine(147.7761836441895, 78.19225251076045, 2.869440459110503, -194.4045911047346)
58
59 # Sketch contenant un triangle et une ligne droite sans contact avec le triangle
60 Sketch_5 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
61 SketchLine_8 = Sketch_5.addLine(43.04160688665702, 82.49641319942614, -63.12769010043041, -3.586800573888105)
62 SketchLine_9 = Sketch_5.addLine(-63.12769010043041, -3.586800573888105, 60.25824964132004, -45.19368723098994)
63 SketchLine_10 = Sketch_5.addLine(60.25824964132004, -45.19368723098994, 43.04160688665702, 82.49641319942614)
64 SketchConstraintCoincidence_4 = Sketch_5.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
65 SketchConstraintCoincidence_5 = Sketch_5.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
66 SketchConstraintCoincidence_6 = Sketch_5.setCoincident(SketchLine_8.startPoint(), SketchLine_10.endPoint())
67 SketchLine_11 = Sketch_5.addLine(-129.0707731585723, -64.87131938806517, -62.80680259595319, 54.77196079444149)
68
69 # Sketch contenant deux triangles ayant un cote en commun
70 Sketch_6 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
71 SketchLine_12 = Sketch_6.addLine(31.56384505021527, 81.06169296987088, -80.3443328550933, -15.06456241033)
72 SketchLine_13 = Sketch_6.addLine(-80.3443328550933, -15.06456241033, 58.82352941176466, -35.15064562410331)
73 SketchLine_14 = Sketch_6.addLine(58.82352941176466, -35.15064562410331, 31.56384505021527, 81.06169296987088)
74 SketchLine_15 = Sketch_6.addLine(31.56384505021527, 81.06169296987088, 159.2539454806312, 40.88952654232425)
75 SketchLine_16 = Sketch_6.addLine(159.2539454806312, 40.88952654232425, 58.82352941176466, -35.15064562410331)
76 SketchConstraintCoincidence_7 = Sketch_6.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint())
77 SketchConstraintCoincidence_8 = Sketch_6.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint())
78 SketchConstraintCoincidence_9 = Sketch_6.setCoincident(SketchLine_12.startPoint(), SketchLine_14.endPoint())
79 SketchConstraintCoincidence_10 = Sketch_6.setCoincident(SketchLine_12.startPoint(), SketchLine_15.startPoint())
80 SketchConstraintCoincidence_11 = Sketch_6.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint())
81 SketchConstraintCoincidence_12 = Sketch_6.setCoincident(SketchLine_13.endPoint(), SketchLine_16.endPoint())
82
83 # Sketch contenant deux triangles ayant un cote en commun et une ligne droite ne coupant aucun des 2 triangles
84 Sketch_7 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
85 SketchLine_17 = Sketch_7.addLine(17.21664275466276, 98.27833572453372, -144.906743185079, -46.6284074605452)
86 SketchLine_18 = Sketch_7.addLine(-144.906743185079, -46.6284074605452, 143.4720229555236, -105.4519368723099)
87 SketchLine_19 = Sketch_7.addLine(143.4720229555236, -105.4519368723099, 17.21664275466276, 98.27833572453372)
88 SketchLine_20 = Sketch_7.addLine(17.21664275466276, 98.27833572453372, 272.5968436154949, 99.71305595408899)
89 SketchLine_21 = Sketch_7.addLine(272.5968436154949, 99.71305595408899, 143.4720229555236, -105.4519368723099)
90 SketchConstraintCoincidence_13 = Sketch_7.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint())
91 SketchConstraintCoincidence_14 = Sketch_7.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint())
92 SketchConstraintCoincidence_15 = Sketch_7.setCoincident(SketchLine_17.startPoint(), SketchLine_19.endPoint())
93 SketchConstraintCoincidence_16 = Sketch_7.setCoincident(SketchLine_17.startPoint(), SketchLine_20.startPoint())
94 SketchConstraintCoincidence_17 = Sketch_7.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint())
95 SketchConstraintCoincidence_18 = Sketch_7.setCoincident(SketchLine_18.endPoint(), SketchLine_21.endPoint())
96 SketchLine_22 = Sketch_7.addLine(-190.8177905308465, 62.41032998565277, -307.0301291248207, -188.6657101865136)
97
98 # Sketch contenant un cercle
99 Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Front"))
100 SketchCircle_2 = Sketch_8.addCircle(5.043472022955523, 6.180989956958394, 2.65480068754944)
101
102 model.do()
103
104 # Extrusions
105 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], model.selection(), 15, 0)
106 Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_8/Face-SketchCircle_2_2r_wire")], model.selection(), 15, 0)
107
108 # Edges
109 Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_2")])
110 Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/SketchLine_5")])
111 Edge_3 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/SketchLine_5")])
112 Edge_4 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/SketchLine_5")])
113 Edge_5 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/SketchLine_5")])
114 Edge_6 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/SketchLine_5")])
115 Edge_7 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_4/SketchLine_7")])
116 Edge_8 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_4/SketchLine_6")])
117 Edge_9 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_4/SketchLine_7")])
118 Edge_10 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_4/SketchLine_7")])
119 Edge_11 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_5/SketchLine_11")])
120 Edge_12 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_7/SketchLine_22")])
121
122 # Axis
123 Axis_1 = model.addAxis(Part_1_doc, 10, 10, 10)
124
125 # Vertex
126 Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/SketchLine_5_EndVertex")])
127 Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/SketchLine_5_EndVertex")])
128 Vertex_3 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/SketchLine_5_EndVertex")])
129 Vertex_4 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/SketchLine_5_EndVertex")])
130 Vertex_5 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/SketchLine_5_EndVertex")])
131 Vertex_6 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/SketchLine_5_EndVertex")])
132 Vertex_7 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/SketchLine_5_EndVertex")])
133 Vertex_8 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/SketchLine_5_EndVertex")])
134 Vertex_9 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/SketchLine_5_EndVertex")])
135
136 # Wires
137 Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
138 Wire_2 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
139 Wire_3 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
140 Wire_4 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
141 Wire_5 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
142 Wire_6 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_5/Face-SketchLine_8r-SketchLine_9f-SketchLine_10f_wire")])
143 Wire_7 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_5/Face-SketchLine_8r-SketchLine_9f-SketchLine_10f_wire")])
144 Wire_8 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
145 Wire_9 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
146
147 # Faces
148 Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
149 Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
150 Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
151 Face_4 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
152 Face_5 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
153 Face_6 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_5/Face-SketchLine_8r-SketchLine_9f-SketchLine_10f_wire")])
154 Face_7 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_5/Face-SketchLine_8r-SketchLine_9f-SketchLine_10f_wire")])
155 Face_8 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
156 Face_9 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
157 Face_10 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_6/Face-SketchLine_12r-SketchLine_13f-SketchLine_14f_wire")])
158 Face_11 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_6/Face-SketchLine_16r-SketchLine_15r-SketchLine_14r_wire")])
159 Face_12 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_7/Face-SketchLine_17r-SketchLine_18f-SketchLine_19f_wire")])
160 Face_13 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_7/Face-SketchLine_21r-SketchLine_20r-SketchLine_19r_wire")])
161
162 # Shells
163 Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Face_10_1"), model.selection("FACE", "Face_11_1")])
164 Shell_1.result().setName("Shell_1_1")
165 model.addRecover(Part_1_doc, Shell_1, [Face_10.result()])
166 model.addRecover(Part_1_doc, Shell_1, [Face_11.result()])
167 Shell_2 = model.addShell(Part_1_doc, [model.selection("FACE", "Recover_1_1"), model.selection("FACE", "Recover_2_1")])
168 Shell_2.result().setName("Shell_2_1")
169 model.addRecover(Part_1_doc, Shell_1, [Face_10.result()])
170 model.addRecover(Part_1_doc, Shell_1, [Face_11.result()])
171 Shell_3 = model.addShell(Part_1_doc, [model.selection("FACE", "Recover_3_1"), model.selection("FACE", "Recover_4_1")])
172 Shell_3.result().setName("Shell_3_1")
173 model.addRecover(Part_1_doc, Shell_1, [Face_10.result()])
174 model.addRecover(Part_1_doc, Shell_1, [Face_11.result()])
175 Shell_4 = model.addShell(Part_1_doc, [model.selection("FACE", "Recover_5_1"), model.selection("FACE", "Recover_6_1")])
176 Shell_4.result().setName("Shell_4_1")
177 model.addRecover(Part_1_doc, Shell_1, [Face_10.result()])
178 model.addRecover(Part_1_doc, Shell_1, [Face_11.result()])
179 Shell_5 = model.addShell(Part_1_doc, [model.selection("FACE", "Recover_7_1"), model.selection("FACE", "Recover_8_1")])
180 Shell_5.result().setName("Shell_5_1")
181 Shell_6 = model.addShell(Part_1_doc, [model.selection("FACE", "Face_12_1"), model.selection("FACE", "Face_13_1")])
182 Shell_6.result().setName("Shell_6_1")
183 model.addRecover(Part_1_doc, Shell_1, [Face_12.result()])
184 model.addRecover(Part_1_doc, Shell_1, [Face_13.result()])
185 Shell_7 = model.addShell(Part_1_doc, [model.selection("FACE", "Recover_9_1"), model.selection("FACE", "Recover_10_1")])
186 Shell_7.result().setName("Shell_7_1")
187 model.addRecover(Part_1_doc, Shell_1, [Face_10.result()])
188 model.addRecover(Part_1_doc, Shell_1, [Face_11.result()])
189 Shell_8 = model.addShell(Part_1_doc, [model.selection("FACE", "Recover_11_1"), model.selection("FACE", "Recover_12_1")])
190 Shell_8.result().setName("Shell_8_1")
191 model.addRecover(Part_1_doc, Shell_1, [Face_10.result()])
192 model.addRecover(Part_1_doc, Shell_1, [Face_11.result()])
193 Shell_9 = model.addShell(Part_1_doc, [model.selection("FACE", "Recover_13_1"), model.selection("FACE", "Recover_14_1")])
194 Shell_9.result().setName("Shell_9_1")
195
196 # Parameters
197 model.addParameter(Part_1_doc, "d", "15")
198
199 # Translations
200 Translation_45 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1")], model.selection("EDGE", "PartSet/OX"), 15)
201 Translation_46 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_2_1")], model.selection("EDGE", "PartSet/OX"), 0)
202 Translation_47 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_3_1")], model.selection("EDGE", "PartSet/OX"), -15)
203 Translation_48 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_4_1")], model.selection("EDGE", "InvalidName"), 15)
204 Translation_49 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_5_1")], model.selection("EDGE", "PartSet/OX"), "d")
205 Translation_50 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_6_1")], model.selection("EDGE", "Sketch_3/SketchLine_5"), 15)
206 Translation_51 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_7_1")], model.selection("EDGE", "Edge_2_1"), 15)
207 Translation_52 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_8_1")], model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), 15)
208 Translation_53 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_9_1")], model.selection("EDGE", "Axis_1"), 15)
209 Translation_54 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_2_1")], model.selection("EDGE", "PartSet/OX"), 15)
210 Translation_55 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_3_1")], model.selection("EDGE", "PartSet/OX"), 0)
211 Translation_56 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_4_1")], model.selection("EDGE", "PartSet/OX"), -15)
212 Translation_57 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_5_1")], model.selection("EDGE", "InvalidName"), 15)
213 Translation_58 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_6_1")], model.selection("EDGE", "PartSet/OY"), "d")
214 Translation_59 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_7_1")], model.selection("EDGE", "Sketch_4/SketchLine_6"), 15)
215 Translation_60 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_8_1")], model.selection("EDGE", "Edge_9_1"), 15)
216 Translation_61 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_9_1")], model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), 15)
217 Translation_62 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_10_1")], model.selection("EDGE", "Axis_1"), 15)
218 Translation_63 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection("EDGE", "PartSet/OX"), 15)
219 Translation_64 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_2_1")], model.selection("EDGE", "PartSet/OX"), 0)
220 Translation_65 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_3_1")], model.selection("EDGE", "PartSet/OX"), -15)
221 Translation_66 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_4_1")], model.selection("EDGE", "InvalidName"), 15)
222 Translation_67 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_5_1")], model.selection("EDGE", "PartSet/OY"), "d")
223 Translation_68 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_6_1")], model.selection("EDGE", "Sketch_5/SketchLine_11"), 15)
224 Translation_69 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_7_1")], model.selection("EDGE", "Edge_11_1"), 15)
225 Translation_70 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_8_1")], model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), 15)
226 Translation_71 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_9_1")], model.selection("EDGE", "Axis_1"), 15)
227 Translation_72 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OX"), 15)
228 Translation_73 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_2_1")], model.selection("EDGE", "PartSet/OX"), 0)
229 Translation_74 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_3_1")], model.selection("EDGE", "PartSet/OX"), -15)
230 Translation_75 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_4_1")], model.selection("EDGE", "InvalidName"), -15)
231 Translation_76 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_5_1")], model.selection("EDGE", "PartSet/OX"), "d")
232 Translation_77 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_6_1")], model.selection("EDGE", "Sketch_5/SketchLine_11"), 15)
233 Translation_78 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_7_1")], model.selection("EDGE", "Edge_11_1"), 15)
234 Translation_79 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_8_1")], model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), 15)
235 Translation_80 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_9_1")], model.selection("EDGE", "Axis_1"), 15)
236 Translation_81 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], model.selection("EDGE", "PartSet/OX"), 15)
237 Translation_82 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_2_1")], model.selection("EDGE", "PartSet/OX"), 0)
238 Translation_83 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_3_1")], model.selection("EDGE", "PartSet/OX"), -15)
239 Translation_84 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_4_1")], model.selection("EDGE", "InvalidName"), 15)
240 Translation_85 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_5_1")], model.selection("EDGE", "PartSet/OX"), "d")
241 Translation_86 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_6_1")], model.selection("EDGE", "Sketch_7/SketchLine_22"), 15)
242 Translation_87 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_7_1")], model.selection("EDGE", "Edge_12_1"), 15)
243 Translation_88 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_8_1")], model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), 15)
244 Translation_89 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_9_1")], model.selection("EDGE", "Axis_1"), 15)
245 Translation_90 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Extrusion_2_1")], model.selection("EDGE", "PartSet/OY"), 15)
246 model.do()
247 model.end()
248
249 # Checks
250 from GeomAPI import GeomAPI_Shape
251
252 model.testNbResults(Translation_45, 1)
253 model.testNbSubResults(Translation_45, [0])
254 model.testNbSubShapes(Translation_45, GeomAPI_Shape.COMPSOLID, [0])
255 model.testNbSubShapes(Translation_45, GeomAPI_Shape.SOLID, [0])
256 model.testNbSubShapes(Translation_45, GeomAPI_Shape.FACE, [0])
257 model.testNbSubShapes(Translation_45, GeomAPI_Shape.VERTEX, [1])
258 model.testHaveNamingFaces(Translation_45, model, Part_1_doc)
259
260 model.testNbResults(Translation_46, 1)
261 model.testNbSubResults(Translation_46, [0])
262 model.testNbSubShapes(Translation_46, GeomAPI_Shape.COMPSOLID, [0])
263 model.testNbSubShapes(Translation_46, GeomAPI_Shape.SOLID, [0])
264 model.testNbSubShapes(Translation_46, GeomAPI_Shape.FACE, [0])
265 model.testNbSubShapes(Translation_46, GeomAPI_Shape.VERTEX, [1])
266 model.testHaveNamingFaces(Translation_46, model, Part_1_doc)
267
268 model.testNbResults(Translation_47, 1)
269 model.testNbSubResults(Translation_47, [0])
270 model.testNbSubShapes(Translation_47, GeomAPI_Shape.COMPSOLID, [0])
271 model.testNbSubShapes(Translation_47, GeomAPI_Shape.SOLID, [0])
272 model.testNbSubShapes(Translation_47, GeomAPI_Shape.FACE, [0])
273 model.testNbSubShapes(Translation_47, GeomAPI_Shape.VERTEX, [1])
274 model.testHaveNamingFaces(Translation_47, model, Part_1_doc)
275
276 model.testNbResults(Translation_49, 1)
277 model.testNbSubResults(Translation_49, [0])
278 model.testNbSubShapes(Translation_49, GeomAPI_Shape.COMPSOLID, [0])
279 model.testNbSubShapes(Translation_49, GeomAPI_Shape.SOLID, [0])
280 model.testNbSubShapes(Translation_49, GeomAPI_Shape.FACE, [0])
281 model.testNbSubShapes(Translation_49, GeomAPI_Shape.VERTEX, [1])
282 model.testHaveNamingFaces(Translation_49, model, Part_1_doc)
283
284 model.testNbResults(Translation_50, 1)
285 model.testNbSubResults(Translation_50, [0])
286 model.testNbSubShapes(Translation_50, GeomAPI_Shape.COMPSOLID, [0])
287 model.testNbSubShapes(Translation_50, GeomAPI_Shape.SOLID, [0])
288 model.testNbSubShapes(Translation_50, GeomAPI_Shape.FACE, [0])
289 model.testNbSubShapes(Translation_50, GeomAPI_Shape.VERTEX, [1])
290 model.testHaveNamingFaces(Translation_50, model, Part_1_doc)
291
292 model.testNbResults(Translation_51, 1)
293 model.testNbSubResults(Translation_51, [0])
294 model.testNbSubShapes(Translation_51, GeomAPI_Shape.COMPSOLID, [0])
295 model.testNbSubShapes(Translation_51, GeomAPI_Shape.SOLID, [0])
296 model.testNbSubShapes(Translation_51, GeomAPI_Shape.FACE, [0])
297 model.testNbSubShapes(Translation_51, GeomAPI_Shape.VERTEX, [1])
298 model.testHaveNamingFaces(Translation_51, model, Part_1_doc)
299
300 model.testNbResults(Translation_52, 1)
301 model.testNbSubResults(Translation_52, [0])
302 model.testNbSubShapes(Translation_52, GeomAPI_Shape.COMPSOLID, [0])
303 model.testNbSubShapes(Translation_52, GeomAPI_Shape.SOLID, [0])
304 model.testNbSubShapes(Translation_52, GeomAPI_Shape.FACE, [0])
305 model.testNbSubShapes(Translation_52, GeomAPI_Shape.VERTEX, [1])
306 model.testHaveNamingFaces(Translation_52, model, Part_1_doc)
307
308 model.testNbResults(Translation_53, 1)
309 model.testNbSubResults(Translation_53, [0])
310 model.testNbSubShapes(Translation_53, GeomAPI_Shape.COMPSOLID, [0])
311 model.testNbSubShapes(Translation_53, GeomAPI_Shape.SOLID, [0])
312 model.testNbSubShapes(Translation_53, GeomAPI_Shape.FACE, [0])
313 model.testNbSubShapes(Translation_53, GeomAPI_Shape.VERTEX, [1])
314 model.testHaveNamingFaces(Translation_53, model, Part_1_doc)
315
316 model.testNbResults(Translation_54, 1)
317 model.testNbSubResults(Translation_54, [0])
318 model.testNbSubShapes(Translation_54, GeomAPI_Shape.SOLID, [0])
319 model.testNbSubShapes(Translation_54, GeomAPI_Shape.FACE, [0])
320 model.testNbSubShapes(Translation_54, GeomAPI_Shape.EDGE, [1])
321 model.testHaveNamingFaces(Translation_54, model, Part_1_doc)
322
323 model.testNbResults(Translation_55, 1)
324 model.testNbSubResults(Translation_55, [0])
325 model.testNbSubShapes(Translation_55, GeomAPI_Shape.SOLID, [0])
326 model.testNbSubShapes(Translation_55, GeomAPI_Shape.FACE, [0])
327 model.testNbSubShapes(Translation_55, GeomAPI_Shape.EDGE, [1])
328 model.testHaveNamingFaces(Translation_55, model, Part_1_doc)
329
330 model.testNbResults(Translation_56, 1)
331 model.testNbSubResults(Translation_56, [0])
332 model.testNbSubShapes(Translation_56, GeomAPI_Shape.SOLID, [0])
333 model.testNbSubShapes(Translation_56, GeomAPI_Shape.FACE, [0])
334 model.testNbSubShapes(Translation_56, GeomAPI_Shape.EDGE, [1])
335 model.testHaveNamingFaces(Translation_56, model, Part_1_doc)
336
337 model.testNbResults(Translation_58, 1)
338 model.testNbSubResults(Translation_58, [0])
339 model.testNbSubShapes(Translation_58, GeomAPI_Shape.SOLID, [0])
340 model.testNbSubShapes(Translation_58, GeomAPI_Shape.FACE, [0])
341 model.testNbSubShapes(Translation_58, GeomAPI_Shape.EDGE, [1])
342 model.testHaveNamingFaces(Translation_58, model, Part_1_doc)
343
344 model.testNbResults(Translation_59, 1)
345 model.testNbSubResults(Translation_59, [0])
346 model.testNbSubShapes(Translation_59, GeomAPI_Shape.SOLID, [0])
347 model.testNbSubShapes(Translation_59, GeomAPI_Shape.FACE, [0])
348 model.testNbSubShapes(Translation_59, GeomAPI_Shape.EDGE, [1])
349 model.testHaveNamingFaces(Translation_59, model, Part_1_doc)
350
351 model.testNbResults(Translation_60, 1)
352 model.testNbSubResults(Translation_60, [0])
353 model.testNbSubShapes(Translation_60, GeomAPI_Shape.SOLID, [0])
354 model.testNbSubShapes(Translation_60, GeomAPI_Shape.FACE, [0])
355 model.testNbSubShapes(Translation_60, GeomAPI_Shape.EDGE, [1])
356 model.testHaveNamingFaces(Translation_60, model, Part_1_doc)
357
358 model.testNbResults(Translation_61, 1)
359 model.testNbSubResults(Translation_61, [0])
360 model.testNbSubShapes(Translation_61, GeomAPI_Shape.SOLID, [0])
361 model.testNbSubShapes(Translation_61, GeomAPI_Shape.FACE, [0])
362 model.testNbSubShapes(Translation_61, GeomAPI_Shape.EDGE, [1])
363 model.testHaveNamingFaces(Translation_61, model, Part_1_doc)
364
365 model.testNbResults(Translation_62, 1)
366 model.testNbSubResults(Translation_62, [0])
367 model.testNbSubShapes(Translation_62, GeomAPI_Shape.SOLID, [0])
368 model.testNbSubShapes(Translation_62, GeomAPI_Shape.FACE, [0])
369 model.testNbSubShapes(Translation_62, GeomAPI_Shape.EDGE, [1])
370 model.testHaveNamingFaces(Translation_62, model, Part_1_doc)
371
372 model.testNbResults(Translation_63, 1)
373 model.testNbSubResults(Translation_63, [0])
374 model.testNbSubShapes(Translation_63, GeomAPI_Shape.SOLID, [0])
375 model.testNbSubShapes(Translation_63, GeomAPI_Shape.FACE, [0])
376 model.testNbSubShapes(Translation_63, GeomAPI_Shape.WIRE, [1])
377 model.testHaveNamingFaces(Translation_63, model, Part_1_doc)
378
379 model.testNbResults(Translation_64, 1)
380 model.testNbSubResults(Translation_64, [0])
381 model.testNbSubShapes(Translation_64, GeomAPI_Shape.SOLID, [0])
382 model.testNbSubShapes(Translation_64, GeomAPI_Shape.FACE, [0])
383 model.testNbSubShapes(Translation_64, GeomAPI_Shape.WIRE, [1])
384 model.testHaveNamingFaces(Translation_64, model, Part_1_doc)
385
386 model.testNbResults(Translation_65, 1)
387 model.testNbSubResults(Translation_65, [0])
388 model.testNbSubShapes(Translation_65, GeomAPI_Shape.SOLID, [0])
389 model.testNbSubShapes(Translation_65, GeomAPI_Shape.FACE, [0])
390 model.testNbSubShapes(Translation_65, GeomAPI_Shape.WIRE, [1])
391 model.testHaveNamingFaces(Translation_65, model, Part_1_doc)
392
393 model.testNbResults(Translation_67, 1)
394 model.testNbSubResults(Translation_67, [0])
395 model.testNbSubShapes(Translation_67, GeomAPI_Shape.SOLID, [0])
396 model.testNbSubShapes(Translation_67, GeomAPI_Shape.FACE, [0])
397 model.testNbSubShapes(Translation_67, GeomAPI_Shape.WIRE, [1])
398 model.testHaveNamingFaces(Translation_67, model, Part_1_doc)
399
400 model.testNbResults(Translation_68, 1)
401 model.testNbSubResults(Translation_68, [0])
402 model.testNbSubShapes(Translation_68, GeomAPI_Shape.SOLID, [0])
403 model.testNbSubShapes(Translation_68, GeomAPI_Shape.FACE, [0])
404 model.testNbSubShapes(Translation_68, GeomAPI_Shape.WIRE, [1])
405 model.testHaveNamingFaces(Translation_68, model, Part_1_doc)
406
407 model.testNbResults(Translation_69, 1)
408 model.testNbSubResults(Translation_69, [0])
409 model.testNbSubShapes(Translation_69, GeomAPI_Shape.SOLID, [0])
410 model.testNbSubShapes(Translation_69, GeomAPI_Shape.FACE, [0])
411 model.testNbSubShapes(Translation_69, GeomAPI_Shape.WIRE, [1])
412 model.testHaveNamingFaces(Translation_69, model, Part_1_doc)
413
414 model.testNbResults(Translation_70, 1)
415 model.testNbSubResults(Translation_70, [0])
416 model.testNbSubShapes(Translation_70, GeomAPI_Shape.SOLID, [0])
417 model.testNbSubShapes(Translation_70, GeomAPI_Shape.FACE, [0])
418 model.testNbSubShapes(Translation_70, GeomAPI_Shape.WIRE, [1])
419 model.testHaveNamingFaces(Translation_70, model, Part_1_doc)
420
421 model.testNbResults(Translation_71, 1)
422 model.testNbSubResults(Translation_71, [0])
423 model.testNbSubShapes(Translation_71, GeomAPI_Shape.SOLID, [0])
424 model.testNbSubShapes(Translation_71, GeomAPI_Shape.FACE, [0])
425 model.testNbSubShapes(Translation_71, GeomAPI_Shape.WIRE, [1])
426 model.testHaveNamingFaces(Translation_71, model, Part_1_doc)
427
428 model.testNbResults(Translation_72, 1)
429 model.testNbSubResults(Translation_72, [0])
430 model.testNbSubShapes(Translation_72, GeomAPI_Shape.SOLID, [0])
431 model.testNbSubShapes(Translation_72, GeomAPI_Shape.FACE, [1])
432 model.testHaveNamingFaces(Translation_72, model, Part_1_doc)
433
434 model.testNbResults(Translation_73, 1)
435 model.testNbSubResults(Translation_73, [0])
436 model.testNbSubShapes(Translation_73, GeomAPI_Shape.SOLID, [0])
437 model.testNbSubShapes(Translation_73, GeomAPI_Shape.FACE, [1])
438 model.testHaveNamingFaces(Translation_73, model, Part_1_doc)
439
440 model.testNbResults(Translation_74, 1)
441 model.testNbSubResults(Translation_74, [0])
442 model.testNbSubShapes(Translation_74, GeomAPI_Shape.SOLID, [0])
443 model.testNbSubShapes(Translation_74, GeomAPI_Shape.FACE, [1])
444 model.testHaveNamingFaces(Translation_74, model, Part_1_doc)
445
446 model.testNbResults(Translation_76, 1)
447 model.testNbSubResults(Translation_76, [0])
448 model.testNbSubShapes(Translation_76, GeomAPI_Shape.SOLID, [0])
449 model.testNbSubShapes(Translation_76, GeomAPI_Shape.FACE, [1])
450 model.testHaveNamingFaces(Translation_76, model, Part_1_doc)
451
452 model.testNbResults(Translation_77, 1)
453 model.testNbSubResults(Translation_77, [0])
454 model.testNbSubShapes(Translation_77, GeomAPI_Shape.SOLID, [0])
455 model.testNbSubShapes(Translation_77, GeomAPI_Shape.FACE, [1])
456 model.testHaveNamingFaces(Translation_77, model, Part_1_doc)
457
458 model.testNbResults(Translation_78, 1)
459 model.testNbSubResults(Translation_78, [0])
460 model.testNbSubShapes(Translation_78, GeomAPI_Shape.SOLID, [0])
461 model.testNbSubShapes(Translation_78, GeomAPI_Shape.FACE, [1])
462 model.testHaveNamingFaces(Translation_78, model, Part_1_doc)
463
464 model.testNbResults(Translation_79, 1)
465 model.testNbSubResults(Translation_79, [0])
466 model.testNbSubShapes(Translation_79, GeomAPI_Shape.SOLID, [0])
467 model.testNbSubShapes(Translation_79, GeomAPI_Shape.FACE, [1])
468 model.testHaveNamingFaces(Translation_79, model, Part_1_doc)
469
470 model.testNbResults(Translation_80, 1)
471 model.testNbSubResults(Translation_80, [0])
472 model.testNbSubShapes(Translation_80, GeomAPI_Shape.SOLID, [0])
473 model.testNbSubShapes(Translation_80, GeomAPI_Shape.FACE, [1])
474 model.testHaveNamingFaces(Translation_80, model, Part_1_doc)
475
476 model.testNbResults(Translation_81, 1)
477 model.testNbSubResults(Translation_81, [0])
478 model.testNbSubShapes(Translation_81, GeomAPI_Shape.SOLID, [0])
479 model.testNbSubShapes(Translation_81, GeomAPI_Shape.FACE, [2])
480 model.testNbSubShapes(Translation_81, GeomAPI_Shape.SHELL, [1])
481
482 model.testNbResults(Translation_82, 1)
483 model.testNbSubResults(Translation_82, [0])
484 model.testNbSubShapes(Translation_82, GeomAPI_Shape.SOLID, [0])
485 model.testNbSubShapes(Translation_82, GeomAPI_Shape.FACE, [2])
486 model.testNbSubShapes(Translation_82, GeomAPI_Shape.SHELL, [1])
487
488 model.testNbResults(Translation_83, 1)
489 model.testNbSubResults(Translation_83, [0])
490 model.testNbSubShapes(Translation_83, GeomAPI_Shape.SOLID, [0])
491 model.testNbSubShapes(Translation_83, GeomAPI_Shape.FACE, [2])
492 model.testNbSubShapes(Translation_83, GeomAPI_Shape.SHELL, [1])
493
494 model.testNbResults(Translation_85, 1)
495 model.testNbSubResults(Translation_85, [0])
496 model.testNbSubShapes(Translation_85, GeomAPI_Shape.SOLID, [0])
497 model.testNbSubShapes(Translation_85, GeomAPI_Shape.FACE, [2])
498 model.testNbSubShapes(Translation_85, GeomAPI_Shape.SHELL, [1])
499
500 model.testNbResults(Translation_86, 1)
501 model.testNbSubResults(Translation_86, [0])
502 model.testNbSubShapes(Translation_86, GeomAPI_Shape.SOLID, [0])
503 model.testNbSubShapes(Translation_86, GeomAPI_Shape.FACE, [2])
504 model.testNbSubShapes(Translation_86, GeomAPI_Shape.SHELL, [1])
505
506 model.testNbResults(Translation_87, 1)
507 model.testNbSubResults(Translation_87, [0])
508 model.testNbSubShapes(Translation_87, GeomAPI_Shape.SOLID, [0])
509 model.testNbSubShapes(Translation_87, GeomAPI_Shape.FACE, [2])
510 model.testNbSubShapes(Translation_87, GeomAPI_Shape.SHELL, [1])
511
512 model.testNbResults(Translation_88, 1)
513 model.testNbSubResults(Translation_88, [0])
514 model.testNbSubShapes(Translation_88, GeomAPI_Shape.SOLID, [0])
515 model.testNbSubShapes(Translation_88, GeomAPI_Shape.FACE, [2])
516 model.testNbSubShapes(Translation_88, GeomAPI_Shape.SHELL, [1])
517
518 model.testNbResults(Translation_89, 1)
519 model.testNbSubResults(Translation_89, [0])
520 model.testNbSubShapes(Translation_89, GeomAPI_Shape.SOLID, [0])
521 model.testNbSubShapes(Translation_89, GeomAPI_Shape.FACE, [2])
522 model.testNbSubShapes(Translation_89, GeomAPI_Shape.SHELL, [1])
523
524 model.testNbResults(Translation_90, 2)
525 model.testNbSubResults(Translation_90, [0, 0])
526 model.testNbSubShapes(Translation_90, GeomAPI_Shape.SOLID, [1, 1])
527 model.testNbSubShapes(Translation_90, GeomAPI_Shape.FACE, [6, 3])
528 model.testHaveNamingFaces(Translation_90, model, Part_1_doc)
529
530
531 model.testNbResults(Translation_48, 0)
532 assert(Translation_48.feature().error() == 'Attribute "axis_object" is not initialized.')
533
534 model.testNbResults(Translation_57, 0)
535 assert(Translation_57.feature().error() == 'Attribute "axis_object" is not initialized.')
536
537 model.testNbResults(Translation_66, 0)
538 assert(Translation_66.feature().error() == 'Attribute "axis_object" is not initialized.')
539
540 model.testNbResults(Translation_75, 0)
541 assert(Translation_75.feature().error() == 'Attribute "axis_object" is not initialized.')
542
543 model.testNbResults(Translation_84, 0)
544 assert(Translation_84.feature().error() == 'Attribute "axis_object" is not initialized.')