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