Salome HOME
Issue #2833: Update example scripts
[modules/shaper.git] / src / FeaturesPlugin / doc / examples / fuse_faces.py
1 # -*- coding: utf-8 -*-
2
3 from SketchAPI import *
4
5 from salome.shaper import model
6
7 model.begin()
8 partSet = model.moduleDocument()
9 Part_1 = model.addPart(partSet)
10 Part_1_doc = Part_1.document()
11 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
12 SketchLine_1 = Sketch_1.addLine(0, 75.67806267806267, 34.24216524216526, 75.67806267806267)
13 SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
14 SketchLine_2 = SketchProjection_1.createdFeature()
15 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result())
16 SketchLine_3 = Sketch_1.addLine(34.24216524216526, 75.67806267806267, 34.24216524216526, 46.03988603988604)
17 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint())
18 SketchLine_4 = Sketch_1.addLine(34.24216524216526, 46.03988603988604, 63.30484330484332, 46.03988603988604)
19 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
20 SketchLine_5 = Sketch_1.addLine(63.30484330484332, 46.03988603988604, 63.30484330484332, -2.775557561562891e-17)
21 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
22 SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
23 SketchLine_6 = SketchProjection_2.createdFeature()
24 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.result())
25 SketchLine_7 = Sketch_1.addLine(63.30484330484332, -2.775557561562891e-17, 0, 0)
26 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_7.startPoint())
27 SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_7.endPoint())
28 SketchLine_8 = Sketch_1.addLine(0, 75.67806267806267, 0, 0)
29 SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_8.startPoint())
30 SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_8.endPoint())
31 SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result())
32 SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result())
33 SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
34 SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_4.result())
35 model.do()
36 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_8f-SketchLine_7r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_1r_wire")], model.selection(), 50, 0)
37 Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection(), 0, 50)
38 Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1")])
39 FusionFaces_1 = model.addFusionFaces(Part_1_doc, model.selection("SOLID", "Fuse_1_1"))
40 model.do()
41 model.end()