Salome HOME
Copyright update 2022
[modules/shaper.git] / src / ModelAPI / Test / TestWeakNaming2445.py
1 # Copyright (C) 2014-2022  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, "R1", "50")
27 model.addParameter(Part_1_doc, "L1", "100")
28 model.addParameter(Part_1_doc, "R2", "40")
29 model.addParameter(Part_1_doc, "L2", "50")
30 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
31 SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
32 SketchPoint_1 = SketchProjection_1.createdFeature()
33 SketchCircle_1 = Sketch_1.addCircle(0, 0, 50)
34 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center())
35 SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], "R1")
36 SketchLine_1 = Sketch_1.addLine(0, 49.99999999999999, 0, 31.81980515339405)
37 SketchLine_2 = Sketch_1.addLine(-1.202451477893311e-021, -31.81980515339534, 0, -50)
38 SketchLine_2.setName("SketchLine_3")
39 SketchLine_2.result().setName("SketchLine_3")
40 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchCircle_1.results()[1])
41 SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_4")
42 SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result())
43 SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
44 SketchLine_3 = SketchProjection_2.createdFeature()
45 SketchLine_3.setName("SketchLine_4")
46 SketchLine_3.result().setName("SketchLine_4")
47 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.result(), SketchLine_1.startPoint())
48 SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_1.result(), SketchLine_2.result())
49 SketchLine_4 = Sketch_1.addLine(0, 31.81980515339405, 31.81980515339462, -6.650124210799604e-013)
50 SketchLine_4.setName("SketchLine_5")
51 SketchLine_4.result().setName("SketchLine_5")
52 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_4.startPoint())
53 SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_5")
54 SketchLine_5 = Sketch_1.addLine(31.81980515339462, -6.650124210799604e-013, -1.202451477893311e-021, -31.81980515339534)
55 SketchLine_5.setName("SketchLine_6")
56 SketchLine_5.result().setName("SketchLine_6")
57 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
58 SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_6")
59 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_5.endPoint())
60 SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_7")
61 SketchLine_6 = Sketch_1.addLine(-1.202451477893311e-021, -31.81980515339534, -31.8198051533955, -6.650124202329274e-013)
62 SketchLine_6.setName("SketchLine_7")
63 SketchLine_6.result().setName("SketchLine_7")
64 SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_6.startPoint())
65 SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_8")
66 SketchLine_7 = Sketch_1.addLine(-31.8198051533955, -6.650124202329274e-013, -8.789247626282909e-013, 31.81980515339405)
67 SketchLine_7.setName("SketchLine_8")
68 SketchLine_7.result().setName("SketchLine_8")
69 SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
70 SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_9")
71 SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_7.result(), SketchLine_4.result())
72 SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_7.result(), SketchLine_5.result())
73 SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_6.result())
74 SketchLine_8 = Sketch_1.addLine(-31.8198051533955, -6.650124202329274e-013, -50, -8.919190713816664e-015)
75 SketchLine_8.setName("SketchLine_9")
76 SketchLine_8.result().setName("SketchLine_9")
77 SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_8.startPoint())
78 SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_11")
79 SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchCircle_1.results()[1])
80 SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_12")
81 SketchLine_9 = Sketch_1.addLine(31.81980515339462, -6.650124210799604e-013, 50, -8.919190733668999e-015)
82 SketchLine_9.setName("SketchLine_10")
83 SketchLine_9.result().setName("SketchLine_10")
84 SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_9.startPoint())
85 SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_13")
86 SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchCircle_1.results()[1])
87 SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_14")
88 SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_6.result())
89 SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_7.result(), SketchLine_5.result())
90 SketchConstraintCollinear_2 = Sketch_1.setCollinear(SketchLine_8.result(), SketchLine_9.result())
91 SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_8.result())
92 SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_8.result(), SketchLine_1.result())
93 SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_1.result())
94 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_7.result(), "R1*0.9")
95 SketchConstraintLength_1.setName("SketchConstraintLength_2")
96 model.do()
97 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "L1", "L1")
98 Extrusion_1.result().setName("tuyau_principal")
99 Extrusion_1.result().subResult(0).setName("Extrusion_1_1_1")
100 Extrusion_1.result().subResult(1).setName("Extrusion_1_1_2")
101 Extrusion_1.result().subResult(2).setName("Extrusion_1_1_3")
102 Extrusion_1.result().subResult(3).setName("Extrusion_1_1_4")
103 Extrusion_1.result().subResult(4).setName("Extrusion_1_1_5")
104 Rotation_1 = model.addRotation(Part_1_doc, [model.selection("COMPSOLID", "tuyau_principal")], model.selection("EDGE", "PartSet/OX"), 45)
105 Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
106 SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
107 SketchPoint_2 = SketchProjection_3.createdFeature()
108 SketchCircle_2 = Sketch_2.addCircle(0, 0, 40)
109 SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchPoint_2.result(), SketchCircle_2.center())
110 SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_15")
111 SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_2.results()[1], "R2")
112 model.do()
113 Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], model.selection(), 0, "R1+L2")
114 Extrusion_2.result().setName("piquage")
115 Smash_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "piquage")], [model.selection("COMPSOLID", "tuyau_principal")])
116 Smash_1.result().setName("té")
117 Smash_1.result().setColor(153, 76, 153)
118 Smash_1.result().subResult(0).setName("Smash_1_1_1")
119 Smash_1.result().subResult(0).setColor(51, 102, 51)
120 Smash_1.result().subResult(1).setName("Smash_1_1_2")
121 Smash_1.result().subResult(1).setColor(0, 204, 0)
122 Smash_1.result().subResult(2).setName("Smash_1_1_3")
123 Smash_1.result().subResult(2).setColor(204, 102, 204)
124 Smash_1.result().subResult(3).setName("Smash_1_1_4")
125 Smash_1.result().subResult(3).setColor(204, 102, 204)
126 Smash_1.result().subResult(4).setName("Smash_1_1_5")
127 Smash_1.result().subResult(4).setColor(204, 0, 204)
128 Smash_1.result().subResult(5).setName("Smash_1_1_6")
129 Smash_1.result().subResult(5).setColor(76, 76, 153)
130 Recover_1 = model.addRecover(Part_1_doc, Smash_1, [Extrusion_2.result(), Rotation_1.result()])
131 Recover_1.result().setName("tuyau_principal")
132 Recover_1.result().subResult(0).setName("Recover_1_1_1")
133 Recover_1.result().subResult(1).setName("Recover_1_1_2")
134 Recover_1.result().subResult(2).setName("Recover_1_1_3")
135 Recover_1.result().subResult(3).setName("Recover_1_1_4")
136 Recover_1.result().subResult(4).setName("Recover_1_1_5")
137 Recover_1.results()[1].setName("piquage")
138 Intersection_1 = model.addIntersection(Part_1_doc, [model.selection("COMPSOLID", "tuyau_principal"), model.selection("SOLID", "piquage")])
139 Intersection_1.result().setName("intersection")
140 Intersection_1.result().subResult(0).setName("Intersection_1_1_1")
141 Intersection_1.result().subResult(1).setName("Intersection_1_1_2")
142 Intersection_1.result().subResult(2).setName("Intersection_1_1_3")
143 Intersection_1.result().subResult(3).setName("Intersection_1_1_4")
144 Intersection_1.result().subResult(4).setName("Intersection_1_1_5")
145 Intersection_1.result().subResult(5).setName("Intersection_1_1_6")
146 Intersection_1.result().subResult(6).setName("Intersection_1_1_7")
147 Intersection_1.result().subResult(7).setName("Intersection_1_1_8")
148 Intersection_1.result().subResult(8).setName("Intersection_1_1_9")
149 Intersection_1.result().subResult(9).setName("Intersection_1_1_10")
150 Intersection_1.result().subResult(10).setName("Intersection_1_1_11")
151 Intersection_1.result().subResult(11).setName("Intersection_1_1_12")
152 Intersection_1.result().subResult(12).setName("Intersection_1_1_13")
153 Intersection_1.result().subResult(13).setName("Intersection_1_1_14")
154 Intersection_1.result().subResult(14).setName("Intersection_1_1_15")
155 Intersection_1.result().subResult(15).setName("Intersection_1_1_16")
156 Intersection_1.result().subResult(16).setName("Intersection_1_1_17")
157 Edge_1_objects = [model.selection("EDGE", "Intersection_1_1_3"), model.selection("EDGE", "Intersection_1_1_12"), model.selection("EDGE", "Intersection_1_1_14"), model.selection("EDGE", "Intersection_1_1_5"), model.selection("EDGE", "Intersection_1_1_1")]
158 Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects)
159 Edge_1.results()[1].setName("intersection_1")
160 Edge_1.results()[2].setName("intersection_2")
161 Edge_1.results()[3].setName("intersection_3")
162 Edge_1.results()[4].setName("intersection_4")
163 model.do()
164 model.testHaveNamingSubshapes(Edge_1, model, Part_1_doc)
165 model.end()