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