1 # -*- coding: utf-8 -*-
4 HYDRO_SAMPLES = os.path.join( os.environ["HYDRO_ROOT_DIR"], "bin/salome/test/HYDRO")
11 #----------------------
13 #----------------------
16 from PyQt5.QtCore import *
17 from PyQt5.QtGui import *
19 hydro_doc = HYDROData_Document.Document()
21 hydro_doc.SetLocalCS( 430000, 6.35e+06 )
23 garonne_ign_01 = hydro_doc.CreateObject( KIND_IMAGE )
24 garonne_ign_01.SetName( "garonne_ign_01" )
26 garonne_ign_01.SetZLevel( 0 )
29 if not(garonne_ign_01.LoadImage(os.path.join(HYDRO_SAMPLES, "garonne_ign_01.png" ))):
30 raise ValueError('problem while loading image')
32 garonne_ign_01.SetLocalPoints( QPoint( 40, 817 ),
35 garonne_ign_01.SetGlobalPoints( 1,
36 QPointF( 471562, 6.36775e+06 ),
37 QPointF( 489400, 6.37702e+06 ) )
39 garonne_ign_01.Update()
41 garonne_ign_02 = hydro_doc.CreateObject( KIND_IMAGE )
42 garonne_ign_02.SetName( "garonne_ign_02" )
44 garonne_ign_02.SetZLevel( 1 )
47 if not(garonne_ign_02.LoadImage( os.path.join(HYDRO_SAMPLES, "garonne_ign_02.png" ))):
48 raise ValueError('problem while loading image')
50 garonne_ign_02.SetLocalPoints( QPoint( 1389, 447 ),
53 garonne_ign_02.SetGlobalPoints( 3,
56 garonne_ign_02.SetTrsfReferenceImage( garonne_ign_01 )
58 garonne_ign_02.Update()
60 garonne = hydro_doc.CreateObject( KIND_POLYLINEXY )
61 garonne.SetName( "garonne" )
63 garonne.SetZLevel( 2 )
65 garonne.AddSection( "Section_1", 1, 1 )
66 garonne.AddPoint( 0, gp_XY( 38191.48, 33184.55 ) )
67 garonne.AddPoint( 0, gp_XY( 38553.78, 33013.53 ) )
68 garonne.AddPoint( 0, gp_XY( 38993.90, 32767.64 ) )
69 garonne.AddPoint( 0, gp_XY( 39678.58, 32533.58 ) )
70 garonne.AddPoint( 0, gp_XY( 40240.26, 32305.27 ) )
71 garonne.AddPoint( 0, gp_XY( 40717.94, 32193.70 ) )
72 garonne.AddPoint( 0, gp_XY( 41361.00, 32464.18 ) )
73 garonne.AddPoint( 0, gp_XY( 41831.41, 32626.69 ) )
74 garonne.AddPoint( 0, gp_XY( 41950.14, 32618.24 ) )
75 garonne.AddPoint( 0, gp_XY( 42524.97, 32419.61 ) )
76 garonne.AddPoint( 0, gp_XY( 42909.80, 32291.33 ) )
77 garonne.AddPoint( 0, gp_XY( 43177.03, 32269.95 ) )
78 garonne.AddPoint( 0, gp_XY( 43465.65, 32344.78 ) )
79 garonne.AddPoint( 0, gp_XY( 43754.27, 32152.37 ) )
80 garonne.AddPoint( 0, gp_XY( 44128.40, 31842.37 ) )
81 garonne.AddPoint( 0, gp_XY( 44003.90, 31269.93 ) )
82 garonne.AddPoint( 0, gp_XY( 44010.82, 30869.63 ) )
83 garonne.AddPoint( 0, gp_XY( 44064.26, 30655.84 ) )
84 garonne.AddPoint( 0, gp_XY( 44434.73, 30366.18 ) )
85 garonne.AddPoint( 0, gp_XY( 45208.04, 30484.81 ) )
86 garonne.AddPoint( 0, gp_XY( 45705.01, 30287.34 ) )
87 garonne.AddPoint( 0, gp_XY( 45933.89, 30046.87 ) )
88 garonne.AddPoint( 0, gp_XY( 46127.34, 29490.68 ) )
89 garonne.AddPoint( 0, gp_XY( 46111.60, 29226.08 ) )
90 garonne.AddPoint( 0, gp_XY( 46228.62, 28784.05 ) )
91 garonne.AddPoint( 0, gp_XY( 46247.64, 28449.75 ) )
92 garonne.AddPoint( 0, gp_XY( 46108.48, 28086.94 ) )
93 garonne.AddPoint( 0, gp_XY( 45618.52, 27553.74 ) )
94 garonne.AddPoint( 0, gp_XY( 45276.77, 27042.78 ) )
95 garonne.AddPoint( 0, gp_XY( 45001.89, 26273.15 ) )
96 garonne.AddPoint( 0, gp_XY( 45167.76, 25975.34 ) )
97 garonne.AddPoint( 0, gp_XY( 46018.15, 25848.84 ) )
98 garonne.AddPoint( 0, gp_XY( 46378.94, 25872.21 ) )
99 garonne.AddPoint( 0, gp_XY( 46885.57, 25937.64 ) )
100 garonne.AddPoint( 0, gp_XY( 47278.36, 25782.88 ) )
101 garonne.AddPoint( 0, gp_XY( 47153.86, 25728.04 ) )
102 garonne.AddPoint( 0, gp_XY( 46987.51, 25749.97 ) )
103 garonne.AddPoint( 0, gp_XY( 46658.26, 25715.71 ) )
104 garonne.AddPoint( 0, gp_XY( 45650.76, 25634.46 ) )
105 garonne.AddPoint( 0, gp_XY( 45122.63, 25748.21 ) )
106 garonne.AddPoint( 0, gp_XY( 44797.63, 26325.09 ) )
107 garonne.AddPoint( 0, gp_XY( 45114.51, 27168.75 ) )
108 garonne.AddPoint( 0, gp_XY( 45508.28, 27713.21 ) )
109 garonne.AddPoint( 0, gp_XY( 45994.19, 28382.53 ) )
110 garonne.AddPoint( 0, gp_XY( 45927.01, 29201.34 ) )
111 garonne.AddPoint( 0, gp_XY( 45756.39, 29859.47 ) )
112 garonne.AddPoint( 0, gp_XY( 45390.76, 30151.97 ) )
113 garonne.AddPoint( 0, gp_XY( 45039.85, 30120.84 ) )
114 garonne.AddPoint( 0, gp_XY( 44513.26, 30084.28 ) )
115 garonne.AddPoint( 0, gp_XY( 43923.42, 30426.28 ) )
116 garonne.AddPoint( 0, gp_XY( 43768.81, 30934.29 ) )
117 garonne.AddPoint( 0, gp_XY( 43820.10, 31425.20 ) )
118 garonne.AddPoint( 0, gp_XY( 43854.78, 31801.12 ) )
119 garonne.AddPoint( 0, gp_XY( 43479.64, 32053.54 ) )
120 garonne.AddPoint( 0, gp_XY( 42923.47, 32051.85 ) )
121 garonne.AddPoint( 0, gp_XY( 42493.64, 32187.97 ) )
122 garonne.AddPoint( 0, gp_XY( 42074.27, 32302.91 ) )
123 garonne.AddPoint( 0, gp_XY( 41624.75, 32330.93 ) )
124 garonne.AddPoint( 0, gp_XY( 41325.93, 32187.97 ) )
125 garonne.AddPoint( 0, gp_XY( 40879.52, 31987.29 ) )
126 garonne.AddPoint( 0, gp_XY( 40308.78, 32018.46 ) )
127 garonne.AddPoint( 0, gp_XY( 39782.86, 32207.17 ) )
128 garonne.AddPoint( 0, gp_XY( 38814.10, 32560.43 ) )
129 garonne.AddPoint( 0, gp_XY( 38302.17, 32903.70 ) )
134 domaine = hydro_doc.CreateObject( KIND_POLYLINEXY )
135 domaine.SetName( "domaine" )
137 domaine.SetZLevel( 3 )
139 domaine.AddSection( "Section_1", 0, 1 )
140 domaine.AddPoint( 0, gp_XY( 39901.15, 34762.30 ) );
141 domaine.AddPoint( 0, gp_XY( 38086.50, 29964.69 ) );
142 domaine.AddPoint( 0, gp_XY( 44835.83, 24264.97 ) );
143 domaine.AddPoint( 0, gp_XY( 46758.56, 25021.86 ) );
144 domaine.AddPoint( 0, gp_XY( 46757.20, 26601.21 ) );
145 domaine.AddPoint( 0, gp_XY( 48566.45, 30152.81 ) );
146 domaine.AddPoint( 0, gp_XY( 45532.36, 33239.83 ) );
147 domaine.AddPoint( 0, gp_XY( 43548.77, 34048.39 ) );
152 lit_majeur = hydro_doc.CreateObject( KIND_POLYLINEXY )
153 lit_majeur.SetName( "lit_majeur" )
155 lit_majeur.SetZLevel( 7 )
157 lit_majeur.AddSection( "Section_1", 1, 1 )
158 lit_majeur.AddPoint( 0, gp_XY( 41225.22, 34118.46 ) )
159 lit_majeur.AddPoint( 0, gp_XY( 41716.41, 33705.87 ) )
160 lit_majeur.AddPoint( 0, gp_XY( 42384.43, 33293.27 ) )
161 lit_majeur.AddPoint( 0, gp_XY( 42561.26, 32684.19 ) )
162 lit_majeur.AddPoint( 0, gp_XY( 42875.62, 32369.83 ) )
163 lit_majeur.AddPoint( 0, gp_XY( 43700.82, 32350.18 ) )
164 lit_majeur.AddPoint( 0, gp_XY( 44526.02, 31662.51 ) )
165 lit_majeur.AddPoint( 0, gp_XY( 45370.87, 31819.69 ) )
166 lit_majeur.AddPoint( 0, gp_XY( 46274.66, 31682.16 ) )
167 lit_majeur.AddPoint( 0, gp_XY( 46981.97, 31328.50 ) )
168 lit_majeur.AddPoint( 0, gp_XY( 47021.27, 30719.43 ) )
169 lit_majeur.AddPoint( 0, gp_XY( 47217.74, 30051.41 ) )
170 lit_majeur.AddPoint( 0, gp_XY( 47846.46, 29560.22 ) )
171 lit_majeur.AddPoint( 0, gp_XY( 48730.61, 28735.02 ) )
172 lit_majeur.AddPoint( 0, gp_XY( 48809.20, 27732.99 ) )
173 lit_majeur.AddPoint( 0, gp_XY( 49143.21, 27163.21 ) )
174 lit_majeur.AddPoint( 0, gp_XY( 49654.05, 26829.20 ) )
175 lit_majeur.AddPoint( 0, gp_XY( 49693.34, 25355.63 ) )
176 lit_majeur.AddPoint( 0, gp_XY( 48612.72, 23214.04 ) )
177 lit_majeur.AddPoint( 0, gp_XY( 47453.51, 23115.80 ) )
178 lit_majeur.AddPoint( 0, gp_XY( 46471.13, 24176.77 ) )
179 lit_majeur.AddPoint( 0, gp_XY( 45960.29, 25257.39 ) )
180 lit_majeur.AddPoint( 0, gp_XY( 44899.32, 25591.40 ) )
181 lit_majeur.AddPoint( 0, gp_XY( 44270.60, 26573.78 ) )
182 lit_majeur.AddPoint( 0, gp_XY( 43248.92, 27909.82 ) )
183 lit_majeur.AddPoint( 0, gp_XY( 42757.73, 28243.83 ) )
184 lit_majeur.AddPoint( 0, gp_XY( 42266.54, 28342.07 ) )
185 lit_majeur.AddPoint( 0, gp_XY( 41736.06, 28106.30 ) )
186 lit_majeur.AddPoint( 0, gp_XY( 41402.05, 28833.26 ) )
187 lit_majeur.AddPoint( 0, gp_XY( 40910.86, 28911.85 ) )
188 lit_majeur.AddPoint( 0, gp_XY( 40576.85, 29324.45 ) )
189 lit_majeur.AddPoint( 0, gp_XY( 40144.60, 29599.51 ) )
190 lit_majeur.AddPoint( 0, gp_XY( 39024.69, 30130.00 ) )
191 lit_majeur.AddPoint( 0, gp_XY( 38612.09, 30365.77 ) )
192 lit_majeur.AddPoint( 0, gp_XY( 38828.21, 33391.50 ) )
196 axeDigue = hydro_doc.CreateObject( KIND_POLYLINEXY );
197 axeDigue.SetName( "axeDigue" );
199 axeDigue.SetZLevel( 8 );
201 axeDigue.AddSection( "Section_1", 1, 0 );
202 axeDigue.AddPoint( 0, gp_XY( 40961.39, 31800.95 ) );
203 axeDigue.AddPoint( 0, gp_XY( 41296.95, 31992.70 ) );
204 axeDigue.AddPoint( 0, gp_XY( 41656.48, 31872.85 ) );
205 axeDigue.AddPoint( 0, gp_XY( 42004.02, 31441.42 ) );
206 axeDigue.AddPoint( 0, gp_XY( 42123.86, 31021.97 ) );
207 axeDigue.AddPoint( 0, gp_XY( 42579.27, 30926.10 ) );
208 axeDigue.AddPoint( 0, gp_XY( 43082.60, 30638.48 ) );
209 axeDigue.AddPoint( 0, gp_XY( 43130.54, 30075.22 ) );
210 axeDigue.AddPoint( 0, gp_XY( 43538.00, 29763.63 ) );
211 axeDigue.AddPoint( 0, gp_XY( 44053.33, 29787.60 ) );
212 axeDigue.AddPoint( 0, gp_XY( 44736.43, 29847.52 ) );
217 Cloud_02 = hydro_doc.CreateObject( KIND_BATHYMETRY )
218 Cloud_02.SetName( "Cloud_02" )
220 Cloud_02.SetAltitudesInverted( 0 )
221 if not(Cloud_02.ImportFromFile( os.path.join(HYDRO_SAMPLES, "Cloud_02.xyz" ))):
222 raise ValueError('problem while loading bathymetry')
227 garonne_point_L93 = hydro_doc.CreateObject( KIND_BATHYMETRY )
228 garonne_point_L93.SetName( "garonne_point_L93" )
230 garonne_point_L93.SetAltitudesInverted( 0 )
231 if not(garonne_point_L93.ImportFromFile( os.path.join(HYDRO_SAMPLES, "garonne_point_L93.xyz" ))):
232 raise ValueError('problem while loading bathymetry')
234 garonne_point_L93.Update()
237 altitudeDigue = hydro_doc.CreateObject( KIND_PROFILE );
238 altitudeDigue.SetName( "altitudeDigue" );
240 profile_points = [ gp_XY( 1, 23 ),
241 gp_XY( 5000, 25.5 ) ];
242 altitudeDigue.SetParametricPoints( profile_points );
244 altitudeDigue.Update();
247 sectionDigue = hydro_doc.CreateObject( KIND_PROFILE );
248 sectionDigue.SetName( "sectionDigue" );
250 profile_points = [ gp_XY( -10, -10 ),
255 sectionDigue.SetParametricPoints( profile_points );
257 sectionDigue.Update();
260 axe3DDigue = hydro_doc.CreateObject( KIND_POLYLINE );
261 axe3DDigue.SetName( "axe3DDigue" );
263 axe3DDigue.SetPolylineXY( axeDigue );
264 axe3DDigue.SetProfileUZ( altitudeDigue.GetProfileUZ() );
269 litMineur = hydro_doc.CreateObject( KIND_IMMERSIBLE_ZONE )
270 litMineur.SetName( "litMineur" )
272 litMineur.SetZLevel( 6 )
274 litMineur.SetAltitudeObject( garonne_point_L93 )
275 litMineur.SetPolyline( garonne )
280 litMajeur = hydro_doc.CreateObject( KIND_IMMERSIBLE_ZONE )
281 litMajeur.SetName( "litMajeur" )
283 litMajeur.SetZLevel( 5 )
285 litMajeur.SetFillingColor( QColor( 0, 170, 127, 255 ) )
287 litMajeur.SetAltitudeObject( Cloud_02 )
288 litMajeur.SetPolyline( lit_majeur )
293 domaineEtendu = hydro_doc.CreateObject( KIND_IMMERSIBLE_ZONE )
294 domaineEtendu.SetName( "domaineEtendu" )
296 domaineEtendu.SetZLevel( 4 )
298 domaineEtendu.SetFillingColor( QColor( 201, 203, 55, 255 ) )
300 domaineEtendu.SetAltitudeObject( Cloud_02 )
301 domaineEtendu.SetPolyline( domaine )
303 domaineEtendu.Update()
306 digue = hydro_doc.CreateObject( KIND_DIGUE );
307 digue.SetName( "digue" );
309 digue.SetZLevel( 9 );
311 digue.SetGuideLine( axe3DDigue );
312 digue.SetProfile( sectionDigue );
313 digue.SetEquiDistance( 50 );
319 garonne_1 = hydro_doc.CreateObject( KIND_CALCULATION )
320 garonne_1.SetName( "garonne_1" )
322 garonne_1.SetAssignmentMode( HYDROData_CalculationCase.MANUAL )
323 garonne_1.AddGeometryObject( litMineur )
324 garonne_1.AddGeometryObject( domaineEtendu )
325 garonne_1.AddGeometryObject( litMajeur )
326 garonne_1.AddGeometryObject( digue );
328 case_geom_group = domaineEtendu.GetGroup( 0 );
329 garonne_1.AddGeometryGroup( case_geom_group );
330 case_geom_group = litMineur.GetGroup( 0 );
331 garonne_1.AddGeometryGroup( case_geom_group );
332 case_geom_group = litMajeur.GetGroup( 0 );
333 garonne_1.AddGeometryGroup( case_geom_group );
334 case_geom_group = digue.GetGroup( 2 );
335 garonne_1.AddGeometryGroup( case_geom_group );
336 case_geom_group = digue.GetGroup( 0 );
337 garonne_1.AddGeometryGroup( case_geom_group );
338 case_geom_group = digue.GetGroup( 3 );
339 garonne_1.AddGeometryGroup( case_geom_group );
340 case_geom_group = digue.GetGroup( 1 );
341 garonne_1.AddGeometryGroup( case_geom_group );
342 garonne_1.SetBoundaryPolyline( domaine );
344 # Start the algorithm of the partition and assignment
347 garonne_1_litMineur = hydro_doc.FindObjectByName( "garonne_1_Reg_1" )
348 garonne_1_Zone_1 = hydro_doc.FindObjectByName( "garonne_1_Zone_1" )
349 garonne_1_Zone_1.SetMergeType( HYDROData_Zone.Merge_ZMIN )
350 garonne_1_Zone_1.SetColor( QColor( 192, 137, 64 ))
351 garonne_1_litMineur.AddZone( garonne_1_Zone_1 )
353 garonne_1_riveDroite = hydro_doc.FindObjectByName( "garonne_1_Reg_2" )
354 garonne_1_Zone_2 = hydro_doc.FindObjectByName( "garonne_1_Zone_2" )
355 garonne_1_Zone_2.SetColor( QColor( 64, 192, 98 ))
356 garonne_1_riveDroite.AddZone( garonne_1_Zone_2 )
358 garonne_1_Zone_3 = hydro_doc.FindObjectByName( "garonne_1_Zone_3" )
359 garonne_1_Zone_3.SetMergeType( HYDROData_Zone.Merge_Object )
360 Cloud_02 = hydro_doc.FindObjectByName( "Cloud_02" )
361 garonne_1_Zone_3.SetMergeObject( Cloud_02 )
362 garonne_1_Zone_3.SetColor( QColor( 64, 66, 192 ))
363 garonne_1_riveDroite.AddZone( garonne_1_Zone_3 )
365 garonne_1_riveGauche = hydro_doc.FindObjectByName( "garonne_1_Reg_3" )
366 garonne_1_Zone_4 = hydro_doc.FindObjectByName( "garonne_1_Zone_4" )
367 garonne_1_Zone_4.SetMergeType( HYDROData_Zone.Merge_Object )
368 Cloud_02 = hydro_doc.FindObjectByName( "Cloud_02" )
369 garonne_1_Zone_4.SetMergeObject( Cloud_02 )
370 garonne_1_Zone_4.SetColor( QColor( 64, 192, 164 ))
371 garonne_1_riveGauche.AddZone( garonne_1_Zone_4 )
373 garonne_1_Zone_5 = hydro_doc.FindObjectByName( "garonne_1_Zone_5" )
374 garonne_1_Zone_5.SetColor( QColor( 192, 149, 64 ))
375 garonne_1_riveGauche.AddZone( garonne_1_Zone_5 )
377 garonne_1_digue = hydro_doc.FindObjectByName( "garonne_1_Reg_4" )
378 garonne_1_Zone_6 = hydro_doc.FindObjectByName( "garonne_1_Zone_6" )
379 garonne_1_Zone_6.SetMergeType( HYDROData_Zone.Merge_ZMAX )
380 garonne_1_Zone_6.SetColor( QColor( 64, 192, 177 ))
381 garonne_1_digue.AddZone( garonne_1_Zone_6 )
383 garonne_1_litMineur.SetName("garonne_1_litMineur")
384 garonne_1_riveDroite.SetName("garonne_1_riveDroite")
385 garonne_1_riveGauche.SetName("garonne_1_riveGauche")
386 garonne_1_digue.SetName("garonne_1_digue")
388 # Export of the calculation case
389 garonne_1_entry = garonne_1.Export()
391 #----------------------
393 #----------------------
395 # Get geometry shape and print debug information
397 from salome.geom import geomBuilder
400 from salome.hydrotools.controls import controlGeomProps
402 geompy = geomBuilder.New()
404 print("Entry:", garonne_1_entry)
405 HYDRO_garonne_1 = salome.IDToObject( str( garonne_1_entry ) )
406 print("Geom shape:", HYDRO_garonne_1)
407 print("Geom shape name:", HYDRO_garonne_1.GetName())
409 [garonne_riveGauche,garonne_digue,garonne_litMineur,garonne_riveDroite] = geompy.ExtractShapes(HYDRO_garonne_1, geompy.ShapeType["FACE"], True)
411 controlGeomProps(geompy, garonne_riveGauche, 39490.835288, 35845737.590926)
412 controlGeomProps(geompy, garonne_digue, 10341.466108, 103090.760662)
413 controlGeomProps(geompy, garonne_litMineur, 30337.548492, 3488480.304388)
414 controlGeomProps(geompy, garonne_riveDroite, 32012.343241, 25998769.23615)
416 # --- manual identification of all useful edge groups (boundary conditions)
418 allEdgesIds = geompy.SubShapeAllIDs(HYDRO_garonne_1, geompy.ShapeType["EDGE"])
419 print("allEdgesIds", allEdgesIds)
421 (isDone, ClosedFreeBoundary, OpenFreeBoundary) = geompy.GetFreeBoundary(HYDRO_garonne_1)
422 geompy.addToStudyInFather(HYDRO_garonne_1, ClosedFreeBoundary[0], "ClosedFreeBoundary")
424 freeBoundary = geompy.ExtractShapes(ClosedFreeBoundary[0], geompy.ShapeType["EDGE"], True)
425 freeBoundaryIds = [ geompy.GetSubShapeID(HYDRO_garonne_1, freeBoundary[i]) for i in range(len(freeBoundary)) ]
426 print("freeBoundaryIds", freeBoundaryIds)
428 [litMineur_droite] = geompy.GetSharedShapesMulti([garonne_riveDroite, garonne_litMineur], geompy.ShapeType["EDGE"], True)
429 [litMineur_gauche] = geompy.GetSharedShapesMulti([garonne_riveGauche, garonne_litMineur], geompy.ShapeType["EDGE"], True)
430 geompy.addToStudyInFather(HYDRO_garonne_1, litMineur_droite, "litMineur_droite")
431 geompy.addToStudyInFather(HYDRO_garonne_1, litMineur_gauche, "litMineur_gauche")
432 rives = [litMineur_droite, litMineur_gauche]
433 rivesIds = [ geompy.GetSubShapeID(HYDRO_garonne_1, rives[i]) for i in range(len(rives)) ]
434 print("rivesIds", rivesIds)
436 edges_litMineur = geompy.GetSharedShapesMulti([HYDRO_garonne_1, garonne_litMineur], geompy.ShapeType["EDGE"], True)
437 edges_riveGauche = geompy.GetSharedShapesMulti([HYDRO_garonne_1, garonne_riveGauche], geompy.ShapeType["EDGE"], True)
438 edges_riveDroite = geompy.GetSharedShapesMulti([HYDRO_garonne_1, garonne_riveDroite], geompy.ShapeType["EDGE"], True)
439 edges_litMineurIds = [ geompy.GetSubShapeID(HYDRO_garonne_1, edges_litMineur[i]) for i in range(len(edges_litMineur)) ]
440 edges_riveGaucheIds = [ geompy.GetSubShapeID(HYDRO_garonne_1, edges_riveGauche[i]) for i in range(len(edges_riveGauche)) ]
441 edges_riveDroiteIds = [ geompy.GetSubShapeID(HYDRO_garonne_1, edges_riveDroite[i]) for i in range(len(edges_riveDroite)) ]
443 print("edges_litMineurIds", edges_litMineurIds)
444 print("edges_riveGaucheIds", edges_riveGaucheIds)
445 print("edges_riveDroiteIds", edges_riveDroiteIds)
447 sectionsIds = [Id for Id in edges_litMineurIds if Id not in rivesIds]
448 print("sectionsIds", sectionsIds)
449 SectionsGaronne = geompy.CreateGroup(HYDRO_garonne_1, geompy.ShapeType["EDGE"])
450 geompy.UnionIDs(SectionsGaronne, sectionsIds)
451 geompy.addToStudyInFather(HYDRO_garonne_1, SectionsGaronne, "SectionsGaronne")
453 bordGaucheDomaineIds = [Id for Id in freeBoundaryIds if Id in edges_riveGaucheIds]
454 bordDroiteDomaineIds = [Id for Id in freeBoundaryIds if Id in edges_riveDroiteIds]
455 print("bordGaucheDomaineIds", bordGaucheDomaineIds)
456 print("bordDroiteDomaineIds", bordDroiteDomaineIds)
457 bordGaucheDomaine = geompy.CreateGroup(HYDRO_garonne_1, geompy.ShapeType["EDGE"])
458 geompy.UnionIDs(bordGaucheDomaine, bordGaucheDomaineIds)
459 geompy.addToStudyInFather(HYDRO_garonne_1, bordGaucheDomaine, "bordGaucheDomaine")
460 bordDroiteDomaine = geompy.CreateGroup(HYDRO_garonne_1, geompy.ShapeType["EDGE"])
461 geompy.UnionIDs(bordDroiteDomaine, bordDroiteDomaineIds)
462 geompy.addToStudyInFather(HYDRO_garonne_1, bordDroiteDomaine, "bordDroiteDomaine")
464 amont = geompy.GetEdgeNearPoint(HYDRO_garonne_1, geompy.MakeVertex(46757.861314, 25833.234752, 0))
465 aval = geompy.GetEdgeNearPoint(HYDRO_garonne_1, geompy.MakeVertex(39078.979127, 32588.627279, 0))
466 geompy.addToStudyInFather(HYDRO_garonne_1, amont, "amont")
467 geompy.addToStudyInFather(HYDRO_garonne_1, aval, "aval")
469 amontDigue = geompy.GetEdgeNearPoint(HYDRO_garonne_1, geompy.MakeVertex(44736.43, 29847.52, 0))
470 avalDigue = geompy.GetEdgeNearPoint(HYDRO_garonne_1, geompy.MakeVertex(40961.39, 31800.95, 0))
471 geompy.addToStudyInFather(HYDRO_garonne_1, amontDigue, "amontDigue")
472 geompy.addToStudyInFather(HYDRO_garonne_1, avalDigue, "avalDigue")
474 SectionsDigue = geompy.CreateGroup(HYDRO_garonne_1, geompy.ShapeType["EDGE"])
475 geompy.UnionIDs(SectionsDigue, [geompy.GetSubShapeID(HYDRO_garonne_1, amontDigue), geompy.GetSubShapeID(HYDRO_garonne_1, avalDigue)])
476 geompy.addToStudyInFather( HYDRO_garonne_1, SectionsDigue, 'SectionsDigue' )
478 if salome.sg.hasDesktop():
479 salome.sg.updateObjBrowser()