2 # -*- coding: utf-8 -*-
3 """Géométrie de test pour la création de surfaces médianes - Cas n°2
6 __revision__ = "V02.01"
8 nom_objet = "meli-melo"
9 fichier = "midSurface_2.stp"
15 from SketchAPI import *
17 from salome.shaper import model
20 partSet = model.moduleDocument()
21 model.addParameter(partSet, "H", '24')
22 model.addParameter(partSet, "L", '36')
23 model.addParameter(partSet, "h", '2')
24 model.addParameter(partSet, "theta_1", '45')
25 model.addParameter(partSet, "C_x", '30')
26 model.addParameter(partSet, "DX", '90')
27 model.addParameter(partSet, "C_y", '40')
28 model.addParameter(partSet, "R_int", '50', 'Rayon interne')
29 model.addParameter(partSet, "R_ext", '51', 'Rayon externe')
30 model.addParameter(partSet, "R_1", '15')
31 model.addParameter(partSet, "R_2", '20')
32 model.addParameter(partSet, "R_3", '5')
33 model.addParameter(partSet, "theta_2", '60')
34 model.addParameter(partSet, "B_1", '6')
35 model.addParameter(partSet, "Ep", '0.5', 'Epaisseur')
36 model.addParameter(partSet, "Hauteur", '150.', 'Hauteur')
37 model.addParameter(partSet, "coeff", '0.00001', 'Coefficient')
39 # 1. Deux solides plans minces
40 #=============================
43 Part_1 = model.addPart(partSet)
44 Part_1_doc = Part_1.document()
47 Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
50 SketchLine_1 = Sketch_1.addLine(0, 0, 48, 0)
52 ### Create SketchProjection
53 SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
54 SketchPoint_1 = SketchProjection_1.createdFeature()
55 Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates())
58 SketchLine_2 = Sketch_1.addLine(48, 0, 103.7207793864215, 55.72077938642148)
59 Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
62 SketchLine_3 = Sketch_1.addLine(103.7207793864215, 55.72077938642148, 78.26493526370577, 81.17662350913719)
63 Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
66 SketchLine_4 = Sketch_1.addLine(78.26493526370577, 81.17662350913719, 0, 72)
67 Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
70 SketchLine_5 = Sketch_1.addLine(0, 72, 0, 0)
71 Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
72 Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.endPoint())
73 Sketch_1.setHorizontal(SketchLine_1.result())
74 Sketch_1.setVertical(SketchLine_5.result())
75 Sketch_1.setLength(SketchLine_5.result(), "2*L")
76 Sketch_1.setLength(SketchLine_1.result(), "2*H")
77 Sketch_1.setEqual(SketchLine_2.result(), SketchLine_4.result())
79 ### Create SketchProjection
80 SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
81 SketchLine_6 = SketchProjection_2.createdFeature()
83 ### Create SketchConstraintAngle
84 Sketch_1.setAngle(SketchLine_6.result(), SketchLine_2.result(), "theta_1", type = "Direct")
85 Sketch_1.setPerpendicular(SketchLine_2.result(), SketchLine_3.result())
86 Sketch_1.setLength(SketchLine_3.result(), "L")
89 SketchLine_7 = Sketch_1.addLine(0, 0, -96, 0)
90 Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_7.startPoint())
91 Sketch_1.setHorizontal(SketchLine_7.result())
92 Sketch_1.setLength(SketchLine_7.result(), "4*H")
95 SketchLine_8 = Sketch_1.addLine(-96, 4.800000000000001, -4.800000000000001, 4.800000000000001)
96 Sketch_1.setHorizontal(SketchLine_8.result())
99 SketchLine_9 = Sketch_1.addLine(-4.800000000000001, 4.800000000000001, -4.800000000000001, 72)
100 Sketch_1.setVertical(SketchLine_9.result())
101 Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
103 ### Create SketchLine
104 SketchLine_10 = Sketch_1.addLine(-4.800000000000001, 72, 0, 72)
105 Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
106 Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_10.endPoint())
107 Sketch_1.setLength(SketchLine_10.result(), "0.2*H")
108 Sketch_1.setHorizontal(SketchLine_10.result())
110 ### Create SketchLine
111 SketchLine_11 = Sketch_1.addLine(-96, 4.800000000000001, -96, 0)
112 Sketch_1.setCoincident(SketchLine_8.startPoint(), SketchLine_11.startPoint())
113 Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_11.endPoint())
114 Sketch_1.setVertical(SketchLine_11.result())
115 Sketch_1.setLength(SketchLine_11.result(), "0.2*H")
117 Sketch_1.setName("Objet_2_Sketch")
118 Sketch_1.result().setName("Objet_2_Sketch")
121 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Objet_2_Sketch")], model.selection(), "h", 0, "Faces|Wires")
122 Extrusion_1.setName("Objet_2")
123 Extrusion_1.result().setName("Objet_2")
124 Extrusion_1.result().subResult(0).setName("Extrusion_1_1_1")
125 Extrusion_1.result().subResult(1).setName("Extrusion_1_1_2")
129 # 2. Un cylindre découpé
130 #=======================
133 Part_2 = model.addPart(partSet)
134 Part_2_doc = Part_2.document()
137 Sketch_2 = model.addSketch(Part_2_doc, model.standardPlane("YOZ"))
139 ### Create SketchCircle
140 SketchCircle_1 = Sketch_2.addCircle(30, 40, 50)
141 Sketch_2.setRadius(SketchCircle_1.results()[1], "R_int")
143 ### Create SketchProjection
144 SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
145 SketchPoint_2 = SketchProjection_3.createdFeature()
146 Sketch_2.setHorizontalDistance(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_2).coordinates(), "C_x")
147 Sketch_2.setVerticalDistance(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_2).coordinates(), "C_y")
149 ### Create SketchCircle
150 SketchCircle_2 = Sketch_2.addCircle(30, 40, 51)
151 Sketch_2.setRadius(SketchCircle_2.results()[1], "R_ext")
152 Sketch_2.setCoincident(SketchCircle_2.center(), SketchCircle_1.center())
154 Sketch_2.setName("Objet_6_base_Sketch")
155 Sketch_2.result().setName("Objet_6_base_Sketch")
158 Extrusion_2 = model.addExtrusion(Part_2_doc, [model.selection("COMPOUND", "all-in-Objet_6_base_Sketch")], model.selection(), "DX", 0, "Faces|Wires")
159 Extrusion_2.setName("Objet_6_base_Extrusion")
160 Extrusion_2.result().setName("Objet_6_base_Extrusion")
161 Extrusion_2.result().subResult(0).setName("Objet_6_base_Extrusion_1")
162 Extrusion_2.result().subResult(1).setName("Objet_6_base_Extrusion_2")
164 ### Create Remove_SubShapes
165 Remove_SubShapes_1 = model.addRemoveSubShapes(Part_2_doc, model.selection("COMPSOLID", "Objet_6_base_Extrusion"))
166 Remove_SubShapes_1.setSubShapesToKeep([model.selection("SOLID", "Objet_6_base_Extrusion_2")])
167 Remove_SubShapes_1.setName("Objet_6_base_RemoveSubShapes")
168 Remove_SubShapes_1.result().setName("Objet_6_base")
170 ### Create Translation
171 Translation_1 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Objet_6_base")], vector = ["H", "L", "H+L"], keepSubResults = True)
172 Translation_1.setName("Objet_6_Translation")
173 Translation_1.result().setName("Objet_6_Translation")
176 Point_2 = model.addPoint(Part_2_doc, 0, 0, 0)
177 Point_2.setName("Objet_6_Point_1")
178 Point_2.result().setName("Objet_6_Point_1")
181 Point_3 = model.addPoint(Part_2_doc, 1, 2, 3)
182 Point_3.setName("Objet_6_Point_2")
183 Point_3.result().setName("Objet_6_Point_2")
186 Axis_4 = model.addAxis(Part_2_doc, model.selection("VERTEX", "Objet_6_Point_1"), model.selection("VERTEX", "Objet_6_Point_2"))
187 Axis_4.setName("Objet_6_Axe")
188 Axis_4.result().setName("Objet_6_Axe")
191 Rotation_1 = model.addRotation(Part_2_doc, [model.selection("SOLID", "Objet_6_Translation")], axis = model.selection("EDGE", "Objet_6_Axe"), angle = 30, keepSubResults = True)
192 Rotation_1.setName("Objet_6_Rotation")
193 Rotation_1.result().setName("Objet_6_Rotation")
196 Sketch_3 = model.addSketch(Part_2_doc, model.standardPlane("XOY"))
198 ### Create SketchLine
199 SketchLine_12 = Sketch_3.addLine(36, 120, 59.99999999999999, 78.43078061834694)
201 ### Create SketchLine
202 SketchLine_13 = Sketch_3.addLine(59.99999999999999, 78.43078061834694, 80.78460969082653, 90.43078061834694)
203 Sketch_3.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint())
205 ### Create SketchLine
206 SketchLine_14 = Sketch_3.addLine(80.78460969082653, 90.43078061834694, 104.7846096908265, 48.86156123669388)
207 Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint())
209 ### Create SketchLine
210 SketchLine_15 = Sketch_3.addLine(104.7846096908265, 48.86156123669388, 60.37400840781982, 30.64896961216652)
211 Sketch_3.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint())
213 ### Create SketchLine
214 SketchLine_16 = Sketch_3.addLine(60.37400840781982, 30.64896961216652, 36, 72)
215 Sketch_3.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint())
217 ### Create SketchLine
218 SketchLine_17 = Sketch_3.addLine(36, 72, 36, 120)
219 Sketch_3.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint())
220 Sketch_3.setCoincident(SketchLine_12.startPoint(), SketchLine_17.endPoint())
221 Sketch_3.setVertical(SketchLine_17.result())
222 Sketch_3.setEqual(SketchLine_17.result(), SketchLine_12.result())
223 Sketch_3.setEqual(SketchLine_12.result(), SketchLine_15.result())
224 Sketch_3.setPerpendicular(SketchLine_13.result(), SketchLine_14.result())
225 Sketch_3.setPerpendicular(SketchLine_13.result(), SketchLine_12.result())
226 Sketch_3.setEqual(SketchLine_14.result(), SketchLine_16.result())
228 ### Create SketchProjection
229 SketchProjection_4 = Sketch_3.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
230 SketchPoint_3 = SketchProjection_4.createdFeature()
231 Sketch_3.setHorizontalDistance(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_16.endPoint(), "L")
232 Sketch_3.setVerticalDistance(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_16.endPoint(), "2*L")
233 Sketch_3.setLength(SketchLine_14.result(), "2.*H")
234 Sketch_3.setLength(SketchLine_13.result(), "H")
236 ### Create SketchConstraintAngle
237 Sketch_3.setAngle(SketchLine_17.result(), SketchLine_12.result(), 30, type = "Direct")
238 Sketch_3.setLength(SketchLine_15.result(), "2.*H")
240 Sketch_3.setName("Objet_6_Sketch_bloc_a")
241 Sketch_3.result().setName("Objet_6_Sketch_bloc_a")
244 Extrusion_3 = model.addExtrusion(Part_2_doc, [model.selection("COMPOUND", "Objet_6_Sketch_bloc_a")], model.selection(), 200, 100, "Faces|Wires")
245 Extrusion_3.setName("Objet_6_a")
246 Extrusion_3.result().setName("Objet_6_a")
249 Common_1 = model.addCommon(Part_2_doc, [model.selection("SOLID", "Objet_6_Rotation"), model.selection("SOLID", "Objet_6_a")], keepSubResults = True)
250 Common_1.setName("Objet_6")
251 Common_1.result().setName("Objet_6")
252 Common_1.result().subResult(0).setName("Common_1_1_1")
253 Common_1.result().subResult(1).setName("Common_1_1_2")
254 Folder_1 = model.addFolder(Part_2_doc, Sketch_2, Extrusion_3)
255 Folder_1.setName("Objet_6_création")
263 Part_3 = model.addPart(partSet)
264 Part_3_doc = Part_3.document()
267 Torus_1 = model.addTorus(Part_3_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "R_2", "R_3")
268 Torus_1.setName("Objet_8_Tore_1")
269 Torus_1.result().setName("Objet_8_Tore_1")
272 Torus_2 = model.addTorus(Part_3_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "R_2", "R_3-h")
273 Torus_2.setName("Objet_8_Tore_2")
274 Torus_2.result().setName("Objet_8_Tore_2")
277 Cut_1 = model.addCut(Part_3_doc, [model.selection("SOLID", "Objet_8_Tore_1")], [model.selection("SOLID", "Objet_8_Tore_2")], keepSubResults = True)
278 Cut_1.setName("Objet_8_Cut")
279 Cut_1.result().setName("Objet_8_Cut")
282 Sketch_4 = model.addSketch(Part_3_doc, model.standardPlane("XOY"))
284 ### Create SketchLine
285 SketchLine_18 = Sketch_4.addLine(0, 33.9282032302755, 6, 33.9282032302755)
286 Sketch_4.setHorizontal(SketchLine_18.result())
288 ### Create SketchLine
289 SketchLine_19 = Sketch_4.addLine(6, 33.9282032302755, 6, 5)
290 Sketch_4.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint())
291 Sketch_4.setVertical(SketchLine_19.result())
293 ### Create SketchLine
294 SketchLine_20 = Sketch_4.addLine(6, 5, 31.05255888325765, -9.464101615137745)
295 Sketch_4.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint())
297 ### Create SketchLine
298 SketchLine_21 = Sketch_4.addLine(31.05255888325765, -9.464101615137745, 25.05255888325765, -19.85640646055101)
299 Sketch_4.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint())
301 ### Create SketchLine
302 SketchLine_22 = Sketch_4.addLine(25.05255888325765, -19.85640646055101, 6, -8.856406460550954)
303 Sketch_4.setCoincident(SketchLine_21.endPoint(), SketchLine_22.startPoint())
305 ### Create SketchLine
306 SketchLine_23 = Sketch_4.addLine(6, -8.856406460550954, 6, -28.8564064605506)
307 Sketch_4.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint())
308 Sketch_4.setVertical(SketchLine_23.result())
310 ### Create SketchLine
311 SketchLine_24 = Sketch_4.addLine(6, -28.8564064605506, 0, -28.8564064605506)
312 Sketch_4.setCoincident(SketchLine_23.endPoint(), SketchLine_24.startPoint())
313 Sketch_4.setHorizontal(SketchLine_24.result())
315 ### Create SketchProjection
316 SketchProjection_5 = Sketch_4.addProjection(model.selection("EDGE", "PartSet/OY"), False)
317 SketchLine_25 = SketchProjection_5.createdFeature()
318 Sketch_4.setCoincident(SketchLine_18.startPoint(), SketchLine_25.result())
319 Sketch_4.setCoincident(SketchLine_24.endPoint(), SketchLine_25.result())
320 Sketch_4.setEqual(SketchLine_18.result(), SketchLine_24.result())
321 Sketch_4.setPerpendicular(SketchLine_20.result(), SketchLine_21.result())
322 Sketch_4.setPerpendicular(SketchLine_22.result(), SketchLine_21.result())
324 ### Create SketchConstraintAngle
325 Sketch_4.setAngle(SketchLine_23.result(), SketchLine_22.result(), "theta_2", type = "Direct")
326 Sketch_4.setLength(SketchLine_18.result(), "B_1")
327 Sketch_4.setLength(SketchLine_21.result(), "2.*B_1")
329 ### Create SketchProjection
330 SketchProjection_6 = Sketch_4.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
331 SketchPoint_4 = SketchProjection_6.createdFeature()
332 Sketch_4.setVerticalDistance(SketchLine_20.startPoint(), SketchAPI_Point(SketchPoint_4).coordinates(), "R_2/4.")
333 Sketch_4.setLength(SketchLine_22.result(), "1.1*R_2")
334 Sketch_4.setLength(SketchLine_23.result(), "R_2")
335 Sketch_4.setEqual(SketchLine_20.result(), SketchLine_19.result())
337 ### Create SketchConstraintMirror
338 SketchConstraintMirror_1_objects = [SketchLine_24.result(), SketchLine_23.result(), SketchLine_18.result(), SketchLine_19.result(), SketchLine_21.result(), SketchLine_20.result(), SketchLine_22.result()]
339 SketchConstraintMirror_1 = Sketch_4.addMirror(SketchLine_25.result(), SketchConstraintMirror_1_objects)
340 [SketchLine_26, SketchLine_27, SketchLine_28, SketchLine_29, SketchLine_30, SketchLine_31, SketchLine_32] = SketchConstraintMirror_1.mirrored()
342 Sketch_4.setName("Objet_8_Sketch_bloc_b")
343 Sketch_4.result().setName("Objet_8_Sketch_bloc_b")
346 Extrusion_4 = model.addExtrusion(Part_3_doc, [model.selection("COMPOUND", "Objet_8_Sketch_bloc_b")], model.selection(), "4.*R_3", "4.*R_3", "Faces|Wires")
347 Extrusion_4.setName("Objet_8_b")
348 Extrusion_4.result().setName("Objet_8_b")
351 Common_2 = model.addCommon(Part_3_doc, [model.selection("SOLID", "Objet_8_Cut"), model.selection("SOLID", "Objet_8_b")], keepSubResults = True)
352 Common_2.setName("Objet_8_Common")
353 Common_2.result().setName("Objet_8_Common")
354 Common_2.result().subResult(0).setName("Common_1_1_1")
355 Common_2.result().subResult(1).setName("Common_1_1_2")
356 Common_2.result().subResult(2).setName("Common_1_1_3")
357 Common_2.result().subResult(3).setName("Common_1_1_4")
360 Point_4 = model.addPoint(Part_3_doc, -1, -2, -3)
361 Point_4.setName("Objet_8_Point_1")
362 Point_4.result().setName("Objet_8_Point_1")
365 Point_5 = model.addPoint(Part_3_doc, 20, 30, 15)
366 Point_5.setName("Objet_8_Point_2")
367 Point_5.result().setName("Objet_8_Point_2")
370 Axis_5 = model.addAxis(Part_3_doc, model.selection("VERTEX", "Objet_8_Point_1"), model.selection("VERTEX", "Objet_8_Point_2"))
371 Axis_5.setName("Objet_8_Axe")
372 Axis_5.result().setName("Objet_8_Axe")
375 Rotation_2 = model.addRotation(Part_3_doc, [model.selection("COMPOUND", "Objet_8_Common")], axis = model.selection("EDGE", "Objet_8_Axe"), angle = 45, keepSubResults = True)
376 Rotation_2.setName("Objet_8")
377 Rotation_2.result().setName("Objet_8")
378 Rotation_2.result().subResult(0).setName("Rotation_1_1_1")
379 Rotation_2.result().subResult(1).setName("Rotation_1_1_2")
380 Rotation_2.result().subResult(2).setName("Rotation_1_1_3")
381 Rotation_2.result().subResult(3).setName("Rotation_1_1_4")
382 Folder_2 = model.addFolder(Part_3_doc, Torus_1, Axis_5)
383 Folder_2.setName("Objet_8_création")
391 Part_4 = model.addPart(partSet)
392 Part_4_doc = Part_4.document()
395 Cone_1 = model.addCone(Part_4_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "R_2", "R_3", "DX")
396 Cone_1.setName("Objet_9_Cone_1")
397 Cone_1.result().setName("Objet_9_Cone_1")
400 Cone_2 = model.addCone(Part_4_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "R_2-h", "R_3-h", "DX")
401 Cone_2.setName("Objet_9_Cone_2")
402 Cone_2.result().setName("Objet_9_Cone_2")
405 Cut_2 = model.addCut(Part_4_doc, [model.selection("SOLID", "Objet_9_Cone_1")], [model.selection("SOLID", "Objet_9_Cone_2")], keepSubResults = True)
406 Cut_2.setName("Objet_9_Cut")
407 Cut_2.result().setName("Objet_9_Cut")
410 Sketch_5 = model.addSketch(Part_4_doc, model.standardPlane("XOY"))
412 ### Create SketchLine
413 SketchLine_33 = Sketch_5.addLine(0, 33.9282032302755, 6, 33.9282032302755)
414 Sketch_5.setHorizontal(SketchLine_33.result())
416 ### Create SketchLine
417 SketchLine_34 = Sketch_5.addLine(6, 33.9282032302755, 6, 5)
418 Sketch_5.setCoincident(SketchLine_33.endPoint(), SketchLine_34.startPoint())
419 Sketch_5.setVertical(SketchLine_34.result())
421 ### Create SketchLine
422 SketchLine_35 = Sketch_5.addLine(6, 5, 31.05255888325765, -9.464101615137745)
423 Sketch_5.setCoincident(SketchLine_34.endPoint(), SketchLine_35.startPoint())
425 ### Create SketchLine
426 SketchLine_36 = Sketch_5.addLine(31.05255888325765, -9.464101615137745, 25.05255888325765, -19.85640646055101)
427 Sketch_5.setCoincident(SketchLine_35.endPoint(), SketchLine_36.startPoint())
429 ### Create SketchLine
430 SketchLine_37 = Sketch_5.addLine(25.05255888325765, -19.85640646055101, 6, -8.856406460550954)
431 Sketch_5.setCoincident(SketchLine_36.endPoint(), SketchLine_37.startPoint())
433 ### Create SketchLine
434 SketchLine_38 = Sketch_5.addLine(6, -8.856406460550954, 6, -28.8564064605506)
435 Sketch_5.setCoincident(SketchLine_37.endPoint(), SketchLine_38.startPoint())
436 Sketch_5.setVertical(SketchLine_38.result())
438 ### Create SketchLine
439 SketchLine_39 = Sketch_5.addLine(6, -28.8564064605506, 0, -28.8564064605506)
440 Sketch_5.setCoincident(SketchLine_38.endPoint(), SketchLine_39.startPoint())
441 Sketch_5.setHorizontal(SketchLine_39.result())
443 ### Create SketchProjection
444 SketchProjection_7 = Sketch_5.addProjection(model.selection("EDGE", "PartSet/OY"), False)
445 SketchLine_40 = SketchProjection_7.createdFeature()
446 Sketch_5.setCoincident(SketchLine_33.startPoint(), SketchLine_40.result())
447 Sketch_5.setCoincident(SketchLine_39.endPoint(), SketchLine_40.result())
448 Sketch_5.setEqual(SketchLine_33.result(), SketchLine_39.result())
449 Sketch_5.setPerpendicular(SketchLine_35.result(), SketchLine_36.result())
450 Sketch_5.setPerpendicular(SketchLine_37.result(), SketchLine_36.result())
452 ### Create SketchConstraintAngle
453 Sketch_5.setAngle(SketchLine_38.result(), SketchLine_37.result(), "theta_2", type = "Direct")
454 Sketch_5.setLength(SketchLine_33.result(), "B_1")
455 Sketch_5.setLength(SketchLine_36.result(), "2.*B_1")
457 ### Create SketchProjection
458 SketchProjection_8 = Sketch_5.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
459 SketchPoint_5 = SketchProjection_8.createdFeature()
460 Sketch_5.setVerticalDistance(SketchLine_35.startPoint(), SketchAPI_Point(SketchPoint_5).coordinates(), "R_2/4.")
461 Sketch_5.setLength(SketchLine_37.result(), "1.1*R_2")
462 Sketch_5.setLength(SketchLine_38.result(), "R_2")
463 Sketch_5.setEqual(SketchLine_35.result(), SketchLine_34.result())
465 ### Create SketchConstraintMirror
466 SketchConstraintMirror_2_objects = [SketchLine_39.result(), SketchLine_38.result(), SketchLine_33.result(), SketchLine_34.result(), SketchLine_36.result(), SketchLine_35.result(), SketchLine_37.result()]
467 SketchConstraintMirror_2 = Sketch_5.addMirror(SketchLine_40.result(), SketchConstraintMirror_2_objects)
468 [SketchLine_41, SketchLine_42, SketchLine_43, SketchLine_44, SketchLine_45, SketchLine_46, SketchLine_47] = SketchConstraintMirror_2.mirrored()
470 Sketch_5.setName("Objet_9_Sketch_bloc_b")
471 Sketch_5.result().setName("Objet_9_Sketch_bloc_b")
474 Extrusion_5 = model.addExtrusion(Part_4_doc, [model.selection("COMPOUND", "Objet_9_Sketch_bloc_b")], model.selection(), "4.*R_3", "4.*R_3", "Faces|Wires")
475 Extrusion_5.setName("Objet_9_b")
476 Extrusion_5.result().setName("Objet_9_b")
479 Rotation_3 = model.addRotation(Part_4_doc, [model.selection("SOLID", "Objet_9_b")], axis = model.selection("EDGE", "PartSet/OX"), angle = 10, keepSubResults = True)
480 Rotation_3.setName("Objet_9_b_1")
481 Rotation_3.result().setName("Objet_9_b_1")
484 Common_3 = model.addCommon(Part_4_doc, [model.selection("SOLID", "Objet_9_Cut"), model.selection("SOLID", "Objet_9_b_1")], keepSubResults = True)
485 Common_3.setName("Objet_9_Common")
486 Common_3.result().setName("Objet_9_Common")
487 Common_3.result().subResult(0).setName("Common_1_1_1")
488 Common_3.result().subResult(1).setName("Common_1_1_2")
489 Common_3.result().subResult(2).setName("Common_1_1_3")
490 Common_3.result().subResult(3).setName("Common_1_1_4")
492 ### Create Translation
493 Translation_2 = model.addTranslation(Part_4_doc, [model.selection("COMPOUND", "all-in-Objet_9_Common")], axis = model.selection("EDGE", "PartSet/OZ"), distance = "-2*R_2", keepSubResults = True)
494 Translation_2.setName("Objet_9_Common")
495 Translation_2.result().setName("Objet_9_Common")
496 Translation_2.result().subResult(0).setName("Translation_1_1_1")
497 Translation_2.result().subResult(0).subResult(0).setName("Translation_1_1_1_1")
498 Translation_2.result().subResult(0).subResult(1).setName("Translation_1_1_1_2")
499 Translation_2.result().subResult(0).subResult(2).setName("Translation_1_1_1_3")
500 Translation_2.result().subResult(0).subResult(3).setName("Translation_1_1_1_4")
503 Point_6 = model.addPoint(Part_4_doc, -1, -2, -3)
504 Point_6.setName("Objet_9_Point_1")
505 Point_6.result().setName("Objet_9_Point_1")
508 Point_7 = model.addPoint(Part_4_doc, 20, 30, 15)
509 Point_7.setName("Objet_9_Point_2")
510 Point_7.result().setName("Objet_9_Point_2")
513 Axis_6 = model.addAxis(Part_4_doc, model.selection("VERTEX", "Objet_9_Point_1"), model.selection("VERTEX", "Objet_9_Point_2"))
514 Axis_6.setName("Objet_9_Axe")
515 Axis_6.result().setName("Objet_9_Axe")
518 Rotation_4 = model.addRotation(Part_4_doc, [model.selection("COMPOUND", "Objet_9_Common")], axis = model.selection("EDGE", "Objet_9_Axe"), angle = 45, keepSubResults = True)
519 Rotation_4.setName("Objet_9")
520 Rotation_4.result().setName("Objet_9")
521 Rotation_4.result().subResult(0).setName("Rotation_2_1_1")
522 Rotation_4.result().subResult(0).subResult(0).setName("Rotation_2_1_1_1")
523 Rotation_4.result().subResult(0).subResult(1).setName("Rotation_2_1_1_2")
524 Rotation_4.result().subResult(0).subResult(2).setName("Rotation_2_1_1_3")
525 Rotation_4.result().subResult(0).subResult(3).setName("Rotation_2_1_1_4")
526 Folder_3 = model.addFolder(Part_4_doc, Cone_1, Axis_6)
527 Folder_3.setName("Objet_9_création")
531 # 5. Assemblage des composants
532 #=============================
535 Part_5 = model.addPart(partSet)
536 Part_5_doc = Part_5.document()
538 ### Create ImportResult
539 ImportResult_1_objects = [model.selection("COMPOUND", "Part_4/Objet_9"),
540 model.selection("COMPOUND", "Part_3/Objet_8"),
541 model.selection("COMPOUND", "Part_2/Objet_6"),
542 model.selection("COMPSOLID", "Part_1/Objet_2")]
543 ImportResult_1 = model.addImportResult(Part_5_doc, ImportResult_1_objects)
546 Partition_1_objects = [model.selection("COMPOUND", "ImportResult_1_1"),
547 model.selection("COMPOUND", "ImportResult_1_2"),
548 model.selection("COMPOUND", "ImportResult_1_3"),
549 model.selection("COMPSOLID", "ImportResult_1_4")]
550 Partition_1 = model.addPartition(Part_5_doc, Partition_1_objects, keepSubResults = True)
551 Partition_1.result().setName(nom_objet)
554 print ("Exportation dans {}".format(fichier))
555 export = model.exportToFile(Part_5_doc, fichier, [model.selection("COMPSOLID", nom_objet)])
559 if salome.sg.hasDesktop():
560 salome.sg.updateObjBrowser()