Salome HOME
f5ce125b4120318b538e3e3521e5605d93f3dcd2
[modules/shaper.git] / src / FeaturesPlugin / doc / examples / union.py
1 # -*- coding: utf-8 -*-
2
3 from salome.shaper import model
4
5 model.begin()
6 partSet = model.moduleDocument()
7 Part_1 = model.addPart(partSet)
8 Part_1_doc = Part_1.document()
9 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
10 SketchLine_1 = Sketch_1.addLine(71, -15, -32, -15)
11 SketchLine_2 = Sketch_1.addLine(-32, -15, -32, -56)
12 SketchLine_3 = Sketch_1.addLine(-32, -56, 71, -56)
13 SketchLine_4 = Sketch_1.addLine(71, -56, 71, -15)
14 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
15 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
16 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
17 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
18 SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
19 SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
20 SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
21 SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
22 SketchLine_5 = Sketch_1.addLine(3, -15, 36, -56)
23 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_1.result())
24 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_3.result())
25 model.do()
26 Extrusion_1 = model.addExtrusion(Part_1_doc,
27                                  [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_5r"),
28                                   model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f")],
29                                  model.selection(), 10, 0)
30 Union_1 = model.addUnion(Part_1_doc,
31                          [model.selection("SOLID", "Extrusion_1_1_1"),
32                           model.selection("SOLID", "Extrusion_1_1_2")])
33 model.do()
34 model.end()