]> SALOME platform Git repositories - modules/hydro.git/blob - doc/salome/examples/h008_simpleCase.py
Salome HOME
Merge branch 'BR_H2018_4' into BR_PY3
[modules/hydro.git] / doc / salome / examples / h008_simpleCase.py
1 # -*- coding: utf-8 -*-
2
3 import sys
4 import salome
5
6 salome.salome_init()
7
8 #----------------------
9 # --- HYDRO
10 #----------------------
11
12 from HYDROPy import *
13 from PyQt5.QtCore import *
14 from PyQt5.QtGui import *
15
16 hydro_doc = HYDROData_Document.Document()
17
18 hydro_doc.SetLocalCS( 0, 0 )
19
20 Polyline_1 = hydro_doc.CreateObject( KIND_POLYLINEXY )
21 Polyline_1.SetName( "Polyline_1" )
22
23 Polyline_1.SetZLevel( 0 )
24
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 ) )
36
37 Polyline_1.Update()
38
39
40 Immersible_zone_1 = hydro_doc.CreateObject( KIND_IMMERSIBLE_ZONE )
41 Immersible_zone_1.SetName( "Immersible zone_1" )
42
43 Immersible_zone_1.SetZLevel( 1 )
44
45 Immersible_zone_1.SetPolyline( Polyline_1 )
46
47 Immersible_zone_1.Update()
48
49
50 # Calculation case
51 Case_1 = hydro_doc.CreateObject( KIND_CALCULATION )
52 Case_1.SetName( "Case_1" )
53
54 Case_1.SetAssignmentMode( HYDROData_CalculationCase.AUTOMATIC )
55 Case_1.AddGeometryObject( Immersible_zone_1 )
56
57 case_geom_group = Immersible_zone_1.GetGroup( 0 );
58 Case_1.AddGeometryGroup( case_geom_group );
59 Case_1.SetBoundaryPolyline( Polyline_1 )
60
61 # Start the algorithm of the partition and assignment
62 Case_1.Update()
63
64 # Export of the calculation case
65 Case_1_entry = Case_1.Export()
66
67 #----------------------
68 # --- Geometry
69 #----------------------
70
71 # Get geometry shape and print debug information
72 import GEOM
73 from salome.geom import geomBuilder
74 import math
75 import SALOMEDS
76 from salome.hydrotools.controls import controlGeomProps
77
78 geompy = geomBuilder.New()
79
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())
84
85 #controlGeomProps(geompy, Case_1_geom, 1218.7373973, 49697.2117918)
86 controlGeomProps(geompy, Case_1_geom, 1218.7373973, 49578.1516521)
87
88 if salome.sg.hasDesktop():
89   salome.sg.updateObjBrowser()