1 from SketchAPI import *
3 from salome.shaper import model
6 partSet = model.moduleDocument()
7 Part_1 = model.addPart(partSet)
8 Part_1_doc = Part_1.document()
9 model.addParameter(Part_1_doc, "R", "40")
10 model.addParameter(Part_1_doc, "h", "3")
11 model.addParameter(Part_1_doc, "R2", "33.5")
12 model.addParameter(Part_1_doc, "h2", "4")
13 model.addParameter(Part_1_doc, "R3", "25.9")
14 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
15 SketchCircle_1 = Sketch_1.addCircle(0, 0, 40)
16 SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin"))
17 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchPoint_1.result())
18 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], "R")
19 SketchLine_1 = Sketch_1.addLine(0, 0, -20.88093073029438, 34.1172497695333)
20 SketchLine_1.setAuxiliary(True)
21 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_1.startPoint())
22 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_1.startPoint())
23 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1])
25 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "h", 0)
26 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
27 SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
28 SketchLine_2 = SketchProjection_1.createdFeature()
29 SketchCircle_2 = Sketch_2.addCircle(0, 0, 33.5)
30 SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_2.results()[1], "R2")
31 SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchCircle_2.center())
32 SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_14")
34 Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], model.selection(), "h2", 0)
35 Extrusion_3 = model.addExtrusion(Part_1_doc, [], model.selection(), "h2*3", 0)
36 Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/To_Face_1"))
37 SketchCircle_3 = Sketch_3.addCircle(0, 0, 28.25)
38 SketchConstraintRadius_3 = Sketch_3.setRadius(SketchCircle_3.results()[1], 28.25)
39 SketchProjection_2 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
40 SketchLine_3 = SketchProjection_2.createdFeature()
41 SketchConstraintCoincidence_6 = Sketch_3.setCoincident(SketchCircle_3.center(), SketchAPI_Line(SketchLine_3).startPoint())
42 Extrusion_3.setNestedSketch(Sketch_3)
43 Extrusion_4 = model.addExtrusion(Part_1_doc, [], model.selection(), "h2", 0)
44 Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_3_1/To_Face_1"))
45 SketchProjection_3 = Sketch_4.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
46 SketchLine_4 = SketchProjection_3.createdFeature()
47 SketchCircle_4 = Sketch_4.addCircle(0, 0, 25.9)
48 SketchConstraintRadius_4 = Sketch_4.setRadius(SketchCircle_4.results()[1], "R3")
49 SketchConstraintCoincidence_7 = Sketch_4.setCoincident(SketchAPI_Line(SketchLine_4).startPoint(), SketchCircle_4.center())
50 SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_15")
51 Extrusion_4.setNestedSketch(Sketch_4)
52 Extrusion_5 = model.addExtrusion(Part_1_doc, [], model.selection(), "h2", 0)
53 Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_4_1/To_Face_1"))
54 SketchProjection_4 = Sketch_5.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
55 SketchLine_5 = SketchProjection_4.createdFeature()
56 SketchCircle_5 = Sketch_5.addCircle(0, 0, 8)
57 SketchConstraintRadius_5 = Sketch_5.setRadius(SketchCircle_5.results()[1], 8)
58 SketchConstraintCoincidence_8 = Sketch_5.setCoincident(SketchAPI_Line(SketchLine_5).startPoint(), SketchCircle_5.center())
59 SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_16")
60 Extrusion_5.setNestedSketch(Sketch_5)
61 Boolean_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_4_1"), model.selection("SOLID", "Extrusion_5_1"), model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_3_1")], [])
62 ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), model.selection("FACE", "Extrusion_5_1/To_Face_1"), 0, model.selection(), 0, [model.selection("SOLID", "Boolean_1_1")])
63 Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/From_Face_1"))
64 SketchCircle_6 = Sketch_6.addCircle(0, 0, 4.2)
65 SketchConstraintRadius_6 = Sketch_6.setRadius(SketchCircle_6.results()[1], 4.2)
66 SketchPoint_2 = Sketch_6.addPoint(model.selection("VERTEX", "PartSet/Origin"))
67 SketchConstraintCoincidence_9 = Sketch_6.setCoincident(SketchPoint_2.coordinates(), SketchCircle_6.center())
68 SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_17")
69 ExtrusionCut_1.setNestedSketch(Sketch_6)
70 Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modfied_1"))
71 SketchCircle_7 = Sketch_7.addCircle(0, -85, 66)
72 SketchLine_6 = Sketch_7.addLine(model.selection("EDGE", "PartSet/OY"))
73 SketchConstraintCoincidence_10 = Sketch_7.setCoincident(SketchCircle_7.center(), SketchLine_6.result())
74 SketchConstraintRadius_7 = Sketch_7.setRadius(SketchCircle_7.results()[1], 66)
75 SketchConstraintDistance_1 = Sketch_7.setDistance(SketchCircle_7.center(), SketchLine_6.startPoint(), 85)
76 SketchMultiRotation_1 = Sketch_7.addRotation([SketchCircle_7.results()[1]], SketchLine_6.startPoint(), 120, 3)
77 [SketchCircle_8, SketchCircle_9] = SketchMultiRotation_1.rotated()
79 ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_7")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modfied_2"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
80 Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_2_1/Modfied_22"))
81 SketchLine_7 = Sketch_8.addLine(-2.320957096353877e-016, 11.00000001704673, -7, 11.00000001704673)
82 SketchConstraintHorizontal_1 = Sketch_8.setHorizontal(SketchLine_7.result())
83 SketchLine_8 = Sketch_8.addLine(-7, 11.00000001704673, -6.329882773485103e-016, 30.00000001704673)
84 SketchConstraintCoincidence_11 = Sketch_8.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
85 SketchLine_9 = Sketch_8.addLine(model.selection("EDGE", "PartSet/OY"))
86 SketchConstraintCoincidence_12 = Sketch_8.setCoincident(SketchLine_7.startPoint(), SketchLine_9.result())
87 SketchConstraintCoincidence_13 = Sketch_8.setCoincident(SketchLine_8.endPoint(), SketchLine_9.result())
88 SketchConstraintMirror_1 = Sketch_8.addMirror(SketchLine_9.result(), [SketchLine_7.result(), SketchLine_8.result()])
89 [SketchLine_10, SketchLine_11] = SketchConstraintMirror_1.mirrored()
90 SketchConstraintLength_1 = Sketch_8.setLength(SketchLine_7.result(), 7)
91 SketchConstraintDistance_2 = Sketch_8.setDistance(SketchLine_9.startPoint(), SketchLine_7.result(), 11)
92 SketchConstraintDistance_3 = Sketch_8.setDistance(SketchLine_8.endPoint(), SketchLine_9.startPoint(), 30)
93 SketchMultiRotation_2_objects = [SketchLine_11.result(), SketchLine_10.result(), SketchLine_8.result(), SketchLine_7.result()]
94 SketchMultiRotation_2 = Sketch_8.addRotation(SketchMultiRotation_2_objects, SketchLine_9.startPoint(), 120, 3)
95 [SketchLine_11, SketchLine_12, SketchLine_13, SketchLine_10, SketchLine_14, SketchLine_15, SketchLine_16, SketchLine_17, SketchLine_18, SketchLine_19] = SketchMultiRotation_2.rotated()
96 SketchLine_18.setName("SketchLine_15")
97 SketchLine_18.result().setName("SketchLine_15")
98 SketchLine_17.setName("SketchLine_18")
99 SketchLine_17.result().setName("SketchLine_18")
100 SketchLine_16.setName("SketchLine_14")
101 SketchLine_16.result().setName("SketchLine_14")
102 SketchLine_15.setName("SketchLine_17")
103 SketchLine_15.result().setName("SketchLine_17")
104 SketchLine_14.setName("SketchLine_13")
105 SketchLine_14.result().setName("SketchLine_13")
106 SketchLine_13.setName("SketchLine_16")
107 SketchLine_13.result().setName("SketchLine_16")
109 ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_8/Face-SketchLine_7r-SketchLine_8r-SketchLine_10f-SketchLine_11f"), model.selection("FACE", "Sketch_8/Face-SketchLine_16f-SketchLine_17f-SketchLine_18r-SketchLine_19r"), model.selection("FACE", "Sketch_8/Face-SketchLine_12f-SketchLine_13f-SketchLine_14r-SketchLine_15r")], model.selection(), model.selection("FACE", "ExtrusionCut_2_1/Modfied_23"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
112 model.testNbResults(ExtrusionCut_3, 1)
113 model.testNbSubResults(ExtrusionCut_3, [0])
114 model.testResultsVolumes(ExtrusionCut_3, [34439.077343526856566313654184341])