Salome HOME
c714049ea03c659259bb0db4dca345bd3ec0a5b5
[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 theStudy = salome.myStudy
8
9 #----------------------
10 # --- HYDRO
11 #----------------------
12
13 from HYDROPy import *
14 from PyQt5.QtCore import *
15 from PyQt5.QtGui import *
16
17 hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() )
18
19 hydro_doc.SetLocalCS( 0, 0 )
20
21 Polyline_1 = hydro_doc.CreateObject( KIND_POLYLINEXY )
22 Polyline_1.SetName( "Polyline_1" )
23
24 Polyline_1.SetZLevel( 0 )
25
26 Polyline_1.AddSection( "Section_1", 1, 1 )
27 Polyline_1.AddPoint( 0, gp_XY( -123.36, 57.13 ) )
28 Polyline_1.AddPoint( 0, gp_XY( -74.82, 122.85 ) )
29 Polyline_1.AddPoint( 0, gp_XY( -2.02, 179.47 ) )
30 Polyline_1.AddPoint( 0, gp_XY( 79.88, 98.58 ) )
31 Polyline_1.AddPoint( 0, gp_XY( 138.52, 23.76 ) )
32 Polyline_1.AddPoint( 0, gp_XY( 30.33, -27.81 ) )
33 Polyline_1.AddPoint( 0, gp_XY( -21.23, -101.62 ) )
34 Polyline_1.AddPoint( 0, gp_XY( -48.53, 7.58 ) )
35 Polyline_1.AddPoint( 0, gp_XY( -121.33, -13.65 ) )
36 Polyline_1.AddPoint( 0, gp_XY( -288.17, 86.45 ) )
37
38 Polyline_1.Update()
39
40
41 Immersible_zone_1 = hydro_doc.CreateObject( KIND_IMMERSIBLE_ZONE )
42 Immersible_zone_1.SetName( "Immersible zone_1" )
43
44 Immersible_zone_1.SetZLevel( 1 )
45
46 Immersible_zone_1.SetPolyline( Polyline_1 )
47
48 Immersible_zone_1.Update()
49
50
51 # Calculation case
52 Case_1 = hydro_doc.CreateObject( KIND_CALCULATION )
53 Case_1.SetName( "Case_1" )
54
55 Case_1.SetAssignmentMode( HYDROData_CalculationCase.AUTOMATIC )
56 Case_1.AddGeometryObject( Immersible_zone_1 )
57
58 case_geom_group = Immersible_zone_1.GetGroup( 0 );
59 Case_1.AddGeometryGroup( case_geom_group );
60 Case_1.SetBoundaryPolyline( Polyline_1 )
61
62 # Start the algorithm of the partition and assignment
63 Case_1.Update()
64
65 # Export of the calculation case
66 Case_1_entry = Case_1.Export( theStudy._get_StudyId() )
67
68 #----------------------
69 # --- Geometry
70 #----------------------
71
72 # Get geometry shape and print debug information
73 import GEOM
74 from salome.geom import geomBuilder
75 import math
76 import SALOMEDS
77 from salome.hydrotools.controls import controlGeomProps
78
79 geompy = geomBuilder.New(theStudy)
80
81 print "Entry:", Case_1_entry
82 Case_1_geom = salome.IDToObject( str( Case_1_entry ) )
83 print "Geom shape:", Case_1_geom
84 print "Geom shape name:", Case_1_geom.GetName()
85
86 #controlGeomProps(geompy, Case_1_geom, 1218.7373973, 49697.2117918)
87 controlGeomProps(geompy, Case_1_geom, 1218.7373973, 49578.1516521)
88
89 if salome.sg.hasDesktop():
90   salome.sg.updateObjBrowser(1)