]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModelAPI/Test/Test19031.py
Salome HOME
Issue #19058: Error in sketch projection when changing parameter
[modules/shaper.git] / src / ModelAPI / Test / Test19031.py
1 # Copyright (C) 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 GeomAPI import *
21 from SketchAPI import *
22
23 from salome.shaper import model
24
25 model.begin()
26 partSet = model.moduleDocument()
27 Part_1 = model.addPart(partSet)
28 Part_1_doc = Part_1.document()
29 model.addParameter(Part_1_doc, "cir2", "22.225")
30 model.addParameter(Part_1_doc, "ext1", "3")
31 model.addParameter(Part_1_doc, "rib1", "13")
32 model.addParameter(Part_1_doc, "rib2", "13")
33 model.addParameter(Part_1_doc, "rib3", "13")
34 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
35 SketchCircle_1 = Sketch_1.addCircle(193.5527547665121, 217.4086484957226, 25.4)
36 SketchCircle_2 = Sketch_1.addCircle(193.5527547665121, 217.4086484957226, 38)
37 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchCircle_2.center())
38 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], 38)
39 SketchConstraintRadius_2 = Sketch_1.setRadius(SketchCircle_1.results()[1], 25.4)
40 SketchLine_1 = Sketch_1.addLine(231.5527547665122, 217.4085749004042, 231.5527547665122, 96.40864849572259)
41 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_2.results()[1])
42 SketchLine_2 = Sketch_1.addLine(212.5527547665122, 77.40864849572259, 79.55275476651215, 77.40864849572259)
43 SketchLine_3 = Sketch_1.addLine(79.55275476651215, 77.40864849572259, -35.01044899266839, 119.578215062531)
44 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
45 SketchArc_1 = Sketch_1.addArc(-28.44724523348785, 137.4086484957226, -35.01044899266839, 119.578215062531, -28.44724523348786, 156.4086484957226, True)
46 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.startPoint())
47 SketchLine_4 = Sketch_1.addLine(-28.44724523348786, 156.4086484957226, 96.55275476651215, 156.4086484957226)
48 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_4.startPoint())
49 SketchLine_5 = Sketch_1.addLine(193.5527547665121, 217.4086484957226, 193.5527547665121, 96.40864849572259)
50 SketchLine_5.setAuxiliary(True)
51 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_5.startPoint())
52 SketchLine_6 = Sketch_1.addLine(193.5527547665121, 96.40864849572259, -186.9071792634899, 96.40864849572259)
53 SketchLine_6.setAuxiliary(True)
54 SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
55 SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_5.result())
56 SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_6.result())
57 SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_4.result(), SketchArc_1.results()[1])
58 SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_1.results()[1])
59 SketchCircle_3 = Sketch_1.addCircle(-28.44724523348785, 137.4086484957226, 7)
60 SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_1.center(), SketchCircle_3.center())
61 SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_2.result())
62 SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_1.result())
63 SketchArc_2 = Sketch_1.addArc(212.5527547665122, 96.40864849572259, 212.5527547665122, 77.40864849572259, 231.5527547665122, 96.40864849572259, False)
64 SketchArc_2.setName("SketchArc_3")
65 SketchArc_2.result().setName("SketchArc_3")
66 SketchArc_2.results()[1].setName("SketchArc_3_2")
67 SketchPoint_1 = Sketch_1.addPoint(231.5527547665122, 77.4086484957226)
68 SketchPoint_1.setAuxiliary(True)
69 SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_5.startPoint(), SketchPoint_1.coordinates(), 140)
70 SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_1.result())
71 SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_2.result())
72 SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_2.startPoint())
73 SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_1.endPoint())
74 SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_1.result())
75 SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_2.result())
76 SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_2.results()[1], 19)
77 SketchCircle_4 = Sketch_1.addCircle(212.5527547665122, 96.40864849572259, 7)
78 SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_2.center(), SketchCircle_4.center())
79 SketchCircle_5 = Sketch_1.addCircle(149.5527547665122, 137.4086484957226, 7)
80 SketchLine_7 = Sketch_1.addLine(149.5527547665122, 137.4086484957226, -36.17794869484125, 137.4086484957226)
81 SketchLine_7.setAuxiliary(True)
82 SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchCircle_5.center(), SketchLine_7.startPoint())
83 SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_7.result(), SketchLine_6.result())
84 SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_7.result())
85 SketchCircle_6 = Sketch_1.addCircle(79.55275476651215, 96.4086484957226, 7)
86 SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_6.result(), SketchCircle_6.center())
87 SketchCircle_7 = Sketch_1.addCircle(-3.447245233487854, 124.4086484957226, 5)
88 SketchCircle_8 = Sketch_1.addCircle(174.5527547665122, 96.4086484957226, 5)
89 SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_6.result(), SketchCircle_8.center())
90 SketchConstraintEqual_1 = Sketch_1.setEqual(SketchCircle_3.results()[1], SketchCircle_6.results()[1])
91 SketchConstraintEqual_2 = Sketch_1.setEqual(SketchCircle_6.results()[1], SketchCircle_5.results()[1])
92 SketchConstraintEqual_3 = Sketch_1.setEqual(SketchCircle_5.results()[1], SketchCircle_4.results()[1])
93 SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchArc_1.center(), SketchCircle_4.center(), 241)
94 SketchConstraintRadius_4 = Sketch_1.setRadius(SketchCircle_3.results()[1], 7)
95 SketchConstraintEqual_4 = Sketch_1.setEqual(SketchCircle_8.results()[1], SketchCircle_7.results()[1])
96 SketchConstraintRadius_5 = Sketch_1.setRadius(SketchCircle_7.results()[1], 5)
97 SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchLine_3.startPoint(), SketchCircle_3.center(), 108)
98 SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance(SketchLine_3.startPoint(), SketchLine_7.startPoint(), 70)
99 SketchConstraintDistanceHorizontal_4 = Sketch_1.setHorizontalDistance(SketchCircle_8.center(), SketchLine_7.startPoint(), 25)
100 SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.startPoint(), SketchLine_6.result(), 19, True)
101 SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_7.result(), SketchCircle_6.center(), 41, True)
102 SketchLine_8 = Sketch_1.addLine(79.55275476651215, 77.40864849572259, 79.55275476651215, 115.4086484957226)
103 SketchLine_8.setAuxiliary(True)
104 SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_8.startPoint())
105 SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result())
106 SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchLine_8.result(), SketchCircle_6.center())
107 SketchConstraintDistance_3 = Sketch_1.setDistance(SketchCircle_7.center(), SketchLine_7.result(), 13, True)
108 SketchConstraintDistanceHorizontal_5 = Sketch_1.setHorizontalDistance(SketchArc_1.center(), SketchCircle_7.center(), 25)
109 SketchConstraintRadius_6 = Sketch_1.setRadius(SketchArc_1.results()[1], 19)
110 SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_4.result())
111 SketchConstraintTangent_5 = Sketch_1.setTangent(SketchLine_1.result(), SketchCircle_2.results()[1])
112 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_4.result(), 125)
113 SketchArc_3 = Sketch_1.addArc(96.55275476651215, 215.5823348515451, 96.55275476651215, 156.4086484957226, 155.6041596876128, 219.3845360273737, False)
114 SketchArc_3.setName("SketchArc_5")
115 SketchArc_3.result().setName("SketchArc_5")
116 SketchArc_3.results()[1].setName("SketchArc_5_2")
117 SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchArc_3.startPoint())
118 SketchConstraintTangent_6 = Sketch_1.setTangent(SketchLine_4.result(), SketchArc_3.results()[1])
119 SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchCircle_2.results()[1], SketchArc_3.endPoint())
120 model.do()
121 Sketch_1.changeFacesOrder([[SketchCircle_1.results()[1]],
122                            [SketchCircle_2.results()[1], SketchCircle_2.results()[1], SketchArc_3.results()[1], SketchCircle_2.results()[1], SketchCircle_1.results()[1]],
123                            [SketchCircle_4.results()[1]],
124                            [SketchCircle_5.results()[1]],
125                            [SketchCircle_6.results()[1]],
126                            [SketchCircle_7.results()[1]],
127                            [SketchCircle_8.results()[1]],
128                            [SketchCircle_2.results()[1], SketchArc_3.results()[1]],
129                            [SketchCircle_3.results()[1]],
130                            [SketchArc_3.results()[1], SketchLine_4.result(), SketchArc_1.results()[1], SketchLine_3.result(), SketchLine_2.result(), SketchArc_2.results()[1], SketchLine_1.result(), SketchCircle_2.results()[1], SketchCircle_3.results()[1], SketchCircle_4.results()[1], SketchCircle_5.results()[1], SketchCircle_6.results()[1], SketchCircle_7.results()[1], SketchCircle_8.results()[1]]
131                           ])
132 model.do()
133 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_5_2r-SketchLine_4r-SketchArc_1_2f-SketchLine_3r-SketchLine_2r-SketchArc_3_2f-SketchLine_1r-SketchCircle_2_2r-SketchCircle_3_2r-SketchCircle_4_2r-SketchCircle_5_2r-SketchCircle_6_2r-SketchCircle_7_2r-SketchCircle_8_2r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f-SketchCircle_2_2f-SketchArc_5_2r-SketchCircle_2_2f-SketchCircle_1_2r")], model.selection(), 19, 0)
134 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4"))
135 SketchLine_9 = Sketch_2.addLine(41.55275476651212, -117.4829288507397, 41.55275476651212, -28.90149327102993)
136 SketchLine_9.setAuxiliary(True)
137 SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_9.result())
138 SketchLine_10 = Sketch_2.addLine(96.55275476651215, -19, 75.65570703399533, -109.515058097161)
139 SketchLine_11 = Sketch_2.addLine(7.449802499028871, -109.515058097161, -13.44724523348792, -19)
140 SketchLine_12 = Sketch_2.addLine(96.55275476651215, -19, -13.44724523348792, -19)
141 SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_10.startPoint(), SketchLine_12.startPoint())
142 SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.endPoint())
143 SketchArc_4 = Sketch_2.addArc(41.5527547665121, -101.6417711951257, 75.65570703399533, -109.515058097161, 7.449802499028871, -109.515058097161, True)
144 SketchArc_4.setName("SketchArc_4")
145 SketchArc_4.result().setName("SketchArc_4")
146 SketchArc_4.results()[1].setName("SketchArc_4_2")
147 SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchArc_4.startPoint())
148 SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_11.startPoint(), SketchArc_4.endPoint())
149 SketchConstraintTangent_7 = Sketch_2.setTangent(SketchArc_4.results()[1], SketchLine_10.result())
150 SketchConstraintTangent_8 = Sketch_2.setTangent(SketchArc_4.results()[1], SketchLine_11.result())
151 SketchConstraintEqual_5 = Sketch_2.setEqual(SketchLine_10.result(), SketchLine_11.result())
152 SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_12.result())
153 SketchConstraintAngle_1 = Sketch_2.setAngle(SketchLine_10.result(), SketchLine_12.result(), 283, type = "Backward")
154 SketchConstraintRadius_7 = Sketch_2.setRadius(SketchArc_4.results()[1], 35)
155 SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_4"), True)
156 SketchLine_13 = SketchProjection_1.createdFeature()
157 SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_5_StartVertex"), True)
158 SketchPoint_2 = SketchProjection_2.createdFeature()
159 SketchPoint_3 = Sketch_2.addPoint(41.55275476651212, -19)
160 SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_9.result())
161 SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchLine_12.result(), SketchPoint_3.coordinates())
162 SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_5_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1_1/To_Face]"), False)
163 SketchPoint_4 = SketchProjection_3.createdFeature()
164 SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_4).coordinates(), SketchLine_12.startPoint())
165 SketchConstraintDistanceHorizontal_6 = Sketch_2.setHorizontalDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchPoint_3.coordinates(), 152)
166 SketchConstraintMiddle_2 = Sketch_2.setMiddlePoint(SketchLine_12.result(), SketchPoint_3.coordinates())
167 SketchCircle_9 = Sketch_2.addCircle(41.5527547665121, -101.6417711951257, 22.225)
168 SketchCircle_9.setName("SketchCircle_12")
169 SketchCircle_9.result().setName("SketchCircle_12")
170 SketchCircle_9.results()[1].setName("SketchCircle_12_2")
171 SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchArc_4.center(), SketchCircle_9.center())
172 SketchConstraintRadius_8 = Sketch_2.setRadius(SketchCircle_9.results()[1], 22.225)
173 model.do()
174 ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_12f-SketchLine_11r-SketchArc_4_2f-SketchLine_10r-SketchCircle_12_2r")], model.selection(), 0, 19, [model.selection("SOLID", "Extrusion_1_1_1")])
175 Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionFuse_1_1_2/From_Face"))
176 SketchCircle_10 = Sketch_3.addCircle(26.55177397544429, 51.01394267771718, 23.65265081716653)
177 SketchCircle_10.setName("SketchCircle_10")
178 SketchCircle_10.result().setName("SketchCircle_10")
179 SketchCircle_10.results()[1].setName("SketchCircle_10_2")
180 model.do()
181 ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_3/Face-SketchCircle_10_2r_wire")], model.selection(), model.selection("FACE", "ExtrusionFuse_1_1_2/Modified_Face&ExtrusionFuse_1_1_1/To_Face&ExtrusionFuse_1_1_2/To_Face&ExtrusionFuse_1_1_3/To_Face"), 0, model.selection(), 0, [model.selection("COMPSOLID", "ExtrusionFuse_1_1")])
182
183 model.end()
184
185 model.testNbResults(ExtrusionCut_1, 1)
186 model.testNbSubResults(ExtrusionCut_1, [3])
187 model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.SOLID, [3])
188 model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.FACE, [32])
189 model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.EDGE, [158])
190 model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.VERTEX, [316])
191 model.testResultsVolumes(ExtrusionCut_1, [567425.6058])
192
193 assert(model.checkPythonDump())