]> SALOME platform Git repositories - modules/shaper.git/blob - test.models/wheel_rim.py
Salome HOME
Fix for the issue #2942 : Fatal error when select using filters and use object from...
[modules/shaper.git] / test.models / wheel_rim.py
1 # Copyright (C) 2014-2019  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 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
27 SketchLine_1 = Sketch_1.addLine(-70.81663645026607, 190, 229.1833635497339, 190)
28 SketchLine_1.setAuxiliary(True)
29 SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
30 SketchLine_2 = Sketch_1.addLine(16.64097565470627, 190, 22.64097565470627, 190)
31 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_1.result())
32 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_1.result())
33 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 6)
34 SketchArc_1 = Sketch_1.addArc(32.64097565470627, 190, 42.64097565470627, 190, 22.64097565470627, 190, True)
35 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.result())
36 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_1.endPoint())
37 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_1.result())
38 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 10)
39 SketchLine_3 = Sketch_1.addLine(42.64097565470627, 190, 147.6409756547063, 190)
40 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_3.startPoint())
41 SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_1.result())
42 SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_3.result(), 105)
43 SketchLine_4 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX"))
44 SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_4.result(), 190)
45 SketchLine_5 = Sketch_1.addLine(167.6409756547062, 232.4170641625502, 167.6409756547062, 155.6475648742598)
46 SketchLine_5.setAuxiliary(True)
47 SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_5.result())
48 SketchArc_2 = Sketch_1.addArc(147.6409756547063, 202.5, 147.6409756547063, 190, 160.1409756547063, 202.5, False)
49 SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_2.startPoint())
50 SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_2.results()[1])
51 SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], 12.5)
52 SketchLine_6 = Sketch_1.addLine(147.6409756547063, 202.5, 147.6409756547063, 190)
53 SketchLine_6.setAuxiliary(True)
54 SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_6.startPoint())
55 SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_6.endPoint())
56 SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_6.endPoint())
57 SketchLine_7 = Sketch_1.addLine(160.1409756547063, 202.5, 147.6409756547063, 202.5)
58 SketchLine_7.setAuxiliary(True)
59 SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_7.startPoint())
60 SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_7.endPoint())
61 SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchLine_7.endPoint())
62 SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_6.result(), SketchLine_7.result(), 90)
63 SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_2.endPoint(), SketchLine_5.result(), 145)
64 SketchPoint_1 = Sketch_1.addPoint(167.6409756547062, 218.5857086760099)
65 SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_5.result())
66 SketchArc_3 = Sketch_1.addArc(181.1409756547063, 202.5, 167.6409756547062, 218.5857086760099, 160.1409756547063, 202.5, False)
67 SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_3.startPoint())
68 SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchArc_3.endPoint())
69 SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_7.startPoint(), SketchArc_3.endPoint())
70 SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchArc_3.results()[1])
71 SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchArc_2.results()[1])
72 model.do()
73
74 # check overconstraint message appears
75 assert Sketch_1.solverError().value() != "", "FAILED: Sketch should report over-constrained situation"
76 # remove duplicated Tangent constraint
77 Part_1_doc.removeFeature(SketchConstraintTangent_3.feature())
78 model.do()
79 assert Sketch_1.solverError().value() == "", "FAILED: Sketch should NOT report over-constrained situation"
80
81 # continue creating model
82 SketchLine_8 = Sketch_1.addLine(16.64097565470627, 190, 16.64097565470627, 184)
83 SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_8.startPoint())
84 SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_8.result())
85 SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_8.result(), 6)
86 SketchLine_9 = Sketch_1.addLine(16.64097565470627, 184, 169.1531000589648, 184)
87 SketchLine_9.setAuxiliary(True)
88 SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
89 SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_9.result())
90 SketchLine_10 = Sketch_1.addLine(16.64097565470627, 184, 18.2409756547065, 184)
91 SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_10.startPoint(), SketchLine_8.endPoint())
92 SketchLine_11 = Sketch_1.addLine(147.6409756547063, 190, 147.6409756547063, 184)
93 SketchLine_11.setAuxiliary(True)
94 SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_11.startPoint())
95 SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_11.startPoint())
96 SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_11.startPoint())
97 SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_9.result())
98 SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_11.result(), SketchLine_9.result())
99 SketchArc_4 = Sketch_1.addArc(147.6409756547063, 202.5, 147.6409756547063, 184, 166.1409756547063, 202.5, False)
100 SketchArc_4.setName("SketchArc_5")
101 SketchArc_4.result().setName("SketchArc_5")
102 SketchArc_4.results()[1].setName("SketchArc_5_2")
103 SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchArc_2.center(), SketchArc_4.center())
104 SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchArc_4.center())
105 SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchArc_4.center())
106 SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchArc_4.startPoint())
107 SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_7.result())
108 SketchLine_12 = Sketch_1.addLine(47.47337262898633, 184, 147.6409756547063, 184)
109 SketchArc_5 = Sketch_1.addArc(32.64097565470627, 190, 32.64097565470627, 174, 47.47337262898633, 184, False)
110 SketchArc_5.setName("SketchArc_10")
111 SketchArc_5.result().setName("SketchArc_10")
112 SketchArc_5.results()[1].setName("SketchArc_10_2")
113 SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchArc_5.endPoint(), SketchLine_12.startPoint())
114 SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.endPoint())
115 SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchArc_4.startPoint(), SketchLine_12.endPoint())
116 SketchArc_6 = Sketch_1.addArc(181.1409756547063, 202.5, 166.1409756547063, 202.5, 171.498118511849, 213.9897921211111, True)
117 SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchArc_6.startPoint())
118 SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchArc_6.center(), SketchArc_3.center())
119 SketchLine_13 = Sketch_1.addLine(181.1409756547063, 202.5, 167.6409756547062, 218.5857086760099)
120 SketchLine_13.setAuxiliary(True)
121 SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchArc_6.center(), SketchLine_13.startPoint())
122 SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_13.endPoint())
123 SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchLine_13.endPoint())
124 SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchLine_13.result(), SketchArc_6.endPoint())
125 SketchLine_14 = Sketch_1.addLine(167.6409756547062, 218.5857086760099, 171.498118511849, 213.9897921211111)
126 SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_14.startPoint())
127 SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchLine_14.startPoint())
128 SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint())
129 SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchArc_6.endPoint(), SketchLine_14.endPoint())
130 SketchLine_15 = Sketch_1.addLine(32.64097565470627, 190, 32.64097565470627, 174)
131 SketchLine_15.setAuxiliary(True)
132 SketchConstraintCoincidence_44 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_15.startPoint())
133 SketchConstraintCoincidence_45 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchArc_5.startPoint())
134 SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_15.result())
135 SketchLine_16 = Sketch_1.addLine(32.64097565470627, 174, 12.64097565470628, 174)
136 SketchConstraintCoincidence_46 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint())
137 SketchArc_7 = Sketch_1.addArc(12.64097565470628, 165, 12.64097565470628, 174, 3.640975654706275, 165, False)
138 SketchConstraintCoincidence_47 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchArc_7.startPoint())
139 SketchLine_17 = Sketch_1.addLine(3.640975654706275, 165, 3.640975654706275, 100)
140 SketchConstraintCoincidence_48 = Sketch_1.setCoincident(SketchArc_7.endPoint(), SketchLine_17.startPoint())
141 SketchLine_18 = Sketch_1.addLine(3.640975654706275, 100, -5.359024345293726, 100)
142 SketchConstraintCoincidence_49 = Sketch_1.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint())
143 SketchLine_19 = Sketch_1.addLine(-5.359024345293726, 100, -5.359024345293726, 165)
144 SketchConstraintCoincidence_50 = Sketch_1.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint())
145 SketchLine_20 = Sketch_1.addLine(-5.359024345293726, 165, -5.359024345293726, 100)
146 SketchConstraintCoincidence_51 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint())
147 SketchConstraintCoincidence_52 = Sketch_1.setCoincident(SketchLine_18.endPoint(), SketchLine_20.endPoint())
148 SketchConstraintCoincidence_53 = Sketch_1.setCoincident(SketchLine_19.startPoint(), SketchLine_20.endPoint())
149 SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_16.result())
150 SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_18.result())
151 SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_17.result())
152 SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_20.result())
153 SketchConstraintTangent_4 = Sketch_1.setTangent(SketchLine_16.result(), SketchArc_7.results()[1])
154 SketchConstraintTangent_5 = Sketch_1.setTangent(SketchLine_17.result(), SketchArc_7.results()[1])
155 SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_7.results()[1], 9)
156 SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_20.result(), 65)
157 SketchLine_21 = Sketch_1.addLine(12.64097565470628, 174, 12.64097565470628, 192.2067667108204)
158 SketchLine_21.setName("SketchLine_22")
159 SketchLine_21.result().setName("SketchLine_22")
160 SketchLine_21.setAuxiliary(True)
161 SketchConstraintCoincidence_54 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_21.startPoint())
162 SketchConstraintCoincidence_55 = Sketch_1.setCoincident(SketchArc_7.startPoint(), SketchLine_21.startPoint())
163 SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_21.result())
164 SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_16.result(), 20)
165 SketchArc_8 = Sketch_1.addArc(12.64097565470628, 165, -5.359024345293726, 165, 12.64097565470625, 183, True)
166 SketchConstraintCoincidence_56 = Sketch_1.setCoincident(SketchArc_7.center(), SketchArc_8.center())
167 SketchConstraintCoincidence_57 = Sketch_1.setCoincident(SketchLine_19.endPoint(), SketchArc_8.startPoint())
168 SketchConstraintCoincidence_58 = Sketch_1.setCoincident(SketchLine_20.startPoint(), SketchArc_8.startPoint())
169 SketchConstraintCoincidence_59 = Sketch_1.setCoincident(SketchArc_8.endPoint(), SketchLine_21.result())
170 SketchLine_22 = Sketch_1.addLine(12.64097565470625, 183, 18.2409756547065, 183)
171 SketchLine_22.setName("SketchLine_23")
172 SketchLine_22.result().setName("SketchLine_23")
173 SketchConstraintCoincidence_60 = Sketch_1.setCoincident(SketchArc_8.endPoint(), SketchLine_22.startPoint())
174 SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_22.result())
175 SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_18.startPoint(), SketchLine_19.result(), 9)
176 SketchLine_23 = Sketch_1.addLine(18.2409756547065, 183, 18.2409756547065, 184)
177 SketchLine_23.setName("SketchLine_24")
178 SketchLine_23.result().setName("SketchLine_24")
179 SketchConstraintCoincidence_61 = Sketch_1.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint())
180 SketchConstraintCoincidence_62 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_23.endPoint())
181 SketchConstraintVertical_7 = Sketch_1.setVertical(SketchLine_23.result())
182 SketchConstraintCoincidence_63 = Sketch_1.setCoincident(SketchArc_5.endPoint(), SketchLine_9.result())
183 SketchConstraintCoincidence_64 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_9.result())
184 SketchConstraintCoincidence_65 = Sketch_1.setCoincident(SketchArc_5.center(), SketchLine_15.startPoint())
185 SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_10.startPoint(), SketchLine_23.result(), 1.6, True)
186 SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_10.startPoint(), SketchLine_22.result(), 1, True)
187 SketchConstraintRadius_4 = Sketch_1.setRadius(SketchArc_6.results()[1], 15)
188 model.do()
189 Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_8f-SketchLine_10f-SketchLine_24r-SketchLine_23r-SketchArc_8_2f-SketchLine_19r-SketchLine_18r-SketchLine_17r-SketchArc_7_2r-SketchLine_16r-SketchArc_10_2f-SketchLine_12f-SketchArc_5_2f-SketchArc_6_2r-SketchLine_14r-SketchArc_3_2f-SketchArc_2_2r-SketchLine_3r-SketchArc_1_2r-SketchLine_2r")], model.selection("EDGE", "PartSet/OX"), 360, 0)
190 Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
191 SketchCircle_1 = Sketch_2.addCircle(0, 120, 7.5)
192 SketchLine_24 = Sketch_2.addLine(model.selection("EDGE", "PartSet/OZ"))
193 SketchLine_24.setName("SketchLine_25")
194 SketchLine_24.result().setName("SketchLine_25")
195 SketchConstraintCoincidence_66 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchLine_24.result())
196 SketchLine_25 = Sketch_2.addLine(model.selection("EDGE", "PartSet/OY"))
197 SketchLine_25.setName("SketchLine_26")
198 SketchLine_25.result().setName("SketchLine_26")
199 SketchConstraintDistance_6 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_25.result(), 120)
200 SketchConstraintRadius_5 = Sketch_2.setRadius(SketchCircle_1.results()[1], 7.5)
201 SketchMultiRotation_1 = Sketch_2.addRotation([SketchCircle_1.results()[1]], SketchLine_24.startPoint(), 24, 15)
202 [SketchCircle_2, SketchCircle_3, SketchCircle_4, SketchCircle_5, SketchCircle_6, SketchCircle_7, SketchCircle_8, SketchCircle_9, SketchCircle_10, SketchCircle_11, SketchCircle_12, SketchCircle_13, SketchCircle_14, SketchCircle_15] = SketchMultiRotation_1.rotated()
203 model.do()
204 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 10, 10)
205 Boolean_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("SOLID", "Extrusion_1_6"), model.selection("SOLID", "Extrusion_1_8"), model.selection("SOLID", "Extrusion_1_9"), model.selection("SOLID", "Extrusion_1_3"), model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_4"), model.selection("SOLID", "Extrusion_1_14"), model.selection("SOLID", "Extrusion_1_5"), model.selection("SOLID", "Extrusion_1_15"), model.selection("SOLID", "Extrusion_1_11"), model.selection("SOLID", "Extrusion_1_10"), model.selection("SOLID", "Extrusion_1_12"), model.selection("SOLID", "Extrusion_1_13"), model.selection("SOLID", "Extrusion_1_7")])
206 model.end()
207
208 from GeomAPI import GeomAPI_Shape
209
210 model.testNbResults(Boolean_1, 1)
211 model.testNbSubResults(Boolean_1, [0])
212 model.testNbSubShapes(Boolean_1, GeomAPI_Shape.SOLID, [1])
213 model.testNbSubShapes(Boolean_1, GeomAPI_Shape.FACE, [35])
214 model.testNbSubShapes(Boolean_1, GeomAPI_Shape.EDGE, [162])
215 model.testNbSubShapes(Boolean_1, GeomAPI_Shape.VERTEX, [324])
216 model.testResultsVolumes(Boolean_1, [2052731.260104598477482795715332031])
217
218 assert(model.checkPythonDump())