1 # -*- coding: utf-8 -*-
8 #----------------------
10 #----------------------
13 from PyQt5.QtCore import *
14 from PyQt5.QtGui import *
16 hydro_doc = HYDROData_Document.Document()
18 hydro_doc.SetLocalCS( 0, 0 )
20 Polyline_1 = hydro_doc.CreateObject( KIND_POLYLINEXY )
21 Polyline_1.SetName( "Polyline_1" )
23 Polyline_1.SetZLevel( 0 )
25 Polyline_1.AddSection( "Section_1", 1, 1 )
26 Polyline_1.AddPoint( 0, gp_XY( -123.36, 57.13 ) )
27 Polyline_1.AddPoint( 0, gp_XY( -74.82, 122.85 ) )
28 Polyline_1.AddPoint( 0, gp_XY( -2.02, 179.47 ) )
29 Polyline_1.AddPoint( 0, gp_XY( 79.88, 98.58 ) )
30 Polyline_1.AddPoint( 0, gp_XY( 138.52, 23.76 ) )
31 Polyline_1.AddPoint( 0, gp_XY( 30.33, -27.81 ) )
32 Polyline_1.AddPoint( 0, gp_XY( -21.23, -101.62 ) )
33 Polyline_1.AddPoint( 0, gp_XY( -48.53, 7.58 ) )
34 Polyline_1.AddPoint( 0, gp_XY( -121.33, -13.65 ) )
35 Polyline_1.AddPoint( 0, gp_XY( -288.17, 86.45 ) )
40 Immersible_zone_1 = hydro_doc.CreateObject( KIND_IMMERSIBLE_ZONE )
41 Immersible_zone_1.SetName( "Immersible zone_1" )
43 Immersible_zone_1.SetZLevel( 1 )
45 Immersible_zone_1.SetPolyline( Polyline_1 )
47 Immersible_zone_1.Update()
51 Case_1 = hydro_doc.CreateObject( KIND_CALCULATION )
52 Case_1.SetName( "Case_1" )
54 Case_1.SetAssignmentMode( HYDROData_CalculationCase.AUTOMATIC )
55 Case_1.AddGeometryObject( Immersible_zone_1 )
57 case_geom_group = Immersible_zone_1.GetGroup( 0 );
58 Case_1.AddGeometryGroup( case_geom_group );
59 Case_1.SetBoundaryPolyline( Polyline_1 )
61 # Start the algorithm of the partition and assignment
64 # Export of the calculation case
65 Case_1_entry = Case_1.Export()
67 #----------------------
69 #----------------------
71 # Get geometry shape and print debug information
73 from salome.geom import geomBuilder
76 from salome.hydrotools.controls import controlGeomProps
78 geompy = geomBuilder.New()
80 print("Entry:", Case_1_entry)
81 Case_1_geom = salome.IDToObject( str( Case_1_entry ) )
82 print("Geom shape:", Case_1_geom)
83 print("Geom shape name:", Case_1_geom.GetName())
85 #controlGeomProps(geompy, Case_1_geom, 1218.7373973, 49697.2117918)
86 controlGeomProps(geompy, Case_1_geom, 1218.7373973, 49578.1516521)
88 if salome.sg.hasDesktop():
89 salome.sg.updateObjBrowser()