Salome HOME
57850b78c8fa531124d3e496f9bcda3a2339f087
[modules/shaper.git] / src / FeaturesPlugin / Test / Test2686.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 # -*- coding: utf-8 -*-
21
22 from GeomAPI import GeomAPI_Pnt
23 from SketchAPI import *
24
25 from salome.shaper import model
26
27 model.begin()
28 partSet = model.moduleDocument()
29 Part_1 = model.addPart(partSet)
30 Part_1_doc = Part_1.document()
31 model.addParameter(Part_1_doc, "angle", "27.5")
32 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
33 SketchLine_1 = Sketch_1.addLine(0, 4, 6.2, 4)
34 SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
35 SketchLine_2 = SketchProjection_1.createdFeature()
36 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result())
37 SketchLine_3 = Sketch_1.addLine(6.2, 4, 6.2, 2.5)
38 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint())
39 SketchLine_4 = Sketch_1.addLine(6.2, 2.5, 3.5, 2)
40 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
41 SketchLine_5 = Sketch_1.addLine(3.5, 2, 3.5, 0)
42 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
43 SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
44 SketchLine_6 = SketchProjection_2.createdFeature()
45 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.result())
46 SketchLine_7 = Sketch_1.addLine(3.5, 0, 0, 0)
47 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_7.startPoint())
48 SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_7.endPoint())
49 SketchLine_8 = Sketch_1.addLine(0, 4, 0, 0)
50 SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_8.startPoint())
51 SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_8.endPoint())
52 SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_5.result())
53 SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_3.result())
54 SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
55 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_7.result(), 3.5)
56 SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), 6.2)
57 SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_3.result(), 1.5)
58 SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_8.result(), 4)
59 SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_5.result(), 2)
60 model.do()
61 Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", GeomAPI_Pnt(3.1, 0, 2))], model.selection("EDGE", "PartSet/OZ"), 360, 0)
62 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", GeomAPI_Pnt(0, 0, 4)))
63 SketchCircle_1 = Sketch_2.addCircle(4.027018127601872, 2.325000000002457, 1.1)
64 SketchCircle_2 = Sketch_2.addCircle(-4.027018127597639, 2.325000000000002, 1.1)
65 SketchCircle_3 = Sketch_2.addCircle(7.188370358619843e-12, -4.650000000090492, 1.1)
66 SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", GeomAPI_Pnt(0, 0, 4)), False)
67 SketchPoint_1 = SketchProjection_3.createdFeature()
68 SketchCircle_4 = Sketch_2.addCircle(0, 0, 4.65)
69 SketchCircle_4.setAuxiliary(True)
70 SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchPoint_1.result(), SketchCircle_4.center())
71 SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False)
72 SketchLine_9 = SketchProjection_4.createdFeature()
73 SketchLine_10 = Sketch_2.addLine(0, 0, 4.027018127601872, 2.325000000002457)
74 SketchLine_10.setAuxiliary(True)
75 SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_10.startPoint())
76 SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchLine_10.endPoint())
77 SketchLine_11 = Sketch_2.addLine(0, 0, -4.027018127597639, 2.325000000000002)
78 SketchLine_11.setAuxiliary(True)
79 SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_11.startPoint())
80 SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchCircle_2.center(), SketchLine_11.endPoint())
81 SketchLine_12 = Sketch_2.addLine(0, 0, 7.188370358619843e-12, -4.650000000090492)
82 SketchLine_12.setAuxiliary(True)
83 SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_12.startPoint())
84 SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchCircle_3.center(), SketchLine_12.endPoint())
85 SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchCircle_2.center(), SketchCircle_4.results()[1])
86 SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchCircle_4.results()[1])
87 SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchCircle_4.results()[1])
88 SketchConstraintRadius_1 = Sketch_2.setRadius(SketchCircle_4.results()[1], 4.65)
89 SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_1.results()[1], 1.1)
90 SketchConstraintEqual_1 = Sketch_2.setEqual(SketchCircle_1.results()[1], SketchCircle_2.results()[1])
91 SketchConstraintEqual_2 = Sketch_2.setEqual(SketchCircle_2.results()[1], SketchCircle_3.results()[1])
92 SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", GeomAPI_Pnt(3.1, 0, 4)), False)
93 SketchLine_13 = SketchProjection_5.createdFeature()
94 SketchConstraintAngle_1 = Sketch_2.setAngle(SketchLine_13.result(), SketchLine_10.result(), 30)
95 SketchConstraintAngle_2 = Sketch_2.setAngle(SketchLine_10.result(), SketchLine_11.result(), 120)
96 SketchConstraintAngle_3 = Sketch_2.setAngle(SketchLine_11.result(), SketchLine_12.result(), 120)
97 SketchCircle_5 = Sketch_2.addCircle(4.645574230355638, 0.2028301512488116, 0.8)
98 SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchCircle_4.results()[1], SketchCircle_5.center())
99 SketchCircle_6 = Sketch_2.addCircle(4.645574230355638, 0.2028301512488116, 0.65)
100 SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchCircle_5.center(), SketchCircle_6.center())
101 SketchConstraintRadius_3 = Sketch_2.setRadius(SketchCircle_6.results()[1], 0.65)
102 SketchConstraintRadius_4 = Sketch_2.setRadius(SketchCircle_5.results()[1], 0.8)
103 SketchLine_14 = Sketch_2.addLine(0, 0, 4.645574230355638, 0.2028301512488116)
104 SketchLine_14.setAuxiliary(True)
105 SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_14.startPoint())
106 SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchCircle_5.center(), SketchLine_14.endPoint())
107 SketchConstraintAngle_4 = Sketch_2.setAngle(SketchLine_14.result(), SketchLine_10.result(), "angle")
108 SketchCircle_7 = Sketch_2.addCircle(2.498443178812738, 3.921770223029927, 0.65)
109 SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchCircle_4.results()[1], SketchCircle_7.center())
110 SketchCircle_8 = Sketch_2.addCircle(2.498443178812738, 3.921770223029927, 0.8)
111 SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchCircle_4.results()[1], SketchCircle_8.center())
112 SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchCircle_7.center(), SketchCircle_8.center())
113 SketchConstraintEqual_3 = Sketch_2.setEqual(SketchCircle_6.results()[1], SketchCircle_7.results()[1])
114 SketchConstraintEqual_4 = Sketch_2.setEqual(SketchCircle_8.results()[1], SketchCircle_5.results()[1])
115 SketchLine_15 = Sketch_2.addLine(0, 0, 2.498443178812738, 3.921770223029927)
116 SketchLine_15.setAuxiliary(True)
117 SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_15.startPoint())
118 SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchCircle_7.center(), SketchLine_15.endPoint())
119 SketchConstraintAngle_5 = Sketch_2.setAngle(SketchLine_10.result(), SketchLine_15.result(), "angle")
120 SketchMultiRotation_1 = Sketch_2.addRotation([SketchCircle_8.results()[1], SketchCircle_5.results()[1]], SketchCircle_4.center(), 360, 3, True)
121 [SketchCircle_9, SketchCircle_10, SketchCircle_11, SketchCircle_12] = SketchMultiRotation_1.rotated()
122 SketchCircle_12.setName("SketchCircle_13")
123 SketchCircle_12.result().setName("SketchCircle_13")
124 SketchCircle_12.results()[1].setName("SketchCircle_13_2")
125 SketchCircle_11.setName("SketchCircle_12")
126 SketchCircle_11.result().setName("SketchCircle_12")
127 SketchCircle_11.results()[1].setName("SketchCircle_12_2")
128 SketchMultiRotation_2 = Sketch_2.addRotation([SketchCircle_6.results()[1], SketchCircle_7.results()[1]], SketchAPI_Line(SketchLine_9).startPoint(), 120, 2)
129 [SketchCircle_13, SketchCircle_14] = SketchMultiRotation_2.rotated()
130 SketchCircle_14.setName("SketchCircle_17")
131 SketchCircle_14.result().setName("SketchCircle_17")
132 SketchCircle_14.results()[1].setName("SketchCircle_17_2")
133 SketchCircle_13.setName("SketchCircle_14")
134 SketchCircle_13.result().setName("SketchCircle_14")
135 SketchCircle_13.results()[1].setName("SketchCircle_14_2")
136 SketchCircle_15 = Sketch_2.addCircle(0, 5, 0.45)
137 SketchCircle_15.setName("SketchCircle_15")
138 SketchCircle_15.result().setName("SketchCircle_15")
139 SketchCircle_15.results()[1].setName("SketchCircle_15_2")
140 SketchLine_16 = Sketch_2.addLine(0, 0, 0, 5)
141 SketchLine_16.setAuxiliary(True)
142 SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_16.startPoint())
143 SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchCircle_15.center(), SketchLine_16.endPoint())
144 SketchConstraintLength_6 = Sketch_2.setLength(SketchLine_16.result(), 5)
145 SketchProjection_6 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False)
146 SketchLine_17 = SketchProjection_6.createdFeature()
147 SketchConstraintCoincidence_31 = Sketch_2.setCoincident(SketchCircle_15.center(), SketchLine_17.result())
148 SketchConstraintRadius_5 = Sketch_2.setRadius(SketchCircle_15.results()[1], 0.45)
149 SketchProjection_7 = Sketch_2.addProjection(model.selection("EDGE", GeomAPI_Pnt(-6.2, 7.59281015471359e-16, 4)), False)
150 SketchCircle_16 = SketchProjection_7.createdFeature()
151 SketchCircle_16.setName("SketchCircle_16")
152 SketchCircle_16.result().setName("SketchCircle_16")
153 SketchCircle_16.results()[1].setName("SketchCircle_16_2")
154 SketchCircle_17 = Sketch_2.addCircle(4.259590630302756, -2.982597469025441, 0.5)
155 SketchCircle_17.setName("SketchCircle_18")
156 SketchCircle_17.result().setName("SketchCircle_18")
157 SketchCircle_17.results()[1].setName("SketchCircle_18_2")
158 SketchCircle_18 = Sketch_2.addCircle(3.276608177155966, -2.294305745404186, 0.3)
159 SketchCircle_18.setName("SketchCircle_19")
160 SketchCircle_18.result().setName("SketchCircle_19")
161 SketchCircle_18.results()[1].setName("SketchCircle_19_2")
162 SketchLine_18 = Sketch_2.addLine(0, 0, 4.259590630302756, -2.982597469025441)
163 SketchLine_18.setAuxiliary(True)
164 SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_18.startPoint())
165 SketchConstraintCoincidence_33 = Sketch_2.setCoincident(SketchCircle_17.center(), SketchLine_18.endPoint())
166 SketchConstraintCoincidence_34 = Sketch_2.setCoincident(SketchCircle_18.center(), SketchLine_18.result())
167 SketchProjection_8 = Sketch_2.addProjection(model.selection("EDGE", GeomAPI_Pnt(3.1, 0, 4)), False)
168 SketchLine_19 = SketchProjection_8.createdFeature()
169 SketchConstraintAngle_6 = Sketch_2.setAngleBackward(SketchLine_19.result(), SketchLine_18.result(), 35)
170 SketchConstraintRadius_6 = Sketch_2.setRadius(SketchCircle_17.results()[1], 0.5)
171 SketchConstraintRadius_7 = Sketch_2.setRadius(SketchCircle_18.results()[1], 0.3)
172 SketchConstraintDistance_1 = Sketch_2.setDistance(SketchCircle_4.center(), SketchCircle_18.center(), 4, True)
173 SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_4.center(), SketchLine_18.endPoint(), 5.2, True)
174 model.do()
175 ExtrusionCut_1_objects_1 = [model.selection("WIRE", GeomAPI_Pnt(2.927018127601872, 2.325000000002457, 4)), model.selection("WIRE", GeomAPI_Pnt(1.848443178812738, 3.921770223029927, 4)), model.selection("WIRE", GeomAPI_Pnt(3.995574230355639, 0.2028301512488117, 4)), model.selection("WIRE_2", GeomAPI_Pnt(-3.148443178812729, 3.921770223029919, 4)), model.selection("WIRE", GeomAPI_Pnt(-5.127018127597639, 2.325000000000002, 4)), model.selection("WIRE_2", GeomAPI_Pnt(-5.29557423035565, 0.2028301512488154, 4)), model.selection("FACE", GeomAPI_Pnt(7.188472039842964e-12, -4.650000000090492, 4)), model.selection("FACE", GeomAPI_Pnt(4.259590630302756, -2.982597469025441, 4)), model.selection("FACE", GeomAPI_Pnt(3.276608177155966, -2.294305745404186, 4))]
176 ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_1_objects_1, model.selection(), model.selection("FACE", GeomAPI_Pnt(0, 0, 0)), 0, model.selection(), 0, [model.selection("SOLID", GeomAPI_Pnt(-7.561538823095622e-16, 6.008767139946657e-17, 2.62684985301323))])
177 ExtrusionCut_2_objects_1 = [model.selection("WIRE", GeomAPI_Pnt(-5.44557423035565, 0.2028301512488154, 4)), model.selection("WIRE", GeomAPI_Pnt(-3.298443178812729, 3.921770223029919, 4)), model.selection("WIRE", GeomAPI_Pnt(1.698443178812738, 3.921770223029927, 4)), model.selection("WIRE", GeomAPI_Pnt(3.845574230355639, 0.2028301512488117, 4))]
178 ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_2_objects_1, model.selection(), 0, 0.75, [model.selection("SOLID", GeomAPI_Pnt(0.06663461012735418, 0.05143712897449785, 2.675990079155852))])
179 Axis_4 = model.addAxis(Part_1_doc, 0, -1, -10)
180 ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", GeomAPI_Pnt(-0.45, 5, 4))], model.selection("EDGE", GeomAPI_Pnt(0, -0.5, -5)), 10, 10, [model.selection("SOLID", GeomAPI_Pnt(0.06614791498027658, 0.06612435067467369, 2.67762623401837))])
181 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", GeomAPI_Pnt(-2.14713105154291, -4.124600374278729, 4)), model.selection("FACE", GeomAPI_Pnt(2.14713105154291, -4.124600374278742, 4))], model.selection(), model.selection("FACE", GeomAPI_Pnt(0, 0, 0)), 0, model.selection(), 0)
182 Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
183 SketchLine_20 = Sketch_3.addLine(3.5, 2.508501119175777, 3.5, 4)
184 SketchLine_21 = Sketch_3.addLine(3.5, 4, 6.2, 4)
185 SketchConstraintCoincidence_35 = Sketch_3.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint())
186 SketchLine_22 = Sketch_3.addLine(6.2, 4, 6.2, 3.008501119175777)
187 SketchConstraintCoincidence_36 = Sketch_3.setCoincident(SketchLine_21.endPoint(), SketchLine_22.startPoint())
188 SketchLine_23 = Sketch_3.addLine(6.2, 3.008501119175777, 3.5, 2.508501119175777)
189 SketchConstraintCoincidence_37 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint())
190 SketchConstraintCoincidence_38 = Sketch_3.setCoincident(SketchLine_23.endPoint(), SketchLine_20.startPoint())
191 SketchConstraintVertical_3 = Sketch_3.setVertical(SketchLine_20.result())
192 SketchProjection_9 = Sketch_3.addProjection(model.selection("EDGE_9", GeomAPI_Pnt(3.5, 0, 1)), False)
193 SketchLine_24 = SketchProjection_9.createdFeature()
194 SketchConstraintCoincidence_39 = Sketch_3.setCoincident(SketchLine_20.startPoint(), SketchLine_24.result())
195 SketchProjection_10 = Sketch_3.addProjection(model.selection("EDGE_3", GeomAPI_Pnt(4.85, 0, 2.25)), False)
196 SketchLine_25 = SketchProjection_10.createdFeature()
197 SketchConstraintParallel_1 = Sketch_3.setParallel(SketchLine_23.result(), SketchLine_25.result())
198 SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_22.result())
199 SketchProjection_11 = Sketch_3.addProjection(model.selection("EDGE_9", GeomAPI_Pnt(6.2, 0, 3.25)), False)
200 SketchLine_26 = SketchProjection_11.createdFeature()
201 SketchConstraintCoincidence_40 = Sketch_3.setCoincident(SketchLine_23.startPoint(), SketchLine_26.result())
202 SketchConstraintHorizontal_2 = Sketch_3.setHorizontal(SketchLine_21.result())
203 SketchConstraintDistance_3 = Sketch_3.setDistance(SketchLine_20.startPoint(), SketchLine_25.result(), 0.5, True)
204 SketchProjection_12 = Sketch_3.addProjection(model.selection("EDGE_5", GeomAPI_Pnt(3.1, 0, 4)), False)
205 SketchLine_27 = SketchProjection_12.createdFeature()
206 SketchConstraintCoincidence_41 = Sketch_3.setCoincident(SketchLine_20.endPoint(), SketchLine_27.result())
207 model.do()
208 Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", GeomAPI_Pnt(4.850000000000001, 0, 3.254250559587889))], model.selection("EDGE", "PartSet/OZ"), 360, 0)
209 Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", GeomAPI_Pnt(-2.14713105154291, -4.124600374278729, 2)), model.selection("SOLID", GeomAPI_Pnt(2.14713105154291, -4.124600374278742, 2))], [model.selection("SOLID", GeomAPI_Pnt(-1.278142456973851e-15, 2.734224632526547e-16, 3.386836255166113))])
210 Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", GeomAPI_Pnt(0.06552679693747457, 0.1115566065149892, 2.681859907222054))], [model.selection("SOLID", GeomAPI_Pnt(-2.134018078943279, -4.099410579753945, 3.358593616213623)), model.selection("SOLID", GeomAPI_Pnt(2.134018071503405, -4.099410583757958, 3.358593616233432))])
211 model.do()
212 model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
213 model.end()
214
215 assert(model.checkPythonDump())