Salome HOME
adaptation cas tests
[modules/hydro.git] / doc / salome / examples / h008_simpleCase.py
index 74434dba58659b2a468566505b836dab40a781d3..c714049ea03c659259bb0db4dca345bd3ec0a5b5 100644 (file)
@@ -6,9 +6,13 @@ import salome
 salome.salome_init()
 theStudy = salome.myStudy
 
+#----------------------
+# --- HYDRO
+#----------------------
+
 from HYDROPy import *
-from PyQt4.QtCore import *
-from PyQt4.QtGui import *
+from PyQt5.QtCore import *
+from PyQt5.QtGui import *
 
 hydro_doc = HYDROData_Document.Document( theStudy._get_StudyId() )
 
@@ -49,9 +53,10 @@ Case_1 = hydro_doc.CreateObject( KIND_CALCULATION )
 Case_1.SetName( "Case_1" )
 
 Case_1.SetAssignmentMode( HYDROData_CalculationCase.AUTOMATIC )
-Case_1.SetAssignmentLandCoverMode( HYDROData_CalculationCase.AUTOMATIC )
 Case_1.AddGeometryObject( Immersible_zone_1 )
 
+case_geom_group = Immersible_zone_1.GetGroup( 0 );
+Case_1.AddGeometryGroup( case_geom_group );
 Case_1.SetBoundaryPolyline( Polyline_1 )
 
 # Start the algorithm of the partition and assignment
@@ -60,11 +65,16 @@ Case_1.Update()
 # Export of the calculation case
 Case_1_entry = Case_1.Export( theStudy._get_StudyId() )
 
+#----------------------
+# --- Geometry
+#----------------------
+
 # Get geometry shape and print debug information
 import GEOM
 from salome.geom import geomBuilder
 import math
 import SALOMEDS
+from salome.hydrotools.controls import controlGeomProps
 
 geompy = geomBuilder.New(theStudy)
 
@@ -73,20 +83,8 @@ Case_1_geom = salome.IDToObject( str( Case_1_entry ) )
 print "Geom shape:", Case_1_geom
 print "Geom shape name:", Case_1_geom.GetName()
 
-props = geompy.BasicProperties(Case_1_geom)
-print " Wires length: ", props[0]
-print " Surface area: ", props[1]
-print " Volume      : ", props[2]
-refLength = 1218.7373973
-refArea   = 49697.2117918
-deltaLength = 2.0*abs((props[0] - refLength)/(props[0] + refLength))
-deltaArea   = 2.0*abs((props[1] - refArea)/(props[1] + refArea))
-if deltaLength > 1e-7 or deltaArea > 1e-7 or props[2] != 0:
-  print "While must be:"
-  print " Wires length: ", refLength
-  print " Surface area: ", refArea
-  print " Volume      : ", 0.
-  raise ValueError("Bad length or area") 
-   
+#controlGeomProps(geompy, Case_1_geom, 1218.7373973, 49697.2117918)
+controlGeomProps(geompy, Case_1_geom, 1218.7373973, 49578.1516521)
+
 if salome.sg.hasDesktop():
   salome.sg.updateObjBrowser(1)