Salome HOME
Fix for the restore of selection attribute state. Based on "CEA Parametric.pdf",...
[modules/shaper.git] / src / ModelAPI / Test / TestSelectionRestore.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 # Test that invalid selection attributes become valid after the parameters changes and
22 # coming the topology back in a valid state.
23 # Based on the CEA report mail 04.12.2018, page 6
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, "ep_base", "0.65")
32 EpVoiles = model.addParameter(Part_1_doc, "ep_voiles", "0.1")
33 model.addParameter(Part_1_doc, "ep_poteau", "0.15")
34 model.addParameter(Part_1_doc, "h_ouverture", "0.95")
35 model.addParameter(Part_1_doc, "h_apres_ouverture", "0.6")
36 model.addParameter(Part_1_doc, "ep_dalles", "0.12")
37 Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
38 SketchLine_1 = Sketch_1.addLine(0.275, 3.325, -0.375, 3.325)
39 SketchLine_2 = Sketch_1.addLine(-0.375, 3.325, -0.375, -0.325)
40 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
41 SketchLine_3 = Sketch_1.addLine(-0.375, -0.325, 4.275, -0.325)
42 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
43 SketchLine_4 = Sketch_1.addLine(4.275, -0.325, 4.275, 1.325)
44 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
45 SketchLine_5 = Sketch_1.addLine(4.275, 1.325, 3.625, 1.325)
46 SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
47 SketchLine_6 = Sketch_1.addLine(3.625, 1.325, 3.625, 0.325)
48 SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
49 SketchLine_7 = Sketch_1.addLine(3.625, 0.325, 0.275, 0.3250000000000001)
50 SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
51 SketchLine_8 = Sketch_1.addLine(0.275, 0.3250000000000001, 0.275, 3.325)
52 SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
53 SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_8.endPoint())
54 SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
55 SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result())
56 SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_3.result())
57 SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result())
58 SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
59 SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_8.result())
60 SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result())
61 SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_4.result())
62 SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "ep_base")
63 SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 3.65)
64 SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_3.result(), 4.65)
65 SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_4.result(), 1.65)
66 SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_7.startPoint(), SketchLine_3.result(), "ep_base", False)
67 SketchLine_9 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX"))
68 SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_9.result(), "0.275+ep_voiles/2", False)
69 SketchLine_10 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OY"))
70 SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_10.result(), "0.325+ep_voiles/2", False)
71 SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_1.result())
72 model.do()
73 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")], model.selection(), 0, 0.3)
74 Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/From_Face"))
75 SketchLine_11 = Sketch_2.addLine(2.26, -2.31, 1.64, -2.31)
76 SketchLine_12 = Sketch_2.addLine(1.64, -2.31, 1.64, -1.69)
77 SketchLine_13 = Sketch_2.addLine(1.64, -1.69, 2.26, -1.69)
78 SketchLine_14 = Sketch_2.addLine(2.26, -1.69, 2.26, -2.31)
79 SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_11.startPoint())
80 SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint())
81 SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint())
82 SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint())
83 SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_11.result())
84 SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_12.result())
85 SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_13.result())
86 SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_14.result())
87 SketchPoint_1 = Sketch_2.addPoint(1.925, -1.875)
88 SketchConstraintLength_5 = Sketch_2.setLength(SketchLine_11.result(), 0.62)
89 SketchConstraintLength_5.setName("SketchConstraintLength_10")
90 SketchConstraintEqual_2 = Sketch_2.setEqual(SketchLine_11.result(), SketchLine_12.result())
91 SketchConstraintDistance_4 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_13.result(), "0.11+ep_poteau/2", False)
92 SketchConstraintDistance_4.setName("SketchConstraintDistance_6")
93 SketchConstraintDistance_5 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_12.result(), "0.21+ep_poteau/2", False)
94 SketchConstraintDistance_5.setName("SketchConstraintDistance_7")
95 SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False)
96 SketchLine_15 = SketchProjection_1.createdFeature()
97 SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False)
98 SketchLine_16 = SketchProjection_2.createdFeature()
99 SketchConstraintDistance_6 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_15.result(), "1.75+ep_poteau/2+ep_voiles/2", False)
100 SketchConstraintDistance_6.setName("SketchConstraintDistance_8")
101 SketchConstraintDistance_7 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_16.result(), "1.8+ep_poteau/2+ep_voiles/2", False)
102 SketchConstraintDistance_7.setName("SketchConstraintDistance_9")
103 model.do()
104 Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_14r-SketchLine_13r-SketchLine_12r-SketchLine_11r")], model.selection(), 0, 0.02)
105 Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f"))
106 SketchLine_17 = Sketch_3.addLine(0, 2.950000000000001, 0, 1.700000000000001)
107 SketchLine_17.setName("SketchLine_15")
108 SketchLine_17.result().setName("SketchLine_15")
109 SketchLine_18 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OY"))
110 SketchLine_18.setName("SketchLine_16")
111 SketchLine_18.result().setName("SketchLine_16")
112 SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_17.startPoint(), SketchLine_18.result())
113 SketchConstraintCoincidence_14 = Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchLine_18.result())
114 SketchLine_19 = Sketch_3.addLine(0, 1.2, 0, 0)
115 SketchLine_19.setName("SketchLine_17")
116 SketchLine_19.result().setName("SketchLine_17")
117 SketchConstraintCoincidence_15 = Sketch_3.setCoincident(SketchLine_19.startPoint(), SketchLine_18.result())
118 SketchConstraintCoincidence_16 = Sketch_3.setCoincident(SketchLine_19.endPoint(), SketchLine_18.result())
119 SketchLine_20 = Sketch_3.addLine(0, 0, 0.95, 0)
120 SketchLine_20.setName("SketchLine_18")
121 SketchLine_20.result().setName("SketchLine_18")
122 SketchLine_21 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OX"))
123 SketchLine_21.setName("SketchLine_19")
124 SketchLine_21.result().setName("SketchLine_19")
125 SketchLine_22 = Sketch_3.addLine(2.525000000000001, 0, 3.975000000000001, 0)
126 SketchLine_22.setName("SketchLine_20")
127 SketchLine_22.result().setName("SketchLine_20")
128 SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_22.startPoint(), SketchLine_21.result())
129 SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_21.result())
130 SketchLine_23 = Sketch_3.addLine(3.975000000000001, 0, 3.975000000000001, 0.95)
131 SketchLine_23.setName("SketchLine_21")
132 SketchLine_23.result().setName("SketchLine_21")
133 SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint())
134 SketchLine_24 = Sketch_3.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"))
135 SketchLine_24.setName("SketchLine_22")
136 SketchLine_24.result().setName("SketchLine_22")
137 SketchConstraintLength_6 = Sketch_3.setLength(SketchLine_17.result(), 1.25)
138 SketchConstraintLength_6.setName("SketchConstraintLength_5")
139 SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_19.endPoint(), SketchLine_18.startPoint())
140 SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_20.startPoint(), SketchLine_19.endPoint())
141 SketchConstraintLength_7 = Sketch_3.setLength(SketchLine_19.result(), "1.25-ep_voiles/2")
142 SketchConstraintLength_7.setName("SketchConstraintLength_6")
143 SketchConstraintLength_8 = Sketch_3.setLength(SketchLine_20.result(), "1-ep_voiles/2")
144 SketchConstraintLength_8.setName("SketchConstraintLength_7")
145 SketchConstraintLength_9 = Sketch_3.setLength(SketchLine_22.result(), "1.5-ep_voiles/2")
146 SketchConstraintLength_9.setName("SketchConstraintLength_8")
147 SketchConstraintVertical_7 = Sketch_3.setVertical(SketchLine_23.result())
148 SketchLine_25 = Sketch_3.addLine(model.selection("EDGE", "Sketch_1/SketchLine_4"))
149 SketchLine_25.setName("SketchLine_23")
150 SketchLine_25.result().setName("SketchLine_23")
151 SketchConstraintDistance_8 = Sketch_3.setDistance(SketchLine_22.endPoint(), SketchLine_25.result(), "0.25+ep_voiles/2", False)
152 SketchConstraintDistance_8.setName("SketchConstraintDistance_5")
153 SketchConstraintLength_10 = Sketch_3.setLength(SketchLine_23.result(), "1-ep_voiles/2")
154 SketchConstraintLength_10.setName("SketchConstraintLength_9")
155 SketchLine_26 = Sketch_3.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]"))
156 SketchLine_26.setName("SketchLine_35")
157 SketchLine_26.result().setName("SketchLine_35")
158 SketchConstraintDistance_9 = Sketch_3.setDistance(SketchLine_17.startPoint(), SketchLine_26.result(), 0.375, False)
159 SketchConstraintDistance_9.setName("SketchConstraintDistance_12")
160 model.do()
161 Edge_1_objects = [model.selection("EDGE", "Sketch_3/SketchLine_15"), model.selection("EDGE", "Sketch_3/SketchLine_17"), model.selection("EDGE", "Sketch_3/SketchLine_18"), model.selection("EDGE", "Sketch_3/SketchLine_20"), model.selection("EDGE", "Sketch_3/SketchLine_21")]
162 Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects)
163 Extrusion_3_objects = [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_1_2"), model.selection("EDGE", "Edge_1_3"), model.selection("EDGE", "Edge_1_4"), model.selection("EDGE", "Edge_1_5")]
164 Extrusion_3 = model.addExtrusion(Part_1_doc, Extrusion_3_objects, model.selection("EDGE", "PartSet/OZ"), "h_ouverture", 0)
165 Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Extrusion_3_1/Generated_Edge&Sketch_3/SketchLine_15_StartVertex]e[Extrusion_3_1/To_Edge]e"), model.selection("VERTEX", "[Extrusion_3_3/Generated_Edge&Sketch_3/SketchLine_18_StartVertex]e[Extrusion_3_3/To_Edge]e"), model.selection("VERTEX", "[Extrusion_3_4/Generated_Edge&Sketch_3/SketchLine_20_EndVertex]e[Extrusion_3_4/To_Edge]e"))
166 Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
167 SketchLine_27 = Sketch_4.addLine(0, 2.950000000000001, 0, 0)
168 SketchLine_27.setName("SketchLine_26")
169 SketchLine_27.result().setName("SketchLine_26")
170 SketchPoint_2 = Sketch_4.addPoint(model.selection("VERTEX", "[Extrusion_3_1/Generated_Edge&Sketch_3/SketchLine_15_StartVertex]e[Extrusion_3_1/To_Edge]e"))
171 SketchConstraintCoincidence_22 = Sketch_4.setCoincident(SketchLine_27.startPoint(), SketchPoint_2.result())
172 SketchPoint_3 = Sketch_4.addPoint(model.selection("VERTEX", "[Extrusion_3_3/Generated_Edge&Sketch_3/SketchLine_18_StartVertex]e[Extrusion_3_3/To_Edge]e"))
173 SketchConstraintCoincidence_23 = Sketch_4.setCoincident(SketchLine_27.endPoint(), SketchPoint_3.result())
174 SketchLine_28 = Sketch_4.addLine(0, 0, 3.975000000000001, 0)
175 SketchLine_28.setName("SketchLine_27")
176 SketchLine_28.result().setName("SketchLine_27")
177 SketchConstraintCoincidence_24 = Sketch_4.setCoincident(SketchLine_27.endPoint(), SketchLine_28.startPoint())
178 SketchPoint_4 = Sketch_4.addPoint(model.selection("VERTEX", "[Extrusion_3_4/Generated_Edge&Sketch_3/SketchLine_20_EndVertex]e[Extrusion_3_4/To_Edge]e"))
179 SketchConstraintCoincidence_25 = Sketch_4.setCoincident(SketchLine_28.endPoint(), SketchPoint_4.result())
180 SketchLine_29 = Sketch_4.addLine(3.975000000000001, 0, 3.975000000000001, 0.95)
181 SketchLine_29.setName("SketchLine_28")
182 SketchLine_29.result().setName("SketchLine_28")
183 SketchConstraintCoincidence_26 = Sketch_4.setCoincident(SketchLine_28.endPoint(), SketchLine_29.startPoint())
184 SketchPoint_5 = Sketch_4.addPoint(model.selection("VERTEX", "[Extrusion_3_5/Generated_Edge&Sketch_3/SketchLine_21_EndVertex]e[Extrusion_3_5/To_Edge]e"))
185 SketchConstraintCoincidence_27 = Sketch_4.setCoincident(SketchLine_29.endPoint(), SketchPoint_5.result())
186 model.do()
187 Edge_2_objects = [model.selection("EDGE", "Sketch_4/SketchLine_26"), model.selection("EDGE", "Sketch_4/SketchLine_27"), model.selection("EDGE", "Sketch_4/SketchLine_28")]
188 Edge_2 = model.addEdge(Part_1_doc, Edge_2_objects)
189 Extrusion_4_objects = [model.selection("EDGE", "Edge_2_1"), model.selection("EDGE", "Edge_2_2"), model.selection("EDGE", "Edge_2_3")]
190 Extrusion_4 = model.addExtrusion(Part_1_doc, Extrusion_4_objects, model.selection("EDGE", "PartSet/OZ"), "h_apres_ouverture-ep_dalles/2", 0)
191 Plane_5 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Extrusion_4_1/Generated_Edge&Sketch_4/SketchLine_26_StartVertex]e[Extrusion_4_1/To_Edge]e"), model.selection("VERTEX", "[Extrusion_4_1/Generated_Edge&Sketch_4/SketchLine_26_EndVertex]e[Extrusion_4_1/To_Edge]e"), model.selection("VERTEX", "[Extrusion_4_2/Generated_Edge&Sketch_4/SketchLine_27_EndVertex]e[Extrusion_4_2/To_Edge]e"))
192 Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2"))
193 SketchLine_30 = Sketch_5.addLine(0, 2.950000000000001, 0, 0)
194 SketchLine_30.setName("SketchLine_29")
195 SketchLine_30.result().setName("SketchLine_29")
196 SketchPoint_6 = Sketch_5.addPoint(model.selection("VERTEX", "[Extrusion_4_1/Generated_Edge&Sketch_4/SketchLine_26_StartVertex]e[Extrusion_4_1/To_Edge]e"))
197 SketchConstraintCoincidence_28 = Sketch_5.setCoincident(SketchLine_30.startPoint(), SketchPoint_6.result())
198 SketchPoint_7 = Sketch_5.addPoint(model.selection("VERTEX", "[Extrusion_4_1/Generated_Edge&Sketch_4/SketchLine_26_EndVertex]e[Extrusion_4_1/To_Edge]e"))
199 SketchConstraintCoincidence_29 = Sketch_5.setCoincident(SketchLine_30.endPoint(), SketchPoint_7.result())
200 SketchLine_31 = Sketch_5.addLine(0, 0, 3.975000000000001, 0)
201 SketchLine_31.setName("SketchLine_30")
202 SketchLine_31.result().setName("SketchLine_30")
203 SketchConstraintCoincidence_30 = Sketch_5.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint())
204 SketchPoint_8 = Sketch_5.addPoint(model.selection("VERTEX", "[Extrusion_4_2/Generated_Edge&Sketch_4/SketchLine_27_EndVertex]e[Extrusion_4_2/To_Edge]e"))
205 SketchConstraintCoincidence_31 = Sketch_5.setCoincident(SketchLine_31.endPoint(), SketchPoint_8.result())
206 SketchLine_32 = Sketch_5.addLine(3.975000000000001, 0, 3.975000000000001, 0.95)
207 SketchLine_32.setName("SketchLine_31")
208 SketchLine_32.result().setName("SketchLine_31")
209 SketchConstraintCoincidence_32 = Sketch_5.setCoincident(SketchLine_31.endPoint(), SketchLine_32.startPoint())
210 SketchPoint_9 = Sketch_5.addPoint(model.selection("VERTEX", "[Extrusion_4_3/Generated_Edge&Sketch_4/SketchLine_28_EndVertex]e[Extrusion_4_3/To_Edge]e"))
211 SketchConstraintCoincidence_33 = Sketch_5.setCoincident(SketchLine_32.endPoint(), SketchPoint_9.result())
212 SketchLine_33 = Sketch_5.addLine(3.975000000000001, 0.95, 0, 2.950000000000001)
213 SketchLine_33.setName("SketchLine_32")
214 SketchLine_33.result().setName("SketchLine_32")
215 SketchConstraintCoincidence_34 = Sketch_5.setCoincident(SketchLine_32.endPoint(), SketchLine_33.startPoint())
216 SketchConstraintCoincidence_35 = Sketch_5.setCoincident(SketchLine_30.startPoint(), SketchLine_33.endPoint())
217 SketchConstraintCoincidence_36 = Sketch_5.setCoincident(SketchPoint_6.coordinates(), SketchLine_33.endPoint())
218 SketchLine_34 = Sketch_5.addLine(1.85, 2.019182389937107, 1.85, 0)
219 SketchLine_34.setName("SketchLine_33")
220 SketchLine_34.result().setName("SketchLine_33")
221 SketchConstraintCoincidence_37 = Sketch_5.setCoincident(SketchLine_34.startPoint(), SketchLine_33.result())
222 SketchLine_35 = Sketch_5.addLine(2.075000000000001, 1.905974842767296, 2.075000000000001, 0)
223 SketchLine_35.setName("SketchLine_34")
224 SketchLine_35.result().setName("SketchLine_34")
225 SketchConstraintCoincidence_38 = Sketch_5.setCoincident(SketchLine_35.startPoint(), SketchLine_33.result())
226 SketchConstraintCoincidence_39 = Sketch_5.setCoincident(SketchLine_35.endPoint(), SketchLine_31.result())
227 SketchConstraintCoincidence_40 = Sketch_5.setCoincident(SketchLine_34.endPoint(), SketchLine_31.result())
228 SketchConstraintVertical_8 = Sketch_5.setVertical(SketchLine_34.result())
229 SketchConstraintVertical_9 = Sketch_5.setVertical(SketchLine_35.result())
230 SketchConstraintDistance_10 = Sketch_5.setDistance(SketchLine_34.startPoint(), SketchLine_30.result(), "1.8+ep_voiles/2", False)
231 SketchConstraintDistance_10.setName("SketchConstraintDistance_10")
232 SketchConstraintDistance_11 = Sketch_5.setDistance(SketchLine_35.startPoint(), SketchLine_32.result(), "1.85+ep_voiles/2", False)
233 SketchConstraintDistance_11.setName("SketchConstraintDistance_11")
234 model.do()
235 Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_5/Face-SketchLine_29r-SketchLine_30f-SketchLine_33r-SketchLine_32f_wire")])
236 Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_5/Face-SketchLine_30f-SketchLine_31f-SketchLine_32f-SketchLine_34f_wire")])
237 Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_5/Face-SketchLine_30f-SketchLine_34r-SketchLine_32f-SketchLine_33f_wire")])
238 Translation_1_objects = [model.selection("FACE", "Extrusion_4_3"), model.selection("FACE", "Extrusion_3_3"), model.selection("FACE", "Extrusion_4_2"), model.selection("FACE", "Extrusion_3_5"), model.selection("FACE", "Extrusion_3_4"), model.selection("FACE", "Extrusion_3_2"), model.selection("FACE", "Extrusion_4_1"), model.selection("FACE", "Extrusion_3_1"), model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_2_1")]
239 Translation_1 = model.addTranslation(Part_1_doc, Translation_1_objects, model.selection("EDGE", "PartSet/OZ"), "h_ouverture+h_apres_ouverture-ep_dalles/2")
240 Recover_1_objects = [Face_2.result(), Face_3.result(), Face_1.result(), Extrusion_3.result(), Extrusion_4.result(), Extrusion_3.results()[1], Extrusion_3.results()[3], Extrusion_3.results()[4], Extrusion_4.results()[1], Extrusion_3.results()[2], Extrusion_4.results()[2]]
241 Recover_1 = model.addRecover(Part_1_doc, Translation_1, Recover_1_objects)
242 Translation_2_objects = [model.selection("FACE", "Recover_1_2"), model.selection("FACE", "Recover_1_5"), model.selection("FACE", "Recover_1_3"), model.selection("FACE", "Recover_1_4"), model.selection("FACE", "Recover_1_1"), model.selection("FACE", "Recover_1_6"), model.selection("FACE", "Recover_1_8"), model.selection("FACE", "Recover_1_7"), model.selection("FACE", "Recover_1_11"), model.selection("FACE", "Recover_1_10"), model.selection("FACE", "Recover_1_9")]
243 Translation_2 = model.addTranslation(Part_1_doc, Translation_2_objects, model.selection("EDGE", "PartSet/OZ"), "2*(h_ouverture+h_apres_ouverture-ep_dalles/2)")
244 Recover_2_objects = [Recover_1.results()[8], Recover_1.results()[9], Recover_1.results()[10], Recover_1.results()[6], Recover_1.results()[7], Recover_1.results()[5], Recover_1.result(), Recover_1.results()[3], Recover_1.results()[2], Recover_1.results()[4], Recover_1.results()[1]]
245 Recover_2 = model.addRecover(Part_1_doc, Translation_2, Recover_2_objects)
246 Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_2/SketchPoint_1")])
247 Extrusion_5 = model.addExtrusion(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1")], model.selection("EDGE", "PartSet/OZ"), model.selection("FACE", "Translation_2_11"), 0, model.selection(), 0)
248 Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1"), model.selection("FACE", "Translation_1_1"), model.selection("FACE", "Translation_1_2"), model.selection("FACE", "Translation_1_3"), model.selection("FACE", "Translation_1_4"), model.selection("FACE", "Translation_1_5"), model.selection("FACE", "Translation_1_6"), model.selection("FACE", "Translation_1_7"), model.selection("FACE", "Translation_1_8"), model.selection("FACE", "Translation_1_9"), model.selection("FACE", "Translation_1_10"), model.selection("FACE", "Translation_1_11"), model.selection("FACE", "Translation_2_1"), model.selection("FACE", "Translation_2_2"), model.selection("FACE", "Translation_2_3"), model.selection("FACE", "Translation_2_4"), model.selection("FACE", "Translation_2_5"), model.selection("FACE", "Translation_2_6"), model.selection("FACE", "Translation_2_7"), model.selection("FACE", "Translation_2_8"), model.selection("FACE", "Translation_2_9"), model.selection("FACE", "Translation_2_10"), model.selection("FACE", "Translation_2_11"), model.selection("FACE", "Recover_2_1"), model.selection("FACE", "Recover_2_2"), model.selection("FACE", "Recover_2_3"), model.selection("FACE", "Recover_2_4"), model.selection("FACE", "Recover_2_5"), model.selection("FACE", "Recover_2_6"), model.selection("FACE", "Recover_2_7"), model.selection("FACE", "Recover_2_8"), model.selection("FACE", "Recover_2_9"), model.selection("FACE", "Recover_2_10"), model.selection("FACE", "Recover_2_11"), model.selection("EDGE", "Extrusion_5_1")]
249 Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
250 # create groups
251 model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc)
252 model.do()
253 # make parameter to de-touch some vertical edges and gorizontal faces =>
254 # two partition results are created instead of one => groups become invalid
255 EpVoiles.setValue(0.18)
256 model.do()
257
258 from ModelAPI import *
259 aFactory = ModelAPI_Session.get().validators()
260 for i in range(Part_1_doc.size("Groups")):
261   GroupFeature = Part_1_doc.feature(objectToResult(Part_1_doc.object("Groups", i)))
262   assert(aFactory.validate(GroupFeature) == False)
263
264
265 # move edges back, so, intersection re-appeared, so, groups should become valid
266 EpVoiles.setValue(0.17)
267
268 model.end()
269
270 for i in range(Part_1_doc.size("Groups")):
271   GroupFeature = Part_1_doc.feature(objectToResult(Part_1_doc.object("Groups", i)))
272   assert(aFactory.validate(GroupFeature))