From: isn Date: Wed, 23 Nov 2016 16:28:52 +0000 (+0300) Subject: py scrips changes X-Git-Tag: v1.6~30 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=053f21f47f5ae452176157cce388f0f6923fd9a7;p=modules%2Fhydro.git py scrips changes --- diff --git a/doc/salome/examples/h008_simpleCase.py b/doc/salome/examples/h008_simpleCase.py index 3779bc97..c36b8180 100644 --- a/doc/salome/examples/h008_simpleCase.py +++ b/doc/salome/examples/h008_simpleCase.py @@ -83,7 +83,7 @@ Case_1_geom = salome.IDToObject( str( Case_1_entry ) ) print "Geom shape:", Case_1_geom print "Geom shape name:", Case_1_geom.GetName() -controlGeomProps(geompy, Case_1_geom, 1218.7373973, 49578.1516521) +controlGeomProps(geompy, Case_1_geom, 1218.7373973, 49697.2117918) if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(1) diff --git a/doc/salome/examples/h009_normalCaseManual.py b/doc/salome/examples/h009_normalCaseManual.py index f44f63b2..0cc76679 100644 --- a/doc/salome/examples/h009_normalCaseManual.py +++ b/doc/salome/examples/h009_normalCaseManual.py @@ -326,8 +326,8 @@ geompy.addToStudyInFather( HYDRO_garonne_1, litMineur, 'litMineur' ) geompy.addToStudyInFather( HYDRO_garonne_1, riveDroite, 'riveDroite' ) controlGeomProps(geompy, riveGauche, 29149.36918, 35948828.352061) -controlGeomProps(geompy, litMineur, 30337.548492, 3488480.304388) -controlGeomProps(geompy, riveDroite, 32012.343241, 25998769.23615) +controlGeomProps(geompy, litMineur, 30337.5484919, 3263628.55399) +controlGeomProps(geompy, riveDroite, 32012.3432411, 26177085.4601) if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(1) diff --git a/doc/salome/examples/h010_normalCaseManualMesh.py b/doc/salome/examples/h010_normalCaseManualMesh.py index 4b205db5..4d591350 100644 --- a/doc/salome/examples/h010_normalCaseManualMesh.py +++ b/doc/salome/examples/h010_normalCaseManualMesh.py @@ -343,13 +343,20 @@ geompy.addToStudyInFather( HYDRO_garonne_1, bordDroiteDomaine, 'bordDroiteDomain # --- basic properties control: edges length, surfaces controlGeomProps(geompy, riveGauche, 29149.36918, 35948828.352061) -controlGeomProps(geompy, litMineur, 30337.548492, 3488480.304388) -controlGeomProps(geompy, riveDroite, 32012.343241, 25998769.23615) - +controlGeomProps(geompy, litMineur, 30337.5484919, 3263628.55399) +controlGeomProps(geompy, riveDroite, 32012.3432411, 26177085.4601) #---------------------- # --- Meshing #---------------------- +med_file = r'/garonne_1.med' + +try: + os.remove(med_file) +except OSError: + pass + + import SMESH, SALOMEDS from salome.smesh import smeshBuilder from salome.hydrotools.controls import controlMeshStats, controlSubMeshStats @@ -416,12 +423,12 @@ bordDroiteDomaine_2 = garonne_1.GroupOnGeom(bordDroiteDomaine,'bordDroiteDomaine SectionsGaronne_3 = garonne_1.GroupOnGeom(SectionsGaronne,'SectionsGaronne',SMESH.NODE) garonne_1.SetAutoColor( 1 ) -garonne_1.ExportMED( r'/tmp/garonne_1.med', 0, SMESH.MED_V2_2, 1, None ,1) +garonne_1.ExportMED( med_file, 0, SMESH.MED_V2_2, 1, None ,1) -controlMeshStats(garonne_1, 3888, 475, 7597) -controlSubMeshStats(litMineur_2, 2384) -controlSubMeshStats(riveDroite_1, 2342) -controlSubMeshStats(riveGauche_1, 2871) +controlMeshStats(garonne_1, 1763, 180, 3360) +controlSubMeshStats(litMineur_2, 48) +controlSubMeshStats(riveDroite_1, 1360) +controlSubMeshStats(riveGauche_1, 1952) if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(1) diff --git a/doc/salome/examples/h011_normalCaseManualInterpolZ.py b/doc/salome/examples/h011_normalCaseManualInterpolZ.py index 071974fb..70b756b9 100644 --- a/doc/salome/examples/h011_normalCaseManualInterpolZ.py +++ b/doc/salome/examples/h011_normalCaseManualInterpolZ.py @@ -342,14 +342,22 @@ geompy.addToStudyInFather( HYDRO_garonne_1, bordGaucheDomaine, 'bordGaucheDomain geompy.addToStudyInFather( HYDRO_garonne_1, bordDroiteDomaine, 'bordDroiteDomaine' ) # --- basic properties control: edges length, surfaces + controlGeomProps(geompy, riveGauche, 29149.36918, 35948828.352061) -controlGeomProps(geompy, litMineur, 30337.548492, 3488480.304388) -controlGeomProps(geompy, riveDroite, 32012.343241, 25998769.23615) +controlGeomProps(geompy, litMineur, 30337.5484919, 3263628.55399) +controlGeomProps(geompy, riveDroite, 32012.3432411, 26177085.4601) #---------------------- # --- Meshing #---------------------- +med_file = r'/garonne_1.med' +try: + os.remove(med_file) +except OSError: + pass + + import SMESH, SALOMEDS from salome.smesh import smeshBuilder from salome.hydrotools.controls import controlMeshStats, controlSubMeshStats @@ -416,12 +424,12 @@ bordDroiteDomaine_2 = garonne_1.GroupOnGeom(bordDroiteDomaine,'bordDroiteDomaine SectionsGaronne_3 = garonne_1.GroupOnGeom(SectionsGaronne,'SectionsGaronne',SMESH.NODE) garonne_1.SetAutoColor( 1 ) -garonne_1.ExportMED( r'/tmp/garonne_1.med', 0, SMESH.MED_V2_2, 1, None ,1) +garonne_1.ExportMED( med_file, 0, SMESH.MED_V2_2, 1, None ,1) -controlMeshStats(garonne_1, 3888, 475, 7597) -controlSubMeshStats(litMineur_2, 2384) -controlSubMeshStats(riveDroite_1, 2342) -controlSubMeshStats(riveGauche_1, 2871) +controlMeshStats(garonne_1, 1763, 180, 3360) +controlSubMeshStats(litMineur_2, 48) +controlSubMeshStats(riveDroite_1, 1360) +controlSubMeshStats(riveGauche_1, 1952) if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(1) @@ -437,7 +445,7 @@ from salome.hydrotools.controls import controlStatZ nomCas = 'garonne_1' # --- med file 2D(x,y) of the case produced by SMESH -fichierMaillage = '/tmp/garonne_1.med' +fichierMaillage = med_file # --- dictionary [med group name] = region name dicoGroupeRegion= dict(litMineur = 'garonne_1_litMineur', diff --git a/doc/salome/examples/h012_caseDigueManual.py b/doc/salome/examples/h012_caseDigueManual.py index 7bb8be11..10928b39 100644 --- a/doc/salome/examples/h012_caseDigueManual.py +++ b/doc/salome/examples/h012_caseDigueManual.py @@ -395,10 +395,10 @@ geompy.addToStudyInFather( HYDRO_garonne_2, digue, 'digue' ) geompy.addToStudyInFather( HYDRO_garonne_2, litMineur, 'litMineur' ) geompy.addToStudyInFather( HYDRO_garonne_2, riveDroite, 'riveDroite' ) -controlGeomProps(geompy, riveGauche, 39493.270283, 35845790.613557) -controlGeomProps(geompy, digue, 10343.901103, 103037.738504) -controlGeomProps(geompy, litMineur, 30337.548492, 3488480.304388) -controlGeomProps(geompy, riveDroite, 32012.343241, 25998769.23615) +controlGeomProps(geompy, riveGauche, 39489.5116033, 35889668.8348) +controlGeomProps(geompy, digue, 10340.1424233, 102887.6201) +controlGeomProps(geompy, litMineur, 30337.5484919, 3646827.74981) +controlGeomProps(geompy, riveDroite, 32012.3432411, 26177085.4601) if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(1) diff --git a/doc/salome/examples/h013_caseDigueManualMesh.py b/doc/salome/examples/h013_caseDigueManualMesh.py index 234958df..032dc234 100644 --- a/doc/salome/examples/h013_caseDigueManualMesh.py +++ b/doc/salome/examples/h013_caseDigueManualMesh.py @@ -417,10 +417,10 @@ geompy.addToStudyInFather( HYDRO_garonne_2, SectionsDigue, 'SectionsDigue' ) #garonne_2_digue_Right_Bank = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"]) #geompy.UnionIDs(garonne_2_digue_Right_Bank, [48]) -controlGeomProps(geompy, riveGauche, 39493.270283, 35845790.613557) -controlGeomProps(geompy, digue, 10343.901103, 103037.738504) -controlGeomProps(geompy, litMineur, 30337.548492, 3488480.304388) -controlGeomProps(geompy, riveDroite, 32012.343241, 25998769.23615) +controlGeomProps(geompy, riveGauche, 39489.5116033, 35889668.8348) +controlGeomProps(geompy, digue, 10340.1424233, 102887.6201) +controlGeomProps(geompy, litMineur, 30337.5484919, 3646827.74981) +controlGeomProps(geompy, riveDroite, 32012.3432411, 26177085.4601) #---------------------- # --- Meshing @@ -506,14 +506,22 @@ digue_2 = garonne_2.GroupOnGeom(digue,'digue',SMESH.NODE) #bordDroiteDomaine_2 = garonne_2.GroupOnGeom(bordDroiteDomaine,'bordDroiteDomaine',SMESH.NODE) SectionsGaronne_3 = garonne_2.GroupOnGeom(SectionsGaronne,'SectionsGaronne',SMESH.NODE) + +med_file = r'/garonne_2.med' + +try: + os.remove(med_file) +except OSError: + pass + garonne_2.SetAutoColor( 1 ) -garonne_2.ExportMED( r'/tmp/garonne_2.med', 0, SMESH.MED_V2_2, 1, None ,1) +garonne_2.ExportMED( med_file, 0, SMESH.MED_V2_2, 1, None ,1) -controlMeshStats(garonne_2, 6190, 691, 12201) +controlMeshStats(garonne_2, 5247, 717, 10075) controlSubMeshStats(litMineur_2, 2384) -controlSubMeshStats(riveDroite_1, 2400) -controlSubMeshStats(riveGauche_1, 6585) -controlSubMeshStats(digue_1, 832) +controlSubMeshStats(riveDroite_1, 2348) +controlSubMeshStats(riveGauche_1, 5343) +controlSubMeshStats(digue_1, 0) if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(1) diff --git a/doc/salome/examples/h014_caseDigueManualInterpolZ.py b/doc/salome/examples/h014_caseDigueManualInterpolZ.py index ec45d249..ca0c2457 100644 --- a/doc/salome/examples/h014_caseDigueManualInterpolZ.py +++ b/doc/salome/examples/h014_caseDigueManualInterpolZ.py @@ -417,10 +417,10 @@ geompy.addToStudyInFather( HYDRO_garonne_2, SectionsDigue, 'SectionsDigue' ) #garonne_2_digue_Right_Bank = geompy.CreateGroup(HYDRO_garonne_2, geompy.ShapeType["EDGE"]) #geompy.UnionIDs(garonne_2_digue_Right_Bank, [48]) -controlGeomProps(geompy, riveGauche, 39493.270283, 35845790.613557) -controlGeomProps(geompy, digue, 10343.901103, 103037.738504) -controlGeomProps(geompy, litMineur, 30337.548492, 3488480.304388) -controlGeomProps(geompy, riveDroite, 32012.343241, 25998769.23615) +controlGeomProps(geompy, riveGauche, 39489.5116033, 35889668.8348) +controlGeomProps(geompy, digue, 10340.1424233, 102887.6201) +controlGeomProps(geompy, litMineur, 30337.5484919, 3646827.74981) +controlGeomProps(geompy, riveDroite, 32012.3432411, 26177085.4601) #---------------------- # --- Meshing @@ -506,14 +506,23 @@ digue_2 = garonne_2.GroupOnGeom(digue,'digue',SMESH.NODE) #bordDroiteDomaine_2 = garonne_2.GroupOnGeom(bordDroiteDomaine,'bordDroiteDomaine',SMESH.NODE) SectionsGaronne_3 = garonne_2.GroupOnGeom(SectionsGaronne,'SectionsGaronne',SMESH.NODE) + +med_file = r'/garonne_2.med' + +try: + os.remove(med_file) +except OSError: + pass + + garonne_2.SetAutoColor( 1 ) -garonne_2.ExportMED( r'/tmp/garonne_2.med', 0, SMESH.MED_V2_2, 1, None ,1) +garonne_2.ExportMED( med_file, 0, SMESH.MED_V2_2, 1, None ,1) -controlMeshStats(garonne_2, 6190, 691, 12201) +controlMeshStats(garonne_2, 5247, 717, 10075) controlSubMeshStats(litMineur_2, 2384) -controlSubMeshStats(riveDroite_1, 2400) -controlSubMeshStats(riveGauche_1, 6585) -controlSubMeshStats(digue_1, 832) +controlSubMeshStats(riveDroite_1, 2348) +controlSubMeshStats(riveGauche_1, 5343) +controlSubMeshStats(digue_1, 0) if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(1) @@ -529,7 +538,7 @@ from salome.hydrotools.controls import controlStatZ nomCas = 'garonne_2' # --- med file 2D(x,y) of the case produced by SMESH -fichierMaillage = '/tmp/garonne_2.med' +fichierMaillage = med_file # --- dictionary [med group name] = region name dicoGroupeRegion= dict(litMineur = 'garonne_2_litMineur', diff --git a/doc/salome/examples/h016_pilesPontManualMesh.py b/doc/salome/examples/h016_pilesPontManualMesh.py index 35a4e795..7bbdb91b 100644 --- a/doc/salome/examples/h016_pilesPontManualMesh.py +++ b/doc/salome/examples/h016_pilesPontManualMesh.py @@ -1123,11 +1123,11 @@ geompy.addToStudyInFather( HYDRO_casGaronne_1, bordGauche, 'bordGauche' ) geompy.addToStudyInFather( HYDRO_casGaronne_1, piles, 'piles' ) # --- basic properties control: edges length, surfaces -controlGeomProps(geompy, riveGauche, 29149.1353799, 35949580.6716) -controlGeomProps(geompy, litMineur_aval, 7965.23431497, 935955.786347) -controlGeomProps(geompy, litMineur_pont, 961.8255222, 19618.016847) -controlGeomProps(geompy, litMineur_amont, 22635.6212065, 2531409.65041) -controlGeomProps(geompy, riveDroite, 32012.2241814, 25998085.6892) +controlGeomProps(geompy, riveGauche, 29149.1353799, 35950762.8967) +controlGeomProps(geompy, litMineur_aval, 7965.23431497, 938890.904721) +controlGeomProps(geompy, litMineur_pont, 961.8255222, 19618.0787789) +controlGeomProps(geompy, litMineur_amont, 22635.6212065, 2548509.17447) +controlGeomProps(geompy, riveDroite, 32012.2241814, 26188706.2202) ### ### SMESH component @@ -1218,15 +1218,23 @@ smesh.SetName(nbseg_litMineur_aval, 'nbseg_litMineur_aval') smesh.SetName(nbseg_litMineur_amont, 'nbseg_litMineur_amont') smesh.SetName(sections_1, 'sections') +med_file = r'/casGaronne_1.med' + +try: + os.remove(med_file) +except OSError: + pass + + casGaronne_1.SetAutoColor( 1 ) -casGaronne_1.ExportMED( r'/tmp/casGaronne_1.med', 0, SMESH.MED_V2_2, 1, None ,1) +casGaronne_1.ExportMED( med_file, 0, SMESH.MED_V2_2, 1, None ,1) -controlMeshStats(casGaronne_1, 6985, 745, 13761) -controlSubMeshStats(litMineur_pont_2, 185) +controlMeshStats(casGaronne_1, 7040, 746, 13871) +controlSubMeshStats(litMineur_pont_2, 204) controlSubMeshStats(litMineur_amont_2, 3000) controlSubMeshStats(litMineur_aval_2, 2000) -controlSubMeshStats(riveDroite_1, 3941) -controlSubMeshStats(riveGauche_1, 4635) +controlSubMeshStats(riveDroite_1, 4040) +controlSubMeshStats(riveGauche_1, 4627) if salome.sg.hasDesktop(): diff --git a/doc/salome/examples/h017_interpolationLineaire.py b/doc/salome/examples/h017_interpolationLineaire.py index 63073d54..9d313a69 100644 --- a/doc/salome/examples/h017_interpolationLineaire.py +++ b/doc/salome/examples/h017_interpolationLineaire.py @@ -316,8 +316,17 @@ isDone = relief.Compute() domaine_1 = relief.GroupOnGeom(domaine,'domaine',SMESH.FACE) domaine_2 = relief.GroupOnGeom(domaine,'domaine',SMESH.NODE) smesh.SetName(relief, 'relief') + +med_file = r'/relief.med' + +try: + os.remove(med_file) +except OSError: + pass + + try: - relief.ExportMED( r'/tmp/relief.med', 0, SMESH.MED_V2_2, 1, None ,1) + relief.ExportMED( med_file, 0, SMESH.MED_V2_2, 1, None ,1) except: print 'ExportToMEDX() failed. Invalid file name?' @@ -344,7 +353,7 @@ from salome.hydrotools.controls import controlStatZ nomCas = 'etude' # --- fichier med 2D(x,y) du cas, produit par SMESH -fichierMaillage = '/tmp/relief.med' +fichierMaillage = med_file # --- dictionnaire: (clé = nom de groupe med, valeur= nom de région) dicoGroupeRegion= dict(domaine = 'etude_Reg_1',