]> SALOME platform Git repositories - modules/shaper.git/blob - test.models/idler_plate.py
Salome HOME
Issue #3221: Visual separation for features
[modules/shaper.git] / test.models / idler_plate.py
1 # Copyright (C) 2014-2020  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 from salome.shaper import model
21
22 model.begin()
23 partSet = model.moduleDocument()
24 Part_1 = model.addPart(partSet)
25 Part_1_doc = Part_1.document()
26 model.addParameter(Part_1_doc, "ob1", "4.37")
27 model.addParameter(Part_1_doc, "ob2", "4.38")
28 model.addParameter(Part_1_doc, "axe", "11.25")
29 Parameter_trou = model.addParameter(Part_1_doc, "trou", "7.5")
30 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
31 SketchLine_1 = Sketch_1.addLine(0, 0, 17.71094752491076, 14.8612495359528)
32 SketchLine_1.setAuxiliary(True)
33 SketchLine_2 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX"))
34 SketchConstraintAngle_1 = Sketch_1.setAngleBackward(SketchLine_1.result(), SketchLine_2.result(), 40.00000000000006)
35 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.startPoint())
36 SketchArc_1 = Sketch_1.addArc(0, 0, 17.71094752491076, 14.8612495359528, 23.12, -6.011798491948799e-033, True)
37 SketchArc_1.setAuxiliary(True)
38 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_1.center())
39 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_1.startPoint())
40 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_1.endPoint())
41 SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchArc_1.endPoint(), 23.12)
42 SketchArc_2 = Sketch_1.addArc(23.12, -6.011798491948799e-033, 18.74, 0, 27.5, 0, False)
43 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchArc_2.center())
44 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_2.startPoint())
45 SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_2.endPoint())
46 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_2.results()[1], "ob2")
47 SketchArc_3 = Sketch_1.addArc(0, 0, 18.74, 0, 14.35567286404965, 12.04583980552575, False)
48 SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_3.center())
49 SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchArc_3.startPoint())
50 SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_3.endPoint())
51 SketchArc_4 = Sketch_1.addArc(0, 0, 27.5, 0, 21.0662221857694, 17.67665926638303, False)
52 SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_4.center())
53 SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchArc_4.startPoint())
54 SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_1.result())
55 SketchArc_5 = Sketch_1.addArc(17.71094752491078, 14.86124953595279, 14.35567286404965, 12.04583980552575, 21.0662221857694, 17.67665926638303, True)
56 SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchArc_5.startPoint())
57 SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchArc_5.endPoint())
58 SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_5.results()[1], SketchArc_3.results()[1])
59 SketchArc_6 = Sketch_1.addArc(-34.92, 0, -34.92, 4.370000000000002, -34.91999999999997, -4.370000000000019, False)
60 SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchArc_6.center(), SketchLine_2.result())
61 SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_6.results()[1], "ob1")
62 SketchConstraintDistance_2 = Sketch_1.setDistance(SketchArc_6.center(), SketchArc_2.center(), 58.04)
63 SketchLine_3 = Sketch_1.addLine(-24.92, 4.37, -34.92, 4.370000000000002)
64 SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchArc_6.startPoint(), SketchLine_3.endPoint())
65 SketchLine_4 = Sketch_1.addLine(-24.92, -4.37, -34.91999999999997, -4.370000000000019)
66 SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchArc_6.endPoint(), SketchLine_4.endPoint())
67 SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result())
68 SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_4.result())
69 SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_6.results()[1])
70 SketchConstraintTangent_3 = Sketch_1.setTangent(SketchLine_4.result(), SketchArc_6.results()[1])
71 SketchArc_7 = Sketch_1.addArc(-24.92, 1.467818159729891e-016, -24.92, 4.37, -24.92, -4.37, True)
72 SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchArc_7.startPoint())
73 SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchArc_7.endPoint())
74 SketchConstraintTangent_4 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_7.results()[1])
75 SketchConstraintTangent_5 = Sketch_1.setTangent(SketchArc_7.results()[1], SketchLine_4.result())
76 SketchConstraintDistance_3 = Sketch_1.setDistance(SketchArc_6.center(), SketchArc_7.center(), 10)
77 SketchCircle_1 = Sketch_1.addCircle(9.498292007139793e-031, -4.263345141625117e-031, 5.625)
78 SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.center())
79 SketchConstraintRadius_3 = Sketch_1.setRadius(SketchCircle_1.results()[1], "axe/2")
80 SketchCircle_2 = Sketch_1.addCircle(-7.5, 18.75, 3.75)
81 SketchConstraintRadius_4 = Sketch_1.setRadius(SketchCircle_2.results()[1], "trou/2")
82 SketchLine_5 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OY"))
83 SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_5.result(), SketchCircle_2.center(), 7.5)
84 SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_2.result(), SketchCircle_2.center(), 18.75)
85 SketchArc_8 = Sketch_1.addArc(-34.92, -6.497717112746075e-027, -34.91999999999937, 7.500000000006299, -36.26235395189003, -7.378894623711957, False)
86 SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchArc_6.center(), SketchArc_8.center())
87 SketchConstraintRadius_5 = Sketch_1.setRadius(SketchArc_8.results()[1], 7.5)
88 SketchArc_9 = Sketch_1.addArc(-7.5, 18.75, 0.0511741035599095, 21.7492323447386, -15.3796231578326, 20.73170731707517, False)
89 SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchArc_9.center())
90 SketchConstraintRadius_6 = Sketch_1.setRadius(SketchArc_9.results()[1], "16.25/2")
91 SketchArc_10 = Sketch_1.addArc(-32.35111919008745, 25.0000000000063, -15.3796231578326, 20.73170731707517, -32.35111919008745, 7.500000000006299, True)
92 SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchArc_9.endPoint(), SketchArc_10.startPoint())
93 SketchConstraintTangent_6 = Sketch_1.setTangent(SketchArc_9.results()[1], SketchArc_10.results()[1])
94 SketchConstraintRadius_7 = Sketch_1.setRadius(SketchArc_10.results()[1], 17.5)
95 SketchLine_6 = Sketch_1.addLine(-34.91999999999937, 7.500000000006299, -32.35111919008745, 7.500000000006299)
96 SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchArc_8.startPoint(), SketchLine_6.startPoint())
97 SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchArc_10.endPoint(), SketchLine_6.endPoint())
98 SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result())
99 SketchConstraintTangent_7 = Sketch_1.setTangent(SketchLine_6.result(), SketchArc_10.results()[1])
100 SketchArc_11 = Sketch_1.addArc(2.841203857564676e-031, -1.848261526152319e-031, -2.46098224513173, -13.52797347680525, 10.54941392733564, -8.818864200663077, False)
101 SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_11.center())
102 SketchConstraintRadius_8 = Sketch_1.setRadius(SketchArc_11.results()[1], 13.75)
103 SketchLine_7 = Sketch_1.addLine(-36.26235395189003, -7.378894623711957, -2.460982245131729, -13.52797347680525)
104 SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchArc_8.endPoint(), SketchLine_7.startPoint())
105 SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchArc_11.startPoint(), SketchLine_7.endPoint())
106 SketchConstraintTangent_8 = Sketch_1.setTangent(SketchLine_7.result(), SketchArc_8.results()[1])
107 SketchConstraintTangent_9 = Sketch_1.setTangent(SketchLine_7.result(), SketchArc_11.results()[1])
108 SketchArc_12 = Sketch_1.addArc(23.12, 7.384930033544359e-028, 18.58435121107267, -7.482672655108066, 31.87, -1.068593854246008e-030, False)
109 SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchArc_12.center())
110 SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_12.endPoint())
111 SketchArc_13 = Sketch_1.addArc(15.34460207612463, -12.82743883732818, 10.5494139273357, -8.818864200663123, 18.58435121107276, -7.482672655108122, True)
112 SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchArc_11.endPoint(), SketchArc_13.startPoint())
113 SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchArc_12.startPoint(), SketchArc_13.endPoint())
114 SketchConstraintTangent_10 = Sketch_1.setTangent(SketchArc_13.results()[1], SketchArc_12.results()[1])
115 SketchConstraintRadius_9 = Sketch_1.setRadius(SketchArc_12.results()[1], 8.75)
116 SketchConstraintTangent_11 = Sketch_1.setTangent(SketchArc_13.results()[1], SketchArc_11.results()[1])
117 SketchArc_14 = Sketch_1.addArc(7.217739748128488e-031, -7.397577026331382e-031, 31.87, 1.64056023214913e-033, 24.41383640220182, 20.48564112071002, False)
118 SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_14.center())
119 SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchArc_12.endPoint(), SketchArc_14.startPoint())
120 SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchArc_14.endPoint(), SketchLine_1.result())
121 SketchArc_15 = Sketch_1.addArc(17.71094752491077, 14.86124953595279, 24.41383640220183, 20.48564112071001, 10.79776038328427, 20.22504889320414, False)
122 SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_15.center())
123 SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchArc_14.endPoint(), SketchArc_15.startPoint())
124 SketchArc_16 = Sketch_1.addArc(5.859769567836763, 24.05633414838368, 10.79776038328427, 20.22504889320414, 0.05117410355990894, 21.7492323447386, True)
125 SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchArc_15.endPoint(), SketchArc_16.startPoint())
126 SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchArc_9.startPoint(), SketchArc_16.endPoint())
127 SketchConstraintTangent_12 = Sketch_1.setTangent(SketchArc_16.results()[1], SketchArc_15.results()[1])
128 SketchConstraintTangent_13 = Sketch_1.setTangent(SketchArc_16.results()[1], SketchArc_9.results()[1])
129 SketchConstraintRadius_10 = Sketch_1.setRadius(SketchArc_16.results()[1], 6.25)
130 SketchConstraintRadius_11 = Sketch_1.setRadius(SketchArc_13.results()[1], 6.25)
131 SketchConstraintTangent_14 = Sketch_1.setTangent(SketchLine_6.result(), SketchArc_8.results()[1])
132 model.do()
133 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_8_2f-SketchLine_7f-SketchArc_11_2f-SketchArc_13_2r-SketchArc_12_2f-SketchArc_14_2f-SketchArc_15_2f-SketchArc_16_2r-SketchArc_9_2f-SketchArc_10_2r-SketchLine_6r-SketchCircle_1_2r-SketchArc_3_2f-SketchArc_5_2r-SketchArc_4_2r-SketchArc_2_2r-SketchLine_3r-SketchArc_7_2r-SketchLine_4f-SketchArc_6_2r-SketchCircle_2_2r")], model.selection(), 0, 2)
134 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
135 SketchPoint_1 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/SketchArc_7"))
136 SketchArc_17 = Sketch_2.addArc(-24.92, -4.314010717669617e-016, -24.92, 7.500000000006299, -24.92, -7.500000000006299, True)
137 SketchConstraintCoincidence_41 = Sketch_2.setCoincident(SketchPoint_1.result(), SketchArc_17.center())
138 SketchPoint_2 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/SketchArc_8_2_StartVertex"))
139 SketchPoint_3 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/SketchArc_6"))
140 SketchArc_18 = Sketch_2.addArc(-34.92, 0, -34.91999999999937, 7.500000000006299, -34.92003434105975, -7.500000000006299, False)
141 SketchConstraintCoincidence_42 = Sketch_2.setCoincident(SketchPoint_3.result(), SketchArc_18.center())
142 SketchConstraintCoincidence_43 = Sketch_2.setCoincident(SketchPoint_2.result(), SketchArc_18.startPoint())
143 SketchLine_8 = Sketch_2.addLine(-34.91999999999937, 7.500000000006299, -24.92, 7.500000000006299)
144 SketchConstraintCoincidence_44 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_8.startPoint())
145 SketchConstraintCoincidence_45 = Sketch_2.setCoincident(SketchArc_17.startPoint(), SketchLine_8.endPoint())
146 SketchLine_9 = Sketch_2.addLine(-34.92003434105975, -7.500000000006299, -24.92, -7.500000000006299)
147 SketchConstraintCoincidence_46 = Sketch_2.setCoincident(SketchArc_18.endPoint(), SketchLine_9.startPoint())
148 SketchConstraintCoincidence_47 = Sketch_2.setCoincident(SketchArc_17.endPoint(), SketchLine_9.endPoint())
149 SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_8.result())
150 SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_9.result())
151 SketchConstraintTangent_15 = Sketch_2.setTangent(SketchLine_8.result(), SketchArc_17.results()[1])
152 SketchConstraintTangent_16 = Sketch_2.setTangent(SketchArc_17.results()[1], SketchLine_9.result())
153 SketchPoint_4 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/SketchCircle_2_2__cc"))
154 SketchCircle_3 = Sketch_2.addCircle(-7.5, 18.75, 8.125)
155 SketchConstraintCoincidence_48 = Sketch_2.setCoincident(SketchPoint_4.result(), SketchCircle_3.center())
156 SketchArc_19 = Sketch_2.addArc(model.selection("EDGE", "Sketch_1/SketchArc_9_2"))
157 SketchConstraintEqual_1 = Sketch_2.setEqual(SketchCircle_3.results()[1], SketchArc_19.results()[1])
158 SketchPoint_5 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/SketchCircle_1_2__cc"))
159 SketchCircle_4 = Sketch_2.addCircle(0, 0, 8.75)
160 SketchConstraintCoincidence_49 = Sketch_2.setCoincident(SketchPoint_5.result(), SketchCircle_4.center())
161 SketchConstraintRadius_12 = Sketch_2.setRadius(SketchCircle_4.results()[1], "17.5/2")
162 model.do()
163 Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_8"), model.selection("EDGE", "Sketch_2/SketchArc_17_2"), model.selection("EDGE", "Sketch_2/SketchLine_9"), model.selection("EDGE", "Sketch_2/SketchArc_18_2"), model.selection("EDGE", "Sketch_1/SketchArc_6_2"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchArc_7_2"), model.selection("EDGE", "Sketch_1/SketchLine_4")])
164 Face_2 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchCircle_3_2"), model.selection("EDGE", "Sketch_1/SketchCircle_2_2")])
165 Face_3 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchCircle_4_2"), model.selection("EDGE", "Sketch_1/SketchCircle_1_2")])
166 Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_3_1")], model.selection(), 2, 0)
167 Boolean_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2"), model.selection("SOLID", "Extrusion_2_3")], [])
168 model.do()
169
170 # Test reexecution after parameter change
171 Parameter_trou.setValue(3.5)
172 model.do()
173 model.testResultsVolumes(Boolean_1, [4039.112573151546712324488908052])
174 Parameter_trou.setValue(7.5)
175 model.end()
176
177 from GeomAPI import GeomAPI_Shape
178
179 model.testNbResults(Boolean_1, 1)
180 model.testNbSubResults(Boolean_1, [0])
181 model.testNbSubShapes(Boolean_1, GeomAPI_Shape.SOLID, [1])
182 model.testNbSubShapes(Boolean_1, GeomAPI_Shape.FACE, [38])
183 model.testNbSubShapes(Boolean_1, GeomAPI_Shape.EDGE, [188])
184 model.testNbSubShapes(Boolean_1, GeomAPI_Shape.VERTEX, [376])
185 model.testResultsVolumes(Boolean_1, [3900.882496393901419651228934526])
186
187 assert(model.checkPythonDump())