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