From 5260bd00bd51567f6137d5ea7ae0564464c4290a Mon Sep 17 00:00:00 2001 From: Nicolas Geimer Date: Mon, 20 Mar 2017 13:27:30 +0100 Subject: [PATCH] [PY3] 2to3 results --- bin/smesh_setenv.py | 6 +- doc/salome/examples/cartesian_algo.py | 40 ++--- doc/salome/examples/creating_meshes_ex01.py | 4 +- doc/salome/examples/creating_meshes_ex03.py | 6 +- doc/salome/examples/creating_meshes_ex04.py | 10 +- doc/salome/examples/creating_meshes_ex05.py | 4 +- .../examples/defining_hypotheses_ex06.py | 4 +- doc/salome/examples/filters_belong2group.py | 6 +- doc/salome/examples/filters_ex01.py | 16 +- doc/salome/examples/filters_ex02.py | 2 +- doc/salome/examples/filters_ex03.py | 2 +- doc/salome/examples/filters_ex04.py | 2 +- doc/salome/examples/filters_ex05.py | 2 +- doc/salome/examples/filters_ex06.py | 2 +- doc/salome/examples/filters_ex07.py | 2 +- doc/salome/examples/filters_ex08.py | 2 +- doc/salome/examples/filters_ex09.py | 2 +- doc/salome/examples/filters_ex10.py | 2 +- doc/salome/examples/filters_ex11.py | 2 +- doc/salome/examples/filters_ex12.py | 2 +- doc/salome/examples/filters_ex13.py | 2 +- doc/salome/examples/filters_ex14.py | 2 +- doc/salome/examples/filters_ex15.py | 2 +- doc/salome/examples/filters_ex16.py | 6 +- doc/salome/examples/filters_ex17.py | 2 +- doc/salome/examples/filters_ex18.py | 2 +- doc/salome/examples/filters_ex19.py | 2 +- doc/salome/examples/filters_ex20.py | 2 +- doc/salome/examples/filters_ex21.py | 2 +- doc/salome/examples/filters_ex22.py | 2 +- doc/salome/examples/filters_ex23.py | 2 +- doc/salome/examples/filters_ex24.py | 2 +- doc/salome/examples/filters_ex25.py | 2 +- doc/salome/examples/filters_ex26.py | 2 +- doc/salome/examples/filters_ex27.py | 2 +- doc/salome/examples/filters_ex28.py | 2 +- doc/salome/examples/filters_ex29.py | 2 +- doc/salome/examples/filters_ex30.py | 2 +- doc/salome/examples/filters_ex31.py | 2 +- doc/salome/examples/filters_ex32.py | 2 +- doc/salome/examples/filters_ex33.py | 6 +- doc/salome/examples/filters_ex34.py | 2 +- doc/salome/examples/filters_ex35.py | 8 +- doc/salome/examples/filters_ex37.py | 2 +- doc/salome/examples/filters_ex38.py | 2 +- doc/salome/examples/filters_ex39.py | 8 +- doc/salome/examples/filters_node_nb_conn.py | 2 +- doc/salome/examples/grouping_elements_ex01.py | 20 +-- doc/salome/examples/grouping_elements_ex03.py | 8 +- doc/salome/examples/grouping_elements_ex04.py | 12 +- doc/salome/examples/grouping_elements_ex05.py | 10 +- doc/salome/examples/grouping_elements_ex06.py | 6 +- doc/salome/examples/grouping_elements_ex07.py | 6 +- doc/salome/examples/grouping_elements_ex08.py | 4 +- doc/salome/examples/measurements_ex03.py | 66 ++++----- doc/salome/examples/modifying_meshes_ex01.py | 6 +- doc/salome/examples/modifying_meshes_ex02.py | 6 +- doc/salome/examples/modifying_meshes_ex03.py | 2 +- doc/salome/examples/modifying_meshes_ex04.py | 8 +- doc/salome/examples/modifying_meshes_ex05.py | 8 +- doc/salome/examples/modifying_meshes_ex06.py | 10 +- doc/salome/examples/modifying_meshes_ex07.py | 8 +- doc/salome/examples/modifying_meshes_ex08.py | 8 +- doc/salome/examples/modifying_meshes_ex11.py | 4 +- doc/salome/examples/modifying_meshes_ex12.py | 4 +- doc/salome/examples/modifying_meshes_ex13.py | 4 +- doc/salome/examples/modifying_meshes_ex15.py | 6 +- doc/salome/examples/modifying_meshes_ex16.py | 6 +- doc/salome/examples/modifying_meshes_ex17.py | 6 +- doc/salome/examples/modifying_meshes_ex18.py | 6 +- doc/salome/examples/modifying_meshes_ex21.py | 6 +- doc/salome/examples/modifying_meshes_ex23.py | 6 +- doc/salome/examples/modifying_meshes_ex25.py | 22 +-- doc/salome/examples/quality_controls_ex01.py | 8 +- doc/salome/examples/quality_controls_ex02.py | 8 +- doc/salome/examples/quality_controls_ex03.py | 10 +- doc/salome/examples/quality_controls_ex04.py | 8 +- doc/salome/examples/quality_controls_ex05.py | 8 +- doc/salome/examples/quality_controls_ex06.py | 8 +- doc/salome/examples/quality_controls_ex11.py | 10 +- doc/salome/examples/quality_controls_ex12.py | 10 +- doc/salome/examples/quality_controls_ex13.py | 10 +- doc/salome/examples/quality_controls_ex14.py | 10 +- doc/salome/examples/quality_controls_ex15.py | 10 +- doc/salome/examples/quality_controls_ex16.py | 10 +- doc/salome/examples/quality_controls_ex17.py | 10 +- doc/salome/examples/quality_controls_ex18.py | 10 +- doc/salome/examples/quality_controls_ex19.py | 10 +- doc/salome/examples/quality_controls_ex20.py | 10 +- doc/salome/examples/quality_controls_ex21.py | 12 +- doc/salome/examples/quality_controls_ex22.py | 10 +- .../examples/transforming_meshes_ex06.py | 26 ++-- .../examples/transforming_meshes_ex09.py | 4 +- .../examples/transforming_meshes_ex10.py | 10 +- .../examples/transforming_meshes_ex11.py | 36 ++--- .../examples/transforming_meshes_ex13.py | 4 +- doc/salome/examples/viewing_meshes_ex01.py | 44 +++--- doc/salome/gui/SMESH/collect_mesh_methods.py | 4 +- src/SMESH_PY/smeshstudytools.py | 2 +- src/SMESH_SWIG/PAL_MESH_041_mesh.py | 18 +-- src/SMESH_SWIG/SMESH_AdvancedEditor.py | 2 +- src/SMESH_SWIG/SMESH_BelongToGeom.py | 8 +- src/SMESH_SWIG/SMESH_GroupFromGeom.py | 2 +- src/SMESH_SWIG/SMESH_GroupFromGeom2.py | 28 ++-- src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py | 2 +- src/SMESH_SWIG/SMESH_Nut.py | 62 ++++---- src/SMESH_SWIG/SMESH_Partition1_tetra.py | 64 ++++---- src/SMESH_SWIG/SMESH_box2_tetra.py | 70 ++++----- src/SMESH_SWIG/SMESH_box3_tetra.py | 78 +++++----- src/SMESH_SWIG/SMESH_box_tetra.py | 54 +++---- src/SMESH_SWIG/SMESH_controls.py | 20 +-- src/SMESH_SWIG/SMESH_demo_hexa2_upd.py | 44 +++--- src/SMESH_SWIG/SMESH_fixation_hexa.py | 46 +++--- src/SMESH_SWIG/SMESH_fixation_netgen.py | 34 ++--- src/SMESH_SWIG/SMESH_fixation_tetra.py | 56 +++---- src/SMESH_SWIG/SMESH_flight_skin.py | 42 +++--- src/SMESH_SWIG/SMESH_freebord.py | 4 +- src/SMESH_SWIG/SMESH_hexaedre.py | 22 +-- src/SMESH_SWIG/SMESH_mechanic.py | 34 ++--- src/SMESH_SWIG/SMESH_mechanic_editor.py | 34 ++--- src/SMESH_SWIG/SMESH_mechanic_netgen.py | 32 ++-- src/SMESH_SWIG/SMESH_mechanic_tetra.py | 46 +++--- src/SMESH_SWIG/SMESH_reg.py | 18 +-- src/SMESH_SWIG/SMESH_shared_modules.py | 2 +- src/SMESH_SWIG/SMESH_test.py | 44 +++--- src/SMESH_SWIG/SMESH_test0.py | 6 +- src/SMESH_SWIG/SMESH_test1.py | 36 ++--- src/SMESH_SWIG/SMESH_test1_AndDisplay.py | 36 ++--- src/SMESH_SWIG/SMESH_test2.py | 8 +- src/SMESH_SWIG/SMESH_test4.py | 2 +- src/SMESH_SWIG/SMESH_test5.py | 14 +- src/SMESH_SWIG/StdMeshersBuilder.py | 24 +-- src/SMESH_SWIG/batchmode_mefisto.py | 76 +++++----- src/SMESH_SWIG/batchmode_smesh.py | 2 +- src/SMESH_SWIG/ex00_all.py | 38 ++--- src/SMESH_SWIG/ex29_refine.py | 6 +- src/SMESH_SWIG/ex30_tepal.py | 4 +- src/SMESH_SWIG/ex31_dimGroup.py | 4 +- src/SMESH_SWIG/smesh.py | 10 +- src/SMESH_SWIG/smeshBuilder.py | 137 +++++++++--------- src/SMESH_SWIG/smesh_algorithm.py | 24 +-- src/SMESH_SWIG/smesh_selection.py | 8 +- .../MGCleanerPlug/MGCleanerMonPlugDialog.py | 12 +- .../MGCleanerPlug/MGCleanerMonViewText.py | 12 +- src/Tools/MacMesh/Example/PressureValve.py.in | 2 +- src/Tools/MacMesh/MacMesh/Alarms.py | 2 +- src/Tools/MacMesh/MacMesh/CentralUnrefine.py | 4 +- src/Tools/MacMesh/MacMesh/CompositeBox.py | 10 +- src/Tools/MacMesh/MacMesh/CompositeBoxF.py | 20 +-- src/Tools/MacMesh/MacMesh/CutnGroup.py | 8 +- src/Tools/MacMesh/MacMesh/Cylinder.py | 8 +- src/Tools/MacMesh/MacMesh/GenFunctions.py | 22 +-- src/Tools/MacMesh/MacMesh/MacObject.py | 8 +- src/Tools/MacMesh/MacMesh/PublishGroups.py | 14 +- src/Tools/MacMesh/MacMesh/SharpAngle.py | 8 +- src/Tools/MeshCut/meshcut_plugin.py | 12 +- src/Tools/Verima/Base/dataBase.py | 64 ++++---- src/Tools/Verima/Base/exportToCSV.py | 2 +- src/Tools/Verima/Base/importFromCSV.py | 6 +- src/Tools/Verima/Base/tableDeBase.py | 32 ++-- src/Tools/Verima/Base/tableGroupeRatios.py | 8 +- src/Tools/Verima/Base/tableGroupeTailles.py | 8 +- src/Tools/Verima/Base/tableGroupes.py | 12 +- src/Tools/Verima/Base/tableGroupesRef.py | 6 +- src/Tools/Verima/Base/tableMachines.py | 6 +- src/Tools/Verima/Base/tableMaillages.py | 30 ++-- src/Tools/Verima/Base/tableMailles.py | 10 +- src/Tools/Verima/Base/tableMailleurs.py | 14 +- src/Tools/Verima/Base/tablePerfs.py | 12 +- src/Tools/Verima/Base/tableRatios.py | 8 +- src/Tools/Verima/Base/tableTailles.py | 8 +- src/Tools/Verima/Base/tableVersions.py | 6 +- src/Tools/Verima/Base/versions.py | 2 +- src/Tools/Verima/CreeDocuments/jobHtml.py | 8 +- src/Tools/Verima/Gui/maFenetreChoix.py | 2 +- src/Tools/Verima/Gui/monEditor.py | 2 +- src/Tools/Verima/Stats/getCritere.py | 4 +- src/Tools/Verima/Stats/getStats.py | 6 +- src/Tools/Verima/Stats/job.py | 14 +- src/Tools/Verima/Stats/ref.py | 40 ++--- src/Tools/Verima/Stats/utiles.py | 2 +- src/Tools/Verima/ajoutEnreg.py | 10 +- src/Tools/Verima/compareVersions.py | 4 +- src/Tools/Verima/createDatabase.py | 2 +- src/Tools/Verima/lance.py | 12 +- src/Tools/Verima/passeJobs.py | 10 +- src/Tools/YamsPlug/monViewText.py | 12 +- src/Tools/YamsPlug/monYamsPlugDialog.py | 14 +- src/Tools/ZCracksPlug/Zset.py | 28 ++-- src/Tools/ZCracksPlug/__init__.py | 12 +- src/Tools/ZCracksPlug/casTests/launchCas.py | 18 +-- .../ZCracksPlug/casTests/launchManuel.py | 4 +- src/Tools/ZCracksPlug/ellipse.py | 6 +- src/Tools/ZCracksPlug/genereCrack.py | 24 +-- src/Tools/ZCracksPlug/main.py | 22 +-- src/Tools/ZCracksPlug/rectangle.py | 6 +- src/Tools/ZCracksPlug/sphere.py | 6 +- src/Tools/ZCracksPlug/utilityFunctions.py | 8 +- src/Tools/ZCracksPlug/zcracks_plugin.py | 4 +- src/Tools/ZCracksPlug/zcracks_ui.py | 2 +- src/Tools/blocFissure/CasTests/cubeAngle2.py | 2 +- src/Tools/blocFissure/CasTests/cylindre_2.py | 2 +- src/Tools/blocFissure/CasTests/ellipse_2.py | 2 +- .../CasTests/eprouvetteDroite_2.py | 2 +- .../blocFissure/CasTests/execution_Cas.py | 2 +- .../blocFissure/CasTests/fissure_Coude_4.py | 4 +- src/Tools/blocFissure/gmu/__init__.py | 2 +- .../gmu/ajustePointsEdgePipeFissure.py | 6 +- src/Tools/blocFissure/gmu/blocDefaut.py | 2 +- .../gmu/calculePointsAxiauxPipe.py | 4 +- src/Tools/blocFissure/gmu/casStandard.py | 34 ++--- .../blocFissure/gmu/checkDecoupePartition.py | 4 +- src/Tools/blocFissure/gmu/commonSubShapes.py | 4 +- src/Tools/blocFissure/gmu/compoundFromList.py | 8 +- .../gmu/construitEdgesRadialesDebouchantes.py | 10 +- .../gmu/construitFissureGenerale.py | 64 ++++---- .../blocFissure/gmu/construitMaillagePipe.py | 4 +- .../gmu/construitPartitionsPeauFissure.py | 10 +- .../blocFissure/gmu/creePointsPipePeau.py | 10 +- .../gmu/creeZoneDefautDansObjetSain.py | 20 +-- .../blocFissure/gmu/creeZoneDefautFilling.py | 8 +- .../blocFissure/gmu/creeZoneDefautGeom.py | 10 +- .../blocFissure/gmu/creeZoneDefautMaillage.py | 6 +- src/Tools/blocFissure/gmu/eliminateDoubles.py | 6 +- .../blocFissure/gmu/elimineExtremitesPipe.py | 4 +- src/Tools/blocFissure/gmu/ellipsoideDefaut.py | 4 +- .../blocFissure/gmu/extractionOrientee.py | 10 +- .../gmu/extractionOrienteeMulti.py | 10 +- src/Tools/blocFissure/gmu/facesCirculaires.py | 8 +- src/Tools/blocFissure/gmu/facesFissure.py | 8 +- src/Tools/blocFissure/gmu/facesToreInBloc.py | 8 +- .../blocFissure/gmu/facesVolumesToriques.py | 12 +- .../blocFissure/gmu/findWireEndVertices.py | 12 +- .../gmu/findWireIntermediateVertices.py | 12 +- src/Tools/blocFissure/gmu/fissureCoude.py | 22 +-- .../gmu/fusionMaillageAttributionDefaut.py | 14 +- .../gmu/genereElemsFissureElliptique.py | 18 +-- .../gmu/genereMeshCalculZoneDefaut.py | 2 +- src/Tools/blocFissure/gmu/geomsmesh.py | 2 +- .../blocFissure/gmu/getCentreFondFiss.py | 8 +- .../gmu/getStatsMaillageFissure.py | 4 +- src/Tools/blocFissure/gmu/getSubshapeIds.py | 2 +- .../blocFissure/gmu/identifieEdgesPeau.py | 10 +- .../gmu/identifieElementsDebouchants.py | 14 +- .../gmu/identifieElementsFissure.py | 12 +- .../gmu/identifieElementsGeometriquesPeau.py | 10 +- .../gmu/identifieFacesEdgesFissureExterne.py | 8 +- .../blocFissure/gmu/identifieFacesPeau.py | 12 +- src/Tools/blocFissure/gmu/initEtude.py | 2 +- .../gmu/insereFissureElliptique.py | 34 ++--- .../blocFissure/gmu/insereFissureGenerale.py | 64 ++++---- .../blocFissure/gmu/insereFissureLongue.py | 38 ++--- .../blocFissure/gmu/listOfExtraFunctions.py | 2 +- .../blocFissure/gmu/mailleAretesEtJonction.py | 6 +- .../blocFissure/gmu/mailleFacesFissure.py | 6 +- src/Tools/blocFissure/gmu/mailleFacesPeau.py | 12 +- src/Tools/blocFissure/gmu/meshBlocPart.py | 6 +- .../blocFissure/gmu/orderEdgesFromWire.py | 16 +- .../blocFissure/gmu/partitionBlocDefaut.py | 8 +- .../blocFissure/gmu/partitionVolumeSain.py | 8 +- .../gmu/partitionneFissureParPipe.py | 14 +- src/Tools/blocFissure/gmu/peauInterne.py | 10 +- src/Tools/blocFissure/gmu/produitMixte.py | 2 +- .../blocFissure/gmu/projettePointSurCourbe.py | 2 +- src/Tools/blocFissure/gmu/prolongeVertices.py | 2 +- src/Tools/blocFissure/gmu/prolongeWire.py | 12 +- src/Tools/blocFissure/gmu/propagateTore.py | 8 +- src/Tools/blocFissure/gmu/putName.py | 2 +- .../blocFissure/gmu/quadranglesToShape.py | 22 +-- .../gmu/quadranglesToShapeNoCorner.py | 22 +-- .../gmu/quadranglesToShapeWithCorner.py | 12 +- .../blocFissure/gmu/regroupeSainEtDefaut.py | 4 +- .../blocFissure/gmu/restreintFaceFissure.py | 12 +- src/Tools/blocFissure/gmu/rotTrans.py | 10 +- src/Tools/blocFissure/gmu/shapeSurFissure.py | 8 +- src/Tools/blocFissure/gmu/shapesSurFissure.py | 2 +- src/Tools/blocFissure/gmu/sortEdges.py | 2 +- src/Tools/blocFissure/gmu/sortFaces.py | 2 +- src/Tools/blocFissure/gmu/sortGeneratrices.py | 8 +- src/Tools/blocFissure/gmu/sortSolids.py | 2 +- .../blocFissure/gmu/substractSubShapes.py | 4 +- src/Tools/blocFissure/gmu/toreFissure.py | 10 +- src/Tools/blocFissure/gmu/triedreBase.py | 8 +- .../blocFissure/gmu/trouveEdgesFissPeau.py | 8 +- src/Tools/blocFissure/gmu/whichSide.py | 2 +- src/Tools/blocFissure/gmu/whichSideMulti.py | 2 +- src/Tools/blocFissure/gmu/whichSideVertex.py | 2 +- src/Tools/blocFissure/ihm/fissureCoude_ihm.py | 2 +- .../blocFissure/ihm/fissureCoude_plugin.py | 34 ++--- .../blocFissure/ihm/fissureGenerale_plugin.py | 60 ++++---- src/Tools/padder/spadderpy/__init__.py | 6 +- src/Tools/padder/spadderpy/configreader.py | 30 ++-- src/Tools/padder/spadderpy/gui/inputdialog.py | 28 ++-- .../padder/spadderpy/gui/plugindialog.py | 6 +- .../padder/spadderpy/plugin/spadderPlugin.py | 2 +- .../unittests/usecase_meshJobManager.py | 22 +-- .../unittests/usecase_spadderPluginTester.py | 8 +- 297 files changed, 1876 insertions(+), 1881 deletions(-) diff --git a/bin/smesh_setenv.py b/bin/smesh_setenv.py index ad3d2df9b..443ac5571 100644 --- a/bin/smesh_setenv.py +++ b/bin/smesh_setenv.py @@ -30,7 +30,7 @@ def set_env(args): python_version="python%d.%d" % sys.version_info[0:2] - if not os.environ.has_key("SALOME_StdMeshersResources"): + if "SALOME_StdMeshersResources" not in os.environ: os.environ["SALOME_StdMeshersResources"] \ = os.path.join(os.environ["SMESH_ROOT_DIR"],"share",salome_subdir,"resources","smesh") pass @@ -38,7 +38,7 @@ def set_env(args): # find plugins plugin_list = ["StdMeshers"] resource_path_list = [] - for env_var in os.environ.keys(): + for env_var in list(os.environ.keys()): value = os.environ[env_var] if env_var[-9:] == "_ROOT_DIR" and value: plugin_root = value @@ -61,7 +61,7 @@ def set_env(args): # add paths of plugin plugin_list.append(plugin) - if not os.environ.has_key("SALOME_"+plugin+"Resources"): + if "SALOME_"+plugin+"Resources" not in os.environ: resource_path = os.path.join(plugin_root,"share",salome_subdir,"resources",plugin.lower()) os.environ["SALOME_"+plugin+"Resources"] = resource_path resource_path_list.append( resource_path ) diff --git a/doc/salome/examples/cartesian_algo.py b/doc/salome/examples/cartesian_algo.py index e5651cb67..179b9bb3f 100644 --- a/doc/salome/examples/cartesian_algo.py +++ b/doc/salome/examples/cartesian_algo.py @@ -22,23 +22,23 @@ mesh = smesh.Mesh( sphere ) cartAlgo = mesh.BodyFitted() # define a cartesian grid using Coordinates -coords = range(-100,100,10) +coords = list(range(-100,100,10)) cartHyp = cartAlgo.SetGrid( coords,coords,coords, 1000000) # compute the mesh mesh.Compute() -print "nb hexahedra",mesh.NbHexas() -print "nb tetrahedra",mesh.NbTetras() -print "nb polyhedra",mesh.NbPolyhedrons() -print +print("nb hexahedra",mesh.NbHexas()) +print("nb tetrahedra",mesh.NbTetras()) +print("nb polyhedra",mesh.NbPolyhedrons()) +print() # define the grid by setting constant spacing cartHyp = cartAlgo.SetGrid( "10","10","10", 1000000) mesh.Compute() -print "nb hexahedra",mesh.NbHexas() -print "nb tetrahedra",mesh.NbTetras() -print "nb polyhedra",mesh.NbPolyhedrons() +print("nb hexahedra",mesh.NbHexas()) +print("nb tetrahedra",mesh.NbTetras()) +print("nb polyhedra",mesh.NbPolyhedrons()) # define the grid by setting different spacing in 2 sub-ranges of geometry @@ -46,10 +46,10 @@ spaceFuns = ["5","10+10*t"] cartAlgo.SetGrid( [spaceFuns, [0.5]], [spaceFuns, [0.5]], [spaceFuns, [0.25]], 10 ) mesh.Compute() -print "nb hexahedra",mesh.NbHexas() -print "nb tetrahedra",mesh.NbTetras() -print "nb polyhedra",mesh.NbPolyhedrons() -print +print("nb hexahedra",mesh.NbHexas()) +print("nb tetrahedra",mesh.NbTetras()) +print("nb polyhedra",mesh.NbPolyhedrons()) +print() # Example of customization of dirtections of the grid axes @@ -67,23 +67,23 @@ mesh = smesh.Mesh( box, "custom axes") algo = mesh.BodyFitted() algo.SetGrid( spc, spc, spc, 10000 ) mesh.Compute() -print "Default axes" -print " nb hex:",mesh.NbHexas() +print("Default axes") +print(" nb hex:",mesh.NbHexas()) # set axes using edges of the box algo.SetAxesDirs( xDir, [-0.1,1,0], zDir ) mesh.Compute() -print "Manual axes" -print " nb hex:",mesh.NbHexas() +print("Manual axes") +print(" nb hex:",mesh.NbHexas()) # set optimal orthogonal axes algo.SetOptimalAxesDirs( isOrthogonal=True ) mesh.Compute() -print "Optimal orthogonal axes" -print " nb hex:",mesh.NbHexas() +print("Optimal orthogonal axes") +print(" nb hex:",mesh.NbHexas()) # set optimal non-orthogonal axes algo.SetOptimalAxesDirs( isOrthogonal=False ) mesh.Compute() -print "Optimal non-orthogonal axes" -print " nb hex:",mesh.NbHexas() +print("Optimal non-orthogonal axes") +print(" nb hex:",mesh.NbHexas()) diff --git a/doc/salome/examples/creating_meshes_ex01.py b/doc/salome/examples/creating_meshes_ex01.py index f328d0582..1d0d94f76 100644 --- a/doc/salome/examples/creating_meshes_ex01.py +++ b/doc/salome/examples/creating_meshes_ex01.py @@ -29,7 +29,7 @@ algo3D.MaxElementVolume(900.) # compute the mesh ret = tetra.Compute() if ret == 0: - print "problem when computing the mesh" + print("problem when computing the mesh") else: - print "mesh computed" + print("mesh computed") pass diff --git a/doc/salome/examples/creating_meshes_ex03.py b/doc/salome/examples/creating_meshes_ex03.py index 8687b8971..fbc0eca24 100644 --- a/doc/salome/examples/creating_meshes_ex03.py +++ b/doc/salome/examples/creating_meshes_ex03.py @@ -45,15 +45,15 @@ SubMesh_3 = MEFISTO_2D_3.GetSubMesh() # check exisiting sub-mesh priority order [ [ SubMesh_1, SubMesh_3, SubMesh_2 ] ] = Mesh_1.GetMeshOrder() isDone = Mesh_1.Compute() -print "Nb elements at initial order of sub-meshes:", Mesh_1.NbElements() +print("Nb elements at initial order of sub-meshes:", Mesh_1.NbElements()) # set new sub-mesh order isDone = Mesh_1.SetMeshOrder( [ [ SubMesh_1, SubMesh_2, SubMesh_3 ] ]) # compute mesh isDone = Mesh_1.Compute() -print "Nb elements at new order of sub-meshes:", Mesh_1.NbElements() +print("Nb elements at new order of sub-meshes:", Mesh_1.NbElements()) # compute with other sub-mesh order isDone = Mesh_1.SetMeshOrder( [ [ SubMesh_2, SubMesh_1, SubMesh_3 ] ]) isDone = Mesh_1.Compute() -print "Nb elements at another order of sub-meshes:", Mesh_1.NbElements() +print("Nb elements at another order of sub-meshes:", Mesh_1.NbElements()) diff --git a/doc/salome/examples/creating_meshes_ex04.py b/doc/salome/examples/creating_meshes_ex04.py index 82408d5a3..b0db4bdb7 100644 --- a/doc/salome/examples/creating_meshes_ex04.py +++ b/doc/salome/examples/creating_meshes_ex04.py @@ -12,11 +12,11 @@ smesh = smeshBuilder.New(salome.myStudy) def PrintMeshInfo(theMesh): aMesh = theMesh.GetMesh() - print "Information about mesh:" - print "Number of nodes : ", aMesh.NbNodes() - print "Number of edges : ", aMesh.NbEdges() - print "Number of faces : ", aMesh.NbFaces() - print "Number of volumes : ", aMesh.NbVolumes() + print("Information about mesh:") + print("Number of nodes : ", aMesh.NbNodes()) + print("Number of edges : ", aMesh.NbEdges()) + print("Number of faces : ", aMesh.NbFaces()) + print("Number of volumes : ", aMesh.NbVolumes()) pass # create a box diff --git a/doc/salome/examples/creating_meshes_ex05.py b/doc/salome/examples/creating_meshes_ex05.py index ae1d073b4..fbafc4b11 100644 --- a/doc/salome/examples/creating_meshes_ex05.py +++ b/doc/salome/examples/creating_meshes_ex05.py @@ -47,12 +47,12 @@ import MEDLoader, os # on XOY plane, and autoDimension=True by default mesh2D.ExportMED( medFile ) medMesh = MEDLoader.MEDLoader.ReadUMeshFromFile(medFile,mesh2D.GetName(),0) -print "autoDimension==True, exported mesh is in %sD"%medMesh.getSpaceDimension() +print("autoDimension==True, exported mesh is in %sD"%medMesh.getSpaceDimension()) # exported mesh is in 3D space, same as in Mesh module, # thanks to autoDimension=False mesh2D.ExportMED( medFile, autoDimension=False ) medMesh = MEDLoader.MEDLoader.ReadUMeshFromFile(medFile,mesh2D.GetName(),0) -print "autoDimension==False, exported mesh is in %sD"%medMesh.getSpaceDimension() +print("autoDimension==False, exported mesh is in %sD"%medMesh.getSpaceDimension()) os.remove( medFile ) diff --git a/doc/salome/examples/defining_hypotheses_ex06.py b/doc/salome/examples/defining_hypotheses_ex06.py index 495067aa6..6fd5e0210 100644 --- a/doc/salome/examples/defining_hypotheses_ex06.py +++ b/doc/salome/examples/defining_hypotheses_ex06.py @@ -32,6 +32,6 @@ algo3D.MaxElementVolume(200.) # compute the mesh ret = tetra.Compute() if ret == 0: - print "problem when computing the mesh" + print("problem when computing the mesh") else: - print "Computation succeeded" + print("Computation succeeded") diff --git a/doc/salome/examples/filters_belong2group.py b/doc/salome/examples/filters_belong2group.py index f500d1b14..b3b5b61b7 100644 --- a/doc/salome/examples/filters_belong2group.py +++ b/doc/salome/examples/filters_belong2group.py @@ -2,11 +2,11 @@ # create mesh from SMESH_mechanic import * -print +print() # create a group of all faces (quadrangles) generated on sub_face3 quads_on_face3 = mesh.MakeGroup("quads_on_face3", SMESH.FACE, SMESH.FT_BelongToGeom,'=',sub_face3) -print "There are %s quadrangles generated on '%s' and included in the group '%s'" % ( quads_on_face3.Size(), sub_face3.GetName(), quads_on_face3.GetName() ) +print("There are %s quadrangles generated on '%s' and included in the group '%s'" % ( quads_on_face3.Size(), sub_face3.GetName(), quads_on_face3.GetName() )) # create a group of all the rest quadrangles, generated on other faces by combining 2 criteria: # - negated FT_BelongToMeshGroup to select elements not included in quads_on_face3 @@ -15,5 +15,5 @@ not_on_face3 = smesh.GetCriterion( SMESH.FACE, SMESH.FT_BelongToMeshGroup,'=',qu quadrangles = smesh.GetCriterion( SMESH.FACE, SMESH.FT_ElemGeomType,'=',SMESH.Geom_QUADRANGLE ) rest_quads = mesh.MakeGroupByCriteria("rest_quads", [ not_on_face3, quadrangles ]) -print "'%s' group includes all the rest %s quadrangles" % ( rest_quads.GetName(), rest_quads.Size() ) +print("'%s' group includes all the rest %s quadrangles" % ( rest_quads.GetName(), rest_quads.Size() )) diff --git a/doc/salome/examples/filters_ex01.py b/doc/salome/examples/filters_ex01.py index 812e94288..02f3588c8 100644 --- a/doc/salome/examples/filters_ex01.py +++ b/doc/salome/examples/filters_ex01.py @@ -7,38 +7,38 @@ from SMESH_mechanic import * # get faces with aspect ratio > 2.5 filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_AspectRatio, SMESH.FT_MoreThan, 2.5) ids = mesh.GetIdsFromFilter(filter) -print "Number of faces with aspect ratio > 2.5:", len(ids) +print("Number of faces with aspect ratio > 2.5:", len(ids)) # get faces with aspect ratio > 1.5 filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_AspectRatio, '>', 1.5, mesh=mesh) ids = filter.GetIDs() -print "Number of faces with aspect ratio > 1.5:", len(ids) +print("Number of faces with aspect ratio > 1.5:", len(ids)) # copy the faces with aspect ratio > 1.5 to another mesh; # this demostrates that a filter can be used where usually a group or sub-mesh is acceptable filter.SetMesh( mesh.GetMesh() ) # - actually non necessary as mesh is set at filter creation mesh2 = smesh.CopyMesh( filter, "AR > 1.5" ) -print "Number of copied faces with aspect ratio > 1.5:", mesh2.NbFaces() +print("Number of copied faces with aspect ratio > 1.5:", mesh2.NbFaces()) # create a group (Group on Filter) of faces with Aspect Ratio < 1.5 group = mesh.MakeGroup("AR < 1.5", SMESH.FACE, SMESH.FT_AspectRatio, '<', 1.5) -print "Number of faces with aspect ratio < 1.5:", group.Size() +print("Number of faces with aspect ratio < 1.5:", group.Size()) # combine several criteria to Create a Group of only Triangular faces with Aspect Ratio < 1.5; # note that contents of a GroupOnFilter is dynamically updated as the mesh changes crit = [ smesh.GetCriterion( SMESH.FACE, SMESH.FT_AspectRatio, '<', 1.5, BinaryOp=SMESH.FT_LogicalAND ), smesh.GetCriterion( SMESH.FACE, SMESH.FT_ElemGeomType,'=', SMESH.Geom_TRIANGLE ) ] triaGroup = mesh.MakeGroupByCriteria( "Tria AR < 1.5", crit ) -print "Number of triangles with aspect ratio < 1.5:", triaGroup.Size() +print("Number of triangles with aspect ratio < 1.5:", triaGroup.Size()) # get range of values of Aspect Ratio of all faces in the mesh aspects = mesh.GetMinMax( SMESH.FT_AspectRatio ) -print "MESH: Min aspect = %s, Max aspect = %s" % ( aspects[0], aspects[1] ) +print("MESH: Min aspect = %s, Max aspect = %s" % ( aspects[0], aspects[1] )) # get max value of Aspect Ratio of faces in triaGroup grAspects = mesh.GetMinMax( SMESH.FT_AspectRatio, triaGroup ) -print "GROUP: Max aspect = %s" % grAspects[1] +print("GROUP: Max aspect = %s" % grAspects[1]) # get Aspect Ratio of an element aspect = mesh.FunctorValue( SMESH.FT_AspectRatio, ids[0] ) -print "Aspect ratio of the face %s = %s" % ( ids[0], aspect ) +print("Aspect ratio of the face %s = %s" % ( ids[0], aspect )) diff --git a/doc/salome/examples/filters_ex02.py b/doc/salome/examples/filters_ex02.py index 5709ef4b0..6a392ce41 100644 --- a/doc/salome/examples/filters_ex02.py +++ b/doc/salome/examples/filters_ex02.py @@ -7,4 +7,4 @@ mesh.Compute() # get volumes with aspect ratio < 2.0 filter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_AspectRatio3D, SMESH.FT_LessThan, 2.0) ids = mesh.GetIdsFromFilter(filter) -print "Number of volumes with aspect ratio < 2.0:", len(ids) +print("Number of volumes with aspect ratio < 2.0:", len(ids)) diff --git a/doc/salome/examples/filters_ex03.py b/doc/salome/examples/filters_ex03.py index 9d5467e6f..e01b60df5 100644 --- a/doc/salome/examples/filters_ex03.py +++ b/doc/salome/examples/filters_ex03.py @@ -5,4 +5,4 @@ from SMESH_mechanic import * # get faces with warping angle = 2.0e-13 with tolerance 5.0e-14 filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Warping, "=", 2.0e-13, Tolerance=5.0e-14) ids = mesh.GetIdsFromFilter(filter) -print "Number of faces with warping angle = 2.0e-13 (tolerance 5.0e-14):", len(ids) +print("Number of faces with warping angle = 2.0e-13 (tolerance 5.0e-14):", len(ids)) diff --git a/doc/salome/examples/filters_ex04.py b/doc/salome/examples/filters_ex04.py index fef619c80..2b274837a 100644 --- a/doc/salome/examples/filters_ex04.py +++ b/doc/salome/examples/filters_ex04.py @@ -5,4 +5,4 @@ from SMESH_mechanic import * # get faces with minimum angle > 75 filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MinimumAngle,">", 75) ids = mesh.GetIdsFromFilter(filter) -print "Number of faces with minimum angle > 75:", len(ids) +print("Number of faces with minimum angle > 75:", len(ids)) diff --git a/doc/salome/examples/filters_ex05.py b/doc/salome/examples/filters_ex05.py index c1c185275..c470db6bc 100644 --- a/doc/salome/examples/filters_ex05.py +++ b/doc/salome/examples/filters_ex05.py @@ -5,4 +5,4 @@ from SMESH_mechanic import * # get faces with taper < 1.e-15 filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Taper, SMESH.FT_LessThan, 1.e-15) ids = mesh.GetIdsFromFilter(filter) -print "Number of faces with taper < 1.e-15:", len(ids) +print("Number of faces with taper < 1.e-15:", len(ids)) diff --git a/doc/salome/examples/filters_ex06.py b/doc/salome/examples/filters_ex06.py index 610a9a9e8..94666f70c 100644 --- a/doc/salome/examples/filters_ex06.py +++ b/doc/salome/examples/filters_ex06.py @@ -5,4 +5,4 @@ from SMESH_mechanic import * # get faces with skew > 50 filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Skew, SMESH.FT_MoreThan, 50) ids = mesh.GetIdsFromFilter(filter) -print "Number of faces with skew > 50:", len(ids) +print("Number of faces with skew > 50:", len(ids)) diff --git a/doc/salome/examples/filters_ex07.py b/doc/salome/examples/filters_ex07.py index 3afee5e1a..7d781dc22 100644 --- a/doc/salome/examples/filters_ex07.py +++ b/doc/salome/examples/filters_ex07.py @@ -7,4 +7,4 @@ criterion1 = smesh.GetCriterion(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 60 criterion2 = smesh.GetCriterion(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 90) filter = smesh.GetFilterFromCriteria([criterion1,criterion2], SMESH.FT_LogicalAND) ids = mesh.GetIdsFromFilter(filter) -print "Number of faces with area in range (60,90):", len(ids) +print("Number of faces with area in range (60,90):", len(ids)) diff --git a/doc/salome/examples/filters_ex08.py b/doc/salome/examples/filters_ex08.py index d87f97453..479de961e 100644 --- a/doc/salome/examples/filters_ex08.py +++ b/doc/salome/examples/filters_ex08.py @@ -7,4 +7,4 @@ mesh.Compute() # get volumes faces with volume > 100 filter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_Volume3D, SMESH.FT_MoreThan, 100) ids = mesh.GetIdsFromFilter(filter) -print "Number of volumes with volume > 100:", len(ids) +print("Number of volumes with volume > 100:", len(ids)) diff --git a/doc/salome/examples/filters_ex09.py b/doc/salome/examples/filters_ex09.py index 032d55ddd..8f00c7f8d 100644 --- a/doc/salome/examples/filters_ex09.py +++ b/doc/salome/examples/filters_ex09.py @@ -18,4 +18,4 @@ mesh.Compute() # get all free borders filter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_FreeBorders) ids = mesh.GetIdsFromFilter(filter) -print "Number of edges on free borders:", len(ids) +print("Number of edges on free borders:", len(ids)) diff --git a/doc/salome/examples/filters_ex10.py b/doc/salome/examples/filters_ex10.py index bf6f7419b..0cba34f16 100644 --- a/doc/salome/examples/filters_ex10.py +++ b/doc/salome/examples/filters_ex10.py @@ -19,4 +19,4 @@ mesh.Compute() # get all faces with free edges filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_FreeEdges) ids = mesh.GetIdsFromFilter(filter) -print "Number of faces with free edges:", len(ids) +print("Number of faces with free edges:", len(ids)) diff --git a/doc/salome/examples/filters_ex11.py b/doc/salome/examples/filters_ex11.py index 5f1bf4c68..47b62e282 100644 --- a/doc/salome/examples/filters_ex11.py +++ b/doc/salome/examples/filters_ex11.py @@ -7,4 +7,4 @@ mesh.AddNode(0,0,0) # get all free nodes filter = smesh.GetFilter(SMESH.NODE, SMESH.FT_FreeNodes) ids = mesh.GetIdsFromFilter(filter) -print "Number of free nodes:", len(ids) +print("Number of free nodes:", len(ids)) diff --git a/doc/salome/examples/filters_ex12.py b/doc/salome/examples/filters_ex12.py index a1f20dcf3..5dfd81ad4 100644 --- a/doc/salome/examples/filters_ex12.py +++ b/doc/salome/examples/filters_ex12.py @@ -5,4 +5,4 @@ from SMESH_mechanic import * # get all free faces filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_FreeFaces) ids = mesh.GetIdsFromFilter(filter) -print "Number of free faces:", len(ids) +print("Number of free faces:", len(ids)) diff --git a/doc/salome/examples/filters_ex13.py b/doc/salome/examples/filters_ex13.py index 8d8077083..ae64b565a 100644 --- a/doc/salome/examples/filters_ex13.py +++ b/doc/salome/examples/filters_ex13.py @@ -7,4 +7,4 @@ mesh.RemoveElements( mesh.GetElementsByType(SMESH.FACE)[0:5] ) # get all faces with bare borders filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_BareBorderFace) ids = mesh.GetIdsFromFilter(filter) -print "Faces with bare borders:", ids +print("Faces with bare borders:", ids) diff --git a/doc/salome/examples/filters_ex14.py b/doc/salome/examples/filters_ex14.py index a9021f98c..2e68ae8f2 100644 --- a/doc/salome/examples/filters_ex14.py +++ b/doc/salome/examples/filters_ex14.py @@ -6,4 +6,4 @@ faceID = mesh.GetElementsByType(SMESH.FACE)[0] # get all faces co-planar to the first face with tolerance 5 degrees filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_CoplanarFaces,faceID,Tolerance=5.0) ids = mesh.GetIdsFromFilter(filter) -print "Number of faces coplanar with the first one:", len(ids) +print("Number of faces coplanar with the first one:", len(ids)) diff --git a/doc/salome/examples/filters_ex15.py b/doc/salome/examples/filters_ex15.py index 3f1344704..70c8cae5c 100644 --- a/doc/salome/examples/filters_ex15.py +++ b/doc/salome/examples/filters_ex15.py @@ -4,4 +4,4 @@ from SMESH_mechanic import * # get all over-constrained faces filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_OverConstrainedFace) ids = mesh.GetIdsFromFilter(filter) -print "Over-constrained faces:", ids +print("Over-constrained faces:", ids) diff --git a/doc/salome/examples/filters_ex16.py b/doc/salome/examples/filters_ex16.py index bdca2d86a..e549a14f0 100644 --- a/doc/salome/examples/filters_ex16.py +++ b/doc/salome/examples/filters_ex16.py @@ -27,6 +27,6 @@ equalEdgesFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_EqualEdges) equalFacesFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_EqualFaces) equalVolumesFilter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_EqualVolumes) # get equal elements -print "Number of equal edges:", len( mesh.GetIdsFromFilter( equalEdgesFilter )) -print "Number of equal faces:", len( mesh.GetIdsFromFilter( equalFacesFilter )) -print "Number of equal volumes:", len( mesh.GetIdsFromFilter( equalVolumesFilter )) +print("Number of equal edges:", len( mesh.GetIdsFromFilter( equalEdgesFilter ))) +print("Number of equal faces:", len( mesh.GetIdsFromFilter( equalFacesFilter ))) +print("Number of equal volumes:", len( mesh.GetIdsFromFilter( equalVolumesFilter ))) diff --git a/doc/salome/examples/filters_ex17.py b/doc/salome/examples/filters_ex17.py index 9dc01b49c..7398b5ac7 100644 --- a/doc/salome/examples/filters_ex17.py +++ b/doc/salome/examples/filters_ex17.py @@ -20,4 +20,4 @@ mesh.TranslateObject( mesh, [10,0,0], Copy=True ) # create a filter to find nodes equal within tolerance of 1e-5 filter = smesh.GetFilter(SMESH.NODE, SMESH.FT_EqualNodes, Tolerance=1e-5) # get equal nodes -print "Number of equal nodes:", len( mesh.GetIdsFromFilter( filter )) +print("Number of equal nodes:", len( mesh.GetIdsFromFilter( filter ))) diff --git a/doc/salome/examples/filters_ex18.py b/doc/salome/examples/filters_ex18.py index 32950cc50..ea436f478 100644 --- a/doc/salome/examples/filters_ex18.py +++ b/doc/salome/examples/filters_ex18.py @@ -22,4 +22,4 @@ mesh.MergeNodes( mesh.FindCoincidentNodes( 1e-5 )) # get mesh edges with number of connected elements (faces and volumes) == 3 filter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_MultiConnection, 3) ids = mesh.GetIdsFromFilter(filter) -print "Number of border edges with 3 faces connected:", len(ids) +print("Number of border edges with 3 faces connected:", len(ids)) diff --git a/doc/salome/examples/filters_ex19.py b/doc/salome/examples/filters_ex19.py index 3ac78794f..cb1c545a3 100644 --- a/doc/salome/examples/filters_ex19.py +++ b/doc/salome/examples/filters_ex19.py @@ -5,4 +5,4 @@ from SMESH_mechanic import * # get faces which consist of edges belonging to 2 mesh elements filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MultiConnection2D, 2) ids = mesh.GetIdsFromFilter(filter) -print "Number of faces consisting of edges belonging to 2 faces:", len(ids) +print("Number of faces consisting of edges belonging to 2 faces:", len(ids)) diff --git a/doc/salome/examples/filters_ex20.py b/doc/salome/examples/filters_ex20.py index 1bdc00b53..c55b56b23 100644 --- a/doc/salome/examples/filters_ex20.py +++ b/doc/salome/examples/filters_ex20.py @@ -5,4 +5,4 @@ from SMESH_mechanic import * # get edges with length > 14 filter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_Length, SMESH.FT_MoreThan, 14) ids = mesh.GetIdsFromFilter(filter) -print "Number of edges with length > 14:", len(ids) +print("Number of edges with length > 14:", len(ids)) diff --git a/doc/salome/examples/filters_ex21.py b/doc/salome/examples/filters_ex21.py index 79c88434b..81d408701 100644 --- a/doc/salome/examples/filters_ex21.py +++ b/doc/salome/examples/filters_ex21.py @@ -5,4 +5,4 @@ from SMESH_mechanic import * # get all faces that have edges with length > 14 filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Length2D, SMESH.FT_MoreThan, 14) ids = mesh.GetIdsFromFilter(filter) -print "Number of faces with maximum edge length > 14:", len(ids) +print("Number of faces with maximum edge length > 14:", len(ids)) diff --git a/doc/salome/examples/filters_ex22.py b/doc/salome/examples/filters_ex22.py index 0271110fe..cb7971bd6 100644 --- a/doc/salome/examples/filters_ex22.py +++ b/doc/salome/examples/filters_ex22.py @@ -5,4 +5,4 @@ from SMESH_mechanic import * # get all faces that have elements with length > 10 filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MaxElementLength2D, SMESH.FT_MoreThan, 10) ids = mesh.GetIdsFromFilter(filter) -print "Number of faces with maximum element length > 10:", len(ids) +print("Number of faces with maximum element length > 10:", len(ids)) diff --git a/doc/salome/examples/filters_ex23.py b/doc/salome/examples/filters_ex23.py index 49569dfe8..8c995090b 100644 --- a/doc/salome/examples/filters_ex23.py +++ b/doc/salome/examples/filters_ex23.py @@ -7,4 +7,4 @@ mesh.Compute() # get all volumes that have elements with length > 10 filter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_MaxElementLength3D, SMESH.FT_MoreThan, 10) ids = mesh.GetIdsFromFilter(filter) -print "Number of volumes with maximum element length > 10:", len(ids) +print("Number of volumes with maximum element length > 10:", len(ids)) diff --git a/doc/salome/examples/filters_ex24.py b/doc/salome/examples/filters_ex24.py index bab47e2a7..f5f07b024 100644 --- a/doc/salome/examples/filters_ex24.py +++ b/doc/salome/examples/filters_ex24.py @@ -9,4 +9,4 @@ mesh.RemoveElements( mesh.GetElementsByType(VOLUME)[0:5] ) # get all volumes with bare borders filter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_BareBorderVolume) ids = mesh.GetIdsFromFilter(filter) -print "Volumes with bare borders:", ids +print("Volumes with bare borders:", ids) diff --git a/doc/salome/examples/filters_ex25.py b/doc/salome/examples/filters_ex25.py index 06862c75f..f3083f7fb 100644 --- a/doc/salome/examples/filters_ex25.py +++ b/doc/salome/examples/filters_ex25.py @@ -7,4 +7,4 @@ mesh.Compute() # get all over-constrained volumes filter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_OverConstrainedVolume) ids = mesh.GetIdsFromFilter(filter) -print "Over-constrained volumes:", ids +print("Over-constrained volumes:", ids) diff --git a/doc/salome/examples/filters_ex26.py b/doc/salome/examples/filters_ex26.py index d544466e4..ea7cff8ac 100644 --- a/doc/salome/examples/filters_ex26.py +++ b/doc/salome/examples/filters_ex26.py @@ -5,4 +5,4 @@ from SMESH_mechanic import * # get all faces which nodes lie on the face sub_face3 filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_BelongToGeom, sub_face3) ids = mesh.GetIdsFromFilter(filter) -print "Number of faces which nodes lie on sub_face3:", len(ids) +print("Number of faces which nodes lie on sub_face3:", len(ids)) diff --git a/doc/salome/examples/filters_ex27.py b/doc/salome/examples/filters_ex27.py index 4c38bd92f..e05ecbeff 100644 --- a/doc/salome/examples/filters_ex27.py +++ b/doc/salome/examples/filters_ex27.py @@ -5,4 +5,4 @@ from SMESH_mechanic import * # get all faces at least one node of each lies on the face sub_face3 filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_LyingOnGeom, sub_face3) ids = mesh.GetIdsFromFilter(filter) -print "Number of faces at least one node of each lies on sub_face3:", len(ids) +print("Number of faces at least one node of each lies on sub_face3:", len(ids)) diff --git a/doc/salome/examples/filters_ex28.py b/doc/salome/examples/filters_ex28.py index 12da64cc7..f0382ac65 100644 --- a/doc/salome/examples/filters_ex28.py +++ b/doc/salome/examples/filters_ex28.py @@ -8,4 +8,4 @@ geompy.addToStudy(plane_1, "plane_1") # get all nodes which lie on the plane \a plane_1 filter = smesh.GetFilter(SMESH.NODE, SMESH.FT_BelongToPlane, plane_1) ids = mesh.GetIdsFromFilter(filter) -print "Number of nodes which lie on the plane plane_1:", len(ids) +print("Number of nodes which lie on the plane plane_1:", len(ids)) diff --git a/doc/salome/examples/filters_ex29.py b/doc/salome/examples/filters_ex29.py index b4a454ad7..e6b817a4c 100644 --- a/doc/salome/examples/filters_ex29.py +++ b/doc/salome/examples/filters_ex29.py @@ -5,4 +5,4 @@ from SMESH_mechanic import * # get all faces which lie on the cylindrical face \a sub_face1 filter = smesh.GetFilter(SMESH.FACE, SMESH.FT_BelongToCylinder, sub_face1) ids = mesh.GetIdsFromFilter(filter) -print "Number of faces which lie on the cylindrical surface sub_face1:", len(ids) +print("Number of faces which lie on the cylindrical surface sub_face1:", len(ids)) diff --git a/doc/salome/examples/filters_ex30.py b/doc/salome/examples/filters_ex30.py index 9d161a763..856010b9d 100644 --- a/doc/salome/examples/filters_ex30.py +++ b/doc/salome/examples/filters_ex30.py @@ -9,4 +9,4 @@ geompy.addToStudy(surface_1, "surface_1") # get all nodes which lie on the surface \a surface_1 filter = smesh.GetFilter(SMESH.NODE, SMESH.FT_BelongToGenSurface, surface_1) ids = mesh.GetIdsFromFilter(filter) -print "Number of nodes which lie on the surface surface_1:", len(ids) +print("Number of nodes which lie on the surface surface_1:", len(ids)) diff --git a/doc/salome/examples/filters_ex31.py b/doc/salome/examples/filters_ex31.py index ea9b99e0e..209bb9f77 100644 --- a/doc/salome/examples/filters_ex31.py +++ b/doc/salome/examples/filters_ex31.py @@ -9,4 +9,4 @@ criterion2 = smesh.GetCriterion(SMESH.NODE, SMESH.FT_RangeOfIds, Threshold="15-3 filter = smesh.CreateFilterManager().CreateFilter() filter.SetCriteria([criterion1,criterion2]) ids = mesh.GetIdsFromFilter(filter) -print "Number of nodes in ranges [5-10] and [15-30]:", len(ids) +print("Number of nodes in ranges [5-10] and [15-30]:", len(ids)) diff --git a/doc/salome/examples/filters_ex32.py b/doc/salome/examples/filters_ex32.py index 5ce64d625..5630f7812 100644 --- a/doc/salome/examples/filters_ex32.py +++ b/doc/salome/examples/filters_ex32.py @@ -7,4 +7,4 @@ mesh.Compute() # get all badly oriented volumes filter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_BadOrientedVolume) ids = mesh.GetIdsFromFilter(filter) -print "Number of badly oriented volumes:", len(ids) +print("Number of badly oriented volumes:", len(ids)) diff --git a/doc/salome/examples/filters_ex33.py b/doc/salome/examples/filters_ex33.py index 7ffb5548f..4e54e55a7 100644 --- a/doc/salome/examples/filters_ex33.py +++ b/doc/salome/examples/filters_ex33.py @@ -8,13 +8,13 @@ filter_linear = smesh.GetFilter(SMESH.EDGE, SMESH.FT_LinearOrQuadratic) filter_quadratic = smesh.GetFilter(SMESH.EDGE, SMESH.FT_LinearOrQuadratic, SMESH.FT_LogicalNOT) ids_linear = mesh.GetIdsFromFilter(filter_linear) ids_quadratic = mesh.GetIdsFromFilter(filter_quadratic) -print "Number of linear edges:", len(ids_linear), "; number of quadratic edges:", len(ids_quadratic) +print("Number of linear edges:", len(ids_linear), "; number of quadratic edges:", len(ids_quadratic)) # convert mesh to quadratic -print "Convert to quadratic..." +print("Convert to quadratic...") mesh.ConvertToQuadratic() # get linear and quadratic edges ids_linear = mesh.GetIdsFromFilter(filter_linear) ids_quadratic = mesh.GetIdsFromFilter(filter_quadratic) -print "Number of linear edges:", len(ids_linear), "; number of quadratic edges:", len(ids_quadratic) +print("Number of linear edges:", len(ids_linear), "; number of quadratic edges:", len(ids_quadratic)) diff --git a/doc/salome/examples/filters_ex34.py b/doc/salome/examples/filters_ex34.py index 980509dbe..7234f16ac 100644 --- a/doc/salome/examples/filters_ex34.py +++ b/doc/salome/examples/filters_ex34.py @@ -11,4 +11,4 @@ grp.SetColor(c) # get number of the edges not belonging to the group with the given color filter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_GroupColor, c, SMESH.FT_LogicalNOT) ids = mesh.GetIdsFromFilter(filter) -print "Number of edges not beloging to the group with color (0.1, 0.5, 1.0):", len(ids) +print("Number of edges not beloging to the group with color (0.1, 0.5, 1.0):", len(ids)) diff --git a/doc/salome/examples/filters_ex35.py b/doc/salome/examples/filters_ex35.py index 99c5ef546..fea0902b9 100644 --- a/doc/salome/examples/filters_ex35.py +++ b/doc/salome/examples/filters_ex35.py @@ -13,7 +13,7 @@ ids_tri = mesh.GetIdsFromFilter(filter_tri) ids_qua = mesh.GetIdsFromFilter(filter_qua) ids_tet = mesh.GetIdsFromFilter(filter_tet) ids_pyr = mesh.GetIdsFromFilter(filter_pyr) -print "Number of triangles:", len(ids_tri) -print "Number of quadrangles:", len(ids_qua) -print "Number of tetrahedrons:", len(ids_tet) -print "Number of pyramids:", len(ids_pyr) +print("Number of triangles:", len(ids_tri)) +print("Number of quadrangles:", len(ids_qua)) +print("Number of tetrahedrons:", len(ids_tet)) +print("Number of pyramids:", len(ids_pyr)) diff --git a/doc/salome/examples/filters_ex37.py b/doc/salome/examples/filters_ex37.py index 85dcb33cd..06d69d715 100644 --- a/doc/salome/examples/filters_ex37.py +++ b/doc/salome/examples/filters_ex37.py @@ -12,4 +12,4 @@ for face in SubFaceL[: len(SubFaceL)/2]: # get triangles with 7 nodes filter_tri = smesh.GetFilter(SMESH.FACE, SMESH.FT_EntityType,'=', SMESH.Entity_BiQuad_Triangle ) ids_tri = mesh.GetIdsFromFilter(filter_tri) -print "Number of bi-quadratic triangles:", len(ids_tri) +print("Number of bi-quadratic triangles:", len(ids_tri)) diff --git a/doc/salome/examples/filters_ex38.py b/doc/salome/examples/filters_ex38.py index e597608d3..2193c6615 100644 --- a/doc/salome/examples/filters_ex38.py +++ b/doc/salome/examples/filters_ex38.py @@ -12,4 +12,4 @@ for i in range(1,10): # get balls with diameter > 5. diam_filter = smesh.GetFilter(SMESH.BALL, SMESH.FT_BallDiameter,'>', 5. ) ids = mesh.GetIdsFromFilter( diam_filter ) -print "Number of balls with diameter > 5:", len(ids) +print("Number of balls with diameter > 5:", len(ids)) diff --git a/doc/salome/examples/filters_ex39.py b/doc/salome/examples/filters_ex39.py index ebbb0b936..7f956785f 100644 --- a/doc/salome/examples/filters_ex39.py +++ b/doc/salome/examples/filters_ex39.py @@ -29,17 +29,17 @@ mesh.Compute() # using point coordinates in box_1 nodeFilter = smesh.GetFilter( SMESH.NODE, SMESH.FT_ConnectedElements, "=", "1.,2,10", mesh=mesh ) -print "Nb. nodes in box_1:", len( nodeFilter.GetIDs()) +print("Nb. nodes in box_1:", len( nodeFilter.GetIDs())) # using point coordinates in box_2 edgeFilter = smesh.GetFilter( SMESH.EDGE, SMESH.FT_ConnectedElements, "=", [202,1,1 ], mesh=mesh ) -print "Nb. segments in box_2:", len( edgeFilter.GetIDs()) +print("Nb. segments in box_2:", len( edgeFilter.GetIDs())) # using a geom vertex of box_1 faceFilter = smesh.GetFilter( SMESH.FACE, SMESH.FT_ConnectedElements, "=", vertex, mesh=mesh ) -print "Nb. faces in box_1:", len( edgeFilter.GetIDs()) +print("Nb. faces in box_1:", len( edgeFilter.GetIDs())) # using node ID in box_2 voluFilter = smesh.GetFilter( SMESH.VOLUME, SMESH.FT_ConnectedElements, "=", 10, mesh=mesh ) -print "Nb. volumes in box_2:", len( voluFilter.GetIDs()) +print("Nb. volumes in box_2:", len( voluFilter.GetIDs())) diff --git a/doc/salome/examples/filters_node_nb_conn.py b/doc/salome/examples/filters_node_nb_conn.py index c7f73f13d..dc7ce0ea1 100644 --- a/doc/salome/examples/filters_node_nb_conn.py +++ b/doc/salome/examples/filters_node_nb_conn.py @@ -6,4 +6,4 @@ from SMESH_mechanic import * # get nodes connected to more than 6 tetrahedra conn_nb_filter = smesh.GetFilter(SMESH.NODE, SMESH.FT_NodeConnectivityNumber,'>', 6 ) ids = mesh.GetIdsFromFilter( conn_nb_filter ) -print "Number of nodes connected to more than 6 tetrahedra:", len(ids) +print("Number of nodes connected to more than 6 tetrahedra:", len(ids)) diff --git a/doc/salome/examples/grouping_elements_ex01.py b/doc/salome/examples/grouping_elements_ex01.py index 0bb1b9a2f..bb97b024a 100644 --- a/doc/salome/examples/grouping_elements_ex01.py +++ b/doc/salome/examples/grouping_elements_ex01.py @@ -28,37 +28,37 @@ aGroup = mesh.CreateEmptyGroup(SMESH.NODE, "aGroup") # set/get group name aGroup.SetName( "new name" ) -print "name", aGroup.GetName() +print("name", aGroup.GetName()) # get group type (type of entities in the group, SMESH.NODE in our case) -print "type", aGroup.GetType() +print("type", aGroup.GetType()) # get number of entities (nodes in our case) in the group -print "size", aGroup.Size() +print("size", aGroup.Size()) # check of emptiness -print "is empty", aGroup.IsEmpty() +print("is empty", aGroup.IsEmpty()) # check of presence of an entity in the group aGroup.Add([1,2]) # Add() method is specific to the standalone group -print "contains node 2", aGroup.Contains(2) +print("contains node 2", aGroup.Contains(2)) # get an entity by index -print "1st node", aGroup.GetID(1) +print("1st node", aGroup.GetID(1)) # get all entities -print "all", aGroup.GetIDs() +print("all", aGroup.GetIDs()) # get number of nodes (actual for groups of elements) -print "nb nodes", aGroup.GetNumberOfNodes() +print("nb nodes", aGroup.GetNumberOfNodes()) # get underlying nodes (actual for groups of elements) -print "nodes", aGroup.GetNodeIDs() +print("nodes", aGroup.GetNodeIDs()) # set/get color import SALOMEDS aGroup.SetColor( SALOMEDS.Color(1.,1.,0.)); -print "color", aGroup.GetColor() +print("color", aGroup.GetColor()) # ---------------------------------------------------------------------------- # methods specific to the standalone group and not present in GroupOnGeometry diff --git a/doc/salome/examples/grouping_elements_ex03.py b/doc/salome/examples/grouping_elements_ex03.py index bd85e09e0..928b49563 100644 --- a/doc/salome/examples/grouping_elements_ex03.py +++ b/doc/salome/examples/grouping_elements_ex03.py @@ -28,22 +28,22 @@ critaria = [ \ ] filt = smesh.GetFilterFromCriteria( critaria ) filtGroup = mesh.GroupOnFilter( SMESH.FACE, "group on filter", filt ) -print "Group on filter contains %s elemens" % filtGroup.Size() +print("Group on filter contains %s elemens" % filtGroup.Size()) # group on filter is updated if the mesh is modified hyp1D.SetStartLength( 2.5 ) hyp1D.SetEndLength( 2.5 ) mesh.Compute() -print "After mesh change, group on filter contains %s elemens" % filtGroup.Size() +print("After mesh change, group on filter contains %s elemens" % filtGroup.Size()) # set a new filter defining the group filt2 = smesh.GetFilter( SMESH.FACE, SMESH.FT_RangeOfIds, "1-50" ) filtGroup.SetFilter( filt2 ) -print "With a new filter, group on filter contains %s elemens" % filtGroup.Size() +print("With a new filter, group on filter contains %s elemens" % filtGroup.Size()) # group is updated at modification of the filter filt2.SetCriteria( [ smesh.GetCriterion( SMESH.FACE, SMESH.FT_RangeOfIds, "1-70" )]) filtIDs3 = filtGroup.GetIDs() -print "After filter modification, group on filter contains %s elemens" % filtGroup.Size() +print("After filter modification, group on filter contains %s elemens" % filtGroup.Size()) salome.sg.updateObjBrowser(True) diff --git a/doc/salome/examples/grouping_elements_ex04.py b/doc/salome/examples/grouping_elements_ex04.py index 9beb77e36..a7b26c4e5 100644 --- a/doc/salome/examples/grouping_elements_ex04.py +++ b/doc/salome/examples/grouping_elements_ex04.py @@ -12,7 +12,7 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 35.) anIds = mesh.GetIdsFromFilter(aFilter) -print "Criterion: Area > 35, Nb = ", len(anIds) +print("Criterion: Area > 35, Nb = ", len(anIds)) # create a group by adding elements with area > 35 aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Area > 35") @@ -23,7 +23,7 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 40.) anIds = mesh.GetIdsFromFilter(aFilter) -print "Criterion: Area > 40, Nb = ", len(anIds) +print("Criterion: Area > 40, Nb = ", len(anIds)) # create a group of elements with area [35; 40] by removing elements with area > 40 from group aGroup aGroup.Remove(anIds) @@ -32,14 +32,14 @@ aGroup.SetName("35 < Area < 40") # print the result aGroupElemIDs = aGroup.GetListOfID() -print "Criterion: 35 < Area < 40, Nb = ", len(aGroupElemIDs) +print("Criterion: 35 < Area < 40, Nb = ", len(aGroupElemIDs)) j = 1 for i in range(len(aGroupElemIDs)): - if j > 20: j = 1; print "" - print aGroupElemIDs[i], + if j > 20: j = 1; print("") + print(aGroupElemIDs[i], end=' ') j = j + 1 pass -print "" +print("") salome.sg.updateObjBrowser(True) diff --git a/doc/salome/examples/grouping_elements_ex05.py b/doc/salome/examples/grouping_elements_ex05.py index 047691b86..23e1abf87 100644 --- a/doc/salome/examples/grouping_elements_ex05.py +++ b/doc/salome/examples/grouping_elements_ex05.py @@ -12,7 +12,7 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 20.) anIds = mesh.GetIdsFromFilter(aFilter) -print "Criterion: Area > 20, Nb = ", len( anIds ) +print("Criterion: Area > 20, Nb = ", len( anIds )) # create a group by adding elements with area > 20 aGroup1 = mesh.CreateEmptyGroup(SMESH.FACE, "Area > 20") @@ -23,7 +23,7 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_EqualTo, 20.) anIds = mesh.GetIdsFromFilter(aFilter) -print "Criterion: Area = 20, Nb = ", len( anIds ) +print("Criterion: Area = 20, Nb = ", len( anIds )) # create a group by adding elements with area = 20 aGroup2 = mesh.CreateEmptyGroup( SMESH.FACE, "Area = 20" ) @@ -33,7 +33,7 @@ aGroup2.Add(anIds) # create union group : area >= 20 aGroup3 = mesh.UnionListOfGroups([aGroup1, aGroup2], "Area >= 20") aGroup3.SetColor( SALOMEDS.Color(1.,1.,0.)); -print "Criterion: Area >= 20, Nb = ", len(aGroup3.GetListOfID()) +print("Criterion: Area >= 20, Nb = ", len(aGroup3.GetListOfID())) # Please note that also there is UnionGroups() method which works with two groups only # Criterion : AREA < 20 @@ -41,7 +41,7 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 20.) anIds = mesh.GetIdsFromFilter(aFilter) -print "Criterion: Area < 20, Nb = ", len(anIds) +print("Criterion: Area < 20, Nb = ", len(anIds)) # create a group by adding elements with area < 20 aGroup4 = mesh.CreateEmptyGroup(SMESH.FACE, "Area < 20") @@ -50,6 +50,6 @@ aGroup4.SetColor( SALOMEDS.Color(1.,0.,0.)); # create union group : area >= 20 and area < 20 aGroup5 = mesh.UnionListOfGroups([aGroup3, aGroup4], "Any Area") -print "Criterion: Any Area, Nb = ", len(aGroup5.GetListOfID()) +print("Criterion: Any Area, Nb = ", len(aGroup5.GetListOfID())) salome.sg.updateObjBrowser(True) diff --git a/doc/salome/examples/grouping_elements_ex06.py b/doc/salome/examples/grouping_elements_ex06.py index bf9e3708b..a5b2c3ffb 100644 --- a/doc/salome/examples/grouping_elements_ex06.py +++ b/doc/salome/examples/grouping_elements_ex06.py @@ -12,7 +12,7 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 20.) anIds = mesh.GetIdsFromFilter(aFilter) -print "Criterion: Area > 20, Nb = ", len(anIds) +print("Criterion: Area > 20, Nb = ", len(anIds)) # create a group by adding elements with area > 20 aGroup1 = mesh.CreateEmptyGroup(SMESH.FACE, "Area > 20") @@ -23,7 +23,7 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 60.) anIds = mesh.GetIdsFromFilter(aFilter) -print "Criterion: Area < 60, Nb = ", len(anIds) +print("Criterion: Area < 60, Nb = ", len(anIds)) # create a group by adding elements with area < 60 aGroup2 = mesh.CreateEmptyGroup(SMESH.FACE, "Area < 60") @@ -31,7 +31,7 @@ aGroup2.Add(anIds) # create an intersection of groups : 20 < area < 60 aGroup3 = mesh.IntersectListOfGroups([aGroup1, aGroup2], "20 < Area < 60") -print "Criterion: 20 < Area < 60, Nb = ", len(aGroup3.GetListOfID()) +print("Criterion: 20 < Area < 60, Nb = ", len(aGroup3.GetListOfID())) # Please note that also there is IntersectGroups() method which works with two groups only salome.sg.updateObjBrowser(True) diff --git a/doc/salome/examples/grouping_elements_ex07.py b/doc/salome/examples/grouping_elements_ex07.py index 1a79c5fe2..eb288de24 100644 --- a/doc/salome/examples/grouping_elements_ex07.py +++ b/doc/salome/examples/grouping_elements_ex07.py @@ -12,7 +12,7 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 20.) anIds = mesh.GetIdsFromFilter(aFilter) -print "Criterion: Area > 20, Nb = ", len(anIds) +print("Criterion: Area > 20, Nb = ", len(anIds)) # create a group by adding elements with area > 20 aGroupMain = mesh.MakeGroupByIds("Area > 20", SMESH.FACE, anIds) @@ -22,14 +22,14 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 60.) anIds = mesh.GetIdsFromFilter(aFilter) -print "Criterion: Area < 60, Nb = ", len(anIds) +print("Criterion: Area < 60, Nb = ", len(anIds)) # create a group by adding elements with area < 60 aGroupTool = mesh.MakeGroupByIds("Area < 60", SMESH.FACE, anIds) # create a cut of groups : area >= 60 aGroupRes = mesh.CutGroups(aGroupMain, aGroupTool, "Area >= 60") -print "Criterion: Area >= 60, Nb = ", len(aGroupRes.GetListOfID()) +print("Criterion: Area >= 60, Nb = ", len(aGroupRes.GetListOfID())) # Please note that also there is CutListOfGroups() method which works with lists of groups of any lengths salome.sg.updateObjBrowser(True) diff --git a/doc/salome/examples/grouping_elements_ex08.py b/doc/salome/examples/grouping_elements_ex08.py index 459a50dc2..9447f98ec 100644 --- a/doc/salome/examples/grouping_elements_ex08.py +++ b/doc/salome/examples/grouping_elements_ex08.py @@ -13,7 +13,7 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, 100.) # create a group by adding elements with area > 100 aSrcGroup1 = mesh.GroupOnFilter(SMESH.FACE, "Area > 100", aFilter) aSrcGroup1.SetColor( SALOMEDS.Color(1.,1.,0.)) -print "Criterion: Area > 100, Nb = ", aSrcGroup1.Size() +print("Criterion: Area > 100, Nb = ", aSrcGroup1.Size()) # Criterion : AREA < 30 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 30.) @@ -21,7 +21,7 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_LessThan, 30.) # create a group by adding elements with area < 30 aSrcGroup2 = mesh.GroupOnFilter(SMESH.FACE, "Area < 30", aFilter) aSrcGroup2.SetColor( SALOMEDS.Color(1.,0.,0.)) -print "Criterion: Area < 30, Nb = ", aSrcGroup2.Size() +print("Criterion: Area < 30, Nb = ", aSrcGroup2.Size()) # Create group of edges using source groups of faces diff --git a/doc/salome/examples/measurements_ex03.py b/doc/salome/examples/measurements_ex03.py index 5a44cdaca..f788c56db 100644 --- a/doc/salome/examples/measurements_ex03.py +++ b/doc/salome/examples/measurements_ex03.py @@ -29,51 +29,51 @@ group_2d = mesh.Group(face) # compute basic properties -print "Get basic properties: approach 1 (via measurements tool) ----" +print("Get basic properties: approach 1 (via measurements tool) ----") measure = smesh.CreateMeasurements() -print "* for mesh:" -print " length:", measure.Length(mesh.mesh) -print " area:", measure.Area(mesh.mesh) -print " volume:", measure.Volume(mesh.mesh) +print("* for mesh:") +print(" length:", measure.Length(mesh.mesh)) +print(" area:", measure.Area(mesh.mesh)) +print(" volume:", measure.Volume(mesh.mesh)) -print "* for group (2d):" -print " length:", measure.Length(group_2d) -print " area:", measure.Area(group_2d) -print " volume:", measure.Volume(group_2d) +print("* for group (2d):") +print(" length:", measure.Length(group_2d)) +print(" area:", measure.Area(group_2d)) +print(" volume:", measure.Volume(group_2d)) -print "* for submesh (2d):" -print " length:", measure.Length(submesh_2d_face.GetSubMesh()) -print " area:", measure.Area(submesh_2d_face.GetSubMesh()) -print " volume:", measure.Volume(submesh_2d_face.GetSubMesh()) +print("* for submesh (2d):") +print(" length:", measure.Length(submesh_2d_face.GetSubMesh())) +print(" area:", measure.Area(submesh_2d_face.GetSubMesh())) +print(" volume:", measure.Volume(submesh_2d_face.GetSubMesh())) measure.UnRegister() -print "Get basic properties: approach 2 (via smeshBuilder) ----" +print("Get basic properties: approach 2 (via smeshBuilder) ----") -print "* for mesh:" -print " length:", smesh.GetLength(mesh) -print " area:", smesh.GetArea(mesh) -print " volume:", smesh.GetVolume(mesh) +print("* for mesh:") +print(" length:", smesh.GetLength(mesh)) +print(" area:", smesh.GetArea(mesh)) +print(" volume:", smesh.GetVolume(mesh)) -print "* for group (2d):" -print " length:", smesh.GetLength(group_2d) -print " area:", smesh.GetArea(group_2d) -print " volume:", smesh.GetVolume(group_2d) +print("* for group (2d):") +print(" length:", smesh.GetLength(group_2d)) +print(" area:", smesh.GetArea(group_2d)) +print(" volume:", smesh.GetVolume(group_2d)) -print "* for submesh (2d):" -print " length:", smesh.GetLength(submesh_2d_face) -print " area:", smesh.GetArea(submesh_2d_face) -print " volume:", smesh.GetVolume(submesh_2d_face) +print("* for submesh (2d):") +print(" length:", smesh.GetLength(submesh_2d_face)) +print(" area:", smesh.GetArea(submesh_2d_face)) +print(" volume:", smesh.GetVolume(submesh_2d_face)) -print "Get basic properties: approach 3 (via smeshBuilder.Mesh) ----" +print("Get basic properties: approach 3 (via smeshBuilder.Mesh) ----") -print "* for mesh:" -print " length:", mesh.GetLength() -print " area:", mesh.GetArea() -print " volume:", mesh.GetVolume() +print("* for mesh:") +print(" length:", mesh.GetLength()) +print(" area:", mesh.GetArea()) +print(" volume:", mesh.GetVolume()) -print "* for group (2d): unsupported" +print("* for group (2d): unsupported") -print "* for submesh (2d): unsupported" +print("* for submesh (2d): unsupported") diff --git a/doc/salome/examples/modifying_meshes_ex01.py b/doc/salome/examples/modifying_meshes_ex01.py index 0ef07aa7a..e58950bb3 100644 --- a/doc/salome/examples/modifying_meshes_ex01.py +++ b/doc/salome/examples/modifying_meshes_ex01.py @@ -11,6 +11,6 @@ mesh = smesh.Mesh() # add node new_id = mesh.AddNode(50, 10, 0) -print "" -if new_id == 0: print "KO node addition." -else: print "New Node has been added with ID ", new_id +print("") +if new_id == 0: print("KO node addition.") +else: print("New Node has been added with ID ", new_id) diff --git a/doc/salome/examples/modifying_meshes_ex02.py b/doc/salome/examples/modifying_meshes_ex02.py index 7948ed3dc..b54a90988 100644 --- a/doc/salome/examples/modifying_meshes_ex02.py +++ b/doc/salome/examples/modifying_meshes_ex02.py @@ -15,6 +15,6 @@ node_id = mesh.AddNode(50, 10, 0) # add 0D Element new_id = mesh.Add0DElement(node_id) -print "" -if new_id == 0: print "KO node addition." -else: print "New 0D Element has been added with ID ", new_id +print("") +if new_id == 0: print("KO node addition.") +else: print("New 0D Element has been added with ID ", new_id) diff --git a/doc/salome/examples/modifying_meshes_ex03.py b/doc/salome/examples/modifying_meshes_ex03.py index 0c6bc61dd..2416baf4d 100644 --- a/doc/salome/examples/modifying_meshes_ex03.py +++ b/doc/salome/examples/modifying_meshes_ex03.py @@ -48,5 +48,5 @@ res = mesh.Add0DElementsToAllNodes( mesh.GetElementsId() ) mesh.RemoveElements( mesh.GetElementsByType( SMESH.ELEM0D )) # create 0D elements on some nodes -nodes = range(1,10) +nodes = list(range(1,10)) res = mesh.Add0DElementsToAllNodes( mesh.GetIDSource( nodes, SMESH.NODE )) diff --git a/doc/salome/examples/modifying_meshes_ex04.py b/doc/salome/examples/modifying_meshes_ex04.py index 5aad0f551..ad8d151b0 100644 --- a/doc/salome/examples/modifying_meshes_ex04.py +++ b/doc/salome/examples/modifying_meshes_ex04.py @@ -3,13 +3,13 @@ import SMESH_mechanic mesh = SMESH_mechanic.mesh -print "" +print("") # add node n1 = mesh.AddNode(50, 10, 0) -if n1 == 0: print "KO node addition." +if n1 == 0: print("KO node addition.") # add edge e1 = mesh.AddEdge([n1, 38]) -if e1 == 0: print "KO edge addition." -else: print "New Edge has been added with ID ", e1 +if e1 == 0: print("KO edge addition.") +else: print("New Edge has been added with ID ", e1) diff --git a/doc/salome/examples/modifying_meshes_ex05.py b/doc/salome/examples/modifying_meshes_ex05.py index bd1e1438b..c48042a6f 100644 --- a/doc/salome/examples/modifying_meshes_ex05.py +++ b/doc/salome/examples/modifying_meshes_ex05.py @@ -3,13 +3,13 @@ import SMESH_mechanic mesh = SMESH_mechanic.mesh -print "" +print("") # add node n1 = mesh.AddNode(50, 10, 0) -if n1 == 0: print "KO node addition." +if n1 == 0: print("KO node addition.") # add triangle t1 = mesh.AddFace([n1, 38, 39]) -if t1 == 0: print "KO triangle addition." -else: print "New Triangle has been added with ID ", t1 +if t1 == 0: print("KO triangle addition.") +else: print("New Triangle has been added with ID ", t1) diff --git a/doc/salome/examples/modifying_meshes_ex06.py b/doc/salome/examples/modifying_meshes_ex06.py index b05c88089..ff568e0f1 100644 --- a/doc/salome/examples/modifying_meshes_ex06.py +++ b/doc/salome/examples/modifying_meshes_ex06.py @@ -3,16 +3,16 @@ import SMESH_mechanic mesh = SMESH_mechanic.mesh -print "" +print("") # add node n1 = mesh.AddNode(50, 10, 0) -if n1 == 0: print "KO node addition." +if n1 == 0: print("KO node addition.") n2 = mesh.AddNode(40, 20, 0) -if n2 == 0: print "KO node addition." +if n2 == 0: print("KO node addition.") # add quadrangle q1 = mesh.AddFace([n2, n1, 38, 39]) -if q1 == 0: print "KO quadrangle addition." -else: print "New Quadrangle has been added with ID ", q1 +if q1 == 0: print("KO quadrangle addition.") +else: print("New Quadrangle has been added with ID ", q1) diff --git a/doc/salome/examples/modifying_meshes_ex07.py b/doc/salome/examples/modifying_meshes_ex07.py index 5dfa8da03..93fa2d1cc 100644 --- a/doc/salome/examples/modifying_meshes_ex07.py +++ b/doc/salome/examples/modifying_meshes_ex07.py @@ -3,13 +3,13 @@ import SMESH_mechanic mesh = SMESH_mechanic.mesh -print "" +print("") # add node n1 = mesh.AddNode(50, 10, 0) -if n1 == 0: print "KO node addition." +if n1 == 0: print("KO node addition.") # add tetrahedron t1 = mesh.AddVolume([n1, 38, 39, 246]) -if t1 == 0: print "KO tetrahedron addition." -else: print "New Tetrahedron has been added with ID ", t1 +if t1 == 0: print("KO tetrahedron addition.") +else: print("New Tetrahedron has been added with ID ", t1) diff --git a/doc/salome/examples/modifying_meshes_ex08.py b/doc/salome/examples/modifying_meshes_ex08.py index 4cfa89ee4..1cf27c5df 100644 --- a/doc/salome/examples/modifying_meshes_ex08.py +++ b/doc/salome/examples/modifying_meshes_ex08.py @@ -3,7 +3,7 @@ import SMESH_mechanic mesh = SMESH_mechanic.mesh -print "" +print("") # add nodes nId1 = mesh.AddNode(50, 10, 0) @@ -11,9 +11,9 @@ nId2 = mesh.AddNode(47, 12, 0) nId3 = mesh.AddNode(50, 10, 10) nId4 = mesh.AddNode(47, 12, 10) -if nId1 == 0 or nId2 == 0 or nId3 == 0 or nId4 == 0: print "KO node addition." +if nId1 == 0 or nId2 == 0 or nId3 == 0 or nId4 == 0: print("KO node addition.") # add hexahedron vId = mesh.AddVolume([nId2, nId1, 38, 39, nId4, nId3, 245, 246]) -if vId == 0: print "KO Hexahedron addition." -else: print "New Hexahedron has been added with ID ", vId +if vId == 0: print("KO Hexahedron addition.") +else: print("New Hexahedron has been added with ID ", vId) diff --git a/doc/salome/examples/modifying_meshes_ex11.py b/doc/salome/examples/modifying_meshes_ex11.py index 6ba78c331..28b544bc0 100644 --- a/doc/salome/examples/modifying_meshes_ex11.py +++ b/doc/salome/examples/modifying_meshes_ex11.py @@ -6,5 +6,5 @@ mesh = SMESH_mechanic.mesh # remove nodes #246 and #255 res = mesh.RemoveNodes([246, 255]) -if res == 1: print "Nodes removing is OK!" -else: print "KO nodes removing." +if res == 1: print("Nodes removing is OK!") +else: print("KO nodes removing.") diff --git a/doc/salome/examples/modifying_meshes_ex12.py b/doc/salome/examples/modifying_meshes_ex12.py index 5437b3815..8ef8356f0 100644 --- a/doc/salome/examples/modifying_meshes_ex12.py +++ b/doc/salome/examples/modifying_meshes_ex12.py @@ -6,5 +6,5 @@ mesh = SMESH_mechanic.mesh # remove three elements: #850, #859 and #814 res = mesh.RemoveElements([850, 859, 814]) -if res == 1: print "Elements removing is OK!" -else: print "KO Elements removing." +if res == 1: print("Elements removing is OK!") +else: print("KO Elements removing.") diff --git a/doc/salome/examples/modifying_meshes_ex13.py b/doc/salome/examples/modifying_meshes_ex13.py index 4189b852b..3c2e4e0bf 100644 --- a/doc/salome/examples/modifying_meshes_ex13.py +++ b/doc/salome/examples/modifying_meshes_ex13.py @@ -9,5 +9,5 @@ mesh.AddNode(0,0,0) mesh.AddNode(1,1,1) # remove just created orphan nodes res = mesh.RemoveOrphanNodes() -if res == 1: print "Removed %d nodes!" % res -else: print "KO nodes removing." +if res == 1: print("Removed %d nodes!" % res) +else: print("KO nodes removing.") diff --git a/doc/salome/examples/modifying_meshes_ex15.py b/doc/salome/examples/modifying_meshes_ex15.py index 5985c0844..efd5cfbf9 100644 --- a/doc/salome/examples/modifying_meshes_ex15.py +++ b/doc/salome/examples/modifying_meshes_ex15.py @@ -38,15 +38,15 @@ if not node000: # find node000 using a dedicated function n = mesh.FindNodeClosestTo( -1,-1,-1 ) if not n == node000: - raise "FindNodeClosestTo() returns " + str( n ) + " != " + str( node000 ) + raise Exception("FindNodeClosestTo() returns " + str( n ) + " != " + str( node000 )) # move node000 to a new location x,y,z = -10, -10, -10 n = mesh.MoveNode( n,x,y,z ) if not n: - raise "MoveNode() returns " + n + raise Exception("MoveNode() returns " + n) # check the coordinates of the node000 xyz = mesh.GetNodeXYZ( node000 ) if not ( xyz[0] == x and xyz[1] == y and xyz[2] == z) : - raise "Wrong coordinates: " + str( xyz ) + " != " + str( [x,y,z] ) + raise Exception("Wrong coordinates: " + str( xyz ) + " != " + str( [x,y,z] )) diff --git a/doc/salome/examples/modifying_meshes_ex16.py b/doc/salome/examples/modifying_meshes_ex16.py index 0786445eb..8b958f95b 100644 --- a/doc/salome/examples/modifying_meshes_ex16.py +++ b/doc/salome/examples/modifying_meshes_ex16.py @@ -46,9 +46,9 @@ ff[4] = mesh.AddFace([bb[2], bb[3], tt[3]]) ff[5] = mesh.AddFace([bb[2], tt[3], tt[2]]) # inverse the diagonal bb[1] - tt[2] -print "\nDiagonal inversion ... ", +print("\nDiagonal inversion ... ", end=' ') res = mesh.InverseDiag(bb[1], tt[2]) -if not res: print "failed!" -else: print "done." +if not res: print("failed!") +else: print("done.") salome.sg.updateObjBrowser(True) diff --git a/doc/salome/examples/modifying_meshes_ex17.py b/doc/salome/examples/modifying_meshes_ex17.py index ebeb247a8..7cd708158 100644 --- a/doc/salome/examples/modifying_meshes_ex17.py +++ b/doc/salome/examples/modifying_meshes_ex17.py @@ -46,9 +46,9 @@ ff[4] = mesh.AddFace([bb[2], bb[3], tt[3]]) ff[5] = mesh.AddFace([bb[2], tt[3], tt[2]]) # delete the diagonal bb[1] - tt[2] -print "\nUnite two triangles ... ", +print("\nUnite two triangles ... ", end=' ') res = mesh.DeleteDiag(bb[1], tt[2]) -if not res: print "failed!" -else: print "done." +if not res: print("failed!") +else: print("done.") salome.sg.updateObjBrowser(True) diff --git a/doc/salome/examples/modifying_meshes_ex18.py b/doc/salome/examples/modifying_meshes_ex18.py index 458b0fe25..b44dde891 100644 --- a/doc/salome/examples/modifying_meshes_ex18.py +++ b/doc/salome/examples/modifying_meshes_ex18.py @@ -46,9 +46,9 @@ ff[4] = mesh.AddFace([bb[2], bb[3], tt[3]]) ff[5] = mesh.AddFace([bb[2], tt[3], tt[2]]) # unite a set of triangles -print "\nUnite a set of triangles ... ", +print("\nUnite a set of triangles ... ", end=' ') res = mesh.TriToQuad([ff[2], ff[3], ff[4], ff[5]], SMESH.FT_MinimumAngle, 60.) -if not res: print "failed!" -else: print "done." +if not res: print("failed!") +else: print("done.") salome.sg.updateObjBrowser(True) diff --git a/doc/salome/examples/modifying_meshes_ex21.py b/doc/salome/examples/modifying_meshes_ex21.py index 650d998e5..e9afc8e48 100644 --- a/doc/salome/examples/modifying_meshes_ex21.py +++ b/doc/salome/examples/modifying_meshes_ex21.py @@ -28,8 +28,8 @@ GroupSmooth = mesh.GroupOnGeom(face, "Group of faces (smooth)", SMESH.FACE) # boolean SmoothObject(Object, IDsOfFixedNodes, MaxNbOfIterations, MaxAspectRatio, Method) res = mesh.SmoothObject(GroupSmooth, [], 20, 2., smesh.CENTROIDAL_SMOOTH) -print "\nSmoothing ... ", -if not res: print "failed!" -else: print "done." +print("\nSmoothing ... ", end=' ') +if not res: print("failed!") +else: print("done.") salome.sg.updateObjBrowser(True) diff --git a/doc/salome/examples/modifying_meshes_ex23.py b/doc/salome/examples/modifying_meshes_ex23.py index 3db2c3e12..350cc3482 100644 --- a/doc/salome/examples/modifying_meshes_ex23.py +++ b/doc/salome/examples/modifying_meshes_ex23.py @@ -19,7 +19,7 @@ iv = 1 vertices = [] for point in points: vert = geompy.MakeVertex(point[0], point[1], 0) - geompy.addToStudy(vert, "Vertex_" + `iv`) + geompy.addToStudy(vert, "Vertex_" + repr(iv)) vertices.append(vert) iv += 1 pass @@ -38,7 +38,7 @@ geompy.addToStudy(Edge_Circle , "Edge_Circle") # 3. Explode wire on edges, as they will be used for mesh extrusion Wire_polyline_edges = geompy.SubShapeAll(Wire_polyline, geompy.ShapeType["EDGE"]) for ii in range(len(Wire_polyline_edges)): - geompy.addToStudyInFather(Wire_polyline, Wire_polyline_edges[ii], "Edge_" + `ii + 1`) + geompy.addToStudyInFather(Wire_polyline, Wire_polyline_edges[ii], "Edge_" + repr(ii + 1)) pass # Mesh @@ -49,7 +49,7 @@ def Mesh1D(shape1d, nbSeg, name): algo = mesh1d_tool.Segment() hyp = algo.NumberOfSegments(nbSeg) isDone = mesh1d_tool.Compute() - if not isDone: print 'Mesh ', name, ': computation failed' + if not isDone: print('Mesh ', name, ': computation failed') return mesh1d_tool # Create a mesh with six nodes, seven edges and two quadrangle faces diff --git a/doc/salome/examples/modifying_meshes_ex25.py b/doc/salome/examples/modifying_meshes_ex25.py index 4072560c4..8f0b06796 100644 --- a/doc/salome/examples/modifying_meshes_ex25.py +++ b/doc/salome/examples/modifying_meshes_ex25.py @@ -29,7 +29,7 @@ algo1D.NumberOfSegments(3) Mesh_1.Quadrangle() isDone = Mesh_1.Compute() -if not isDone: print 'Mesh Mesh_1 : computation failed' +if not isDone: print('Mesh Mesh_1 : computation failed') # build a triangle mesh on Face_2 Mesh_2 = smesh.Mesh(Face_2) @@ -40,20 +40,20 @@ algo2D = Mesh_2.Triangle() algo2D.MaxElementArea(240) isDone = Mesh_2.Compute() -if not isDone: print 'Mesh Mesh_2 : computation failed' +if not isDone: print('Mesh Mesh_2 : computation failed') # create a 2d pattern pattern = smesh.GetPattern() isDone = pattern.LoadFromFace(Mesh_2.GetMesh(), Face_2, 0) -if (isDone != 1): print 'LoadFromFace :', pattern.GetErrorCode() +if (isDone != 1): print('LoadFromFace :', pattern.GetErrorCode()) # apply the pattern to a face of the first mesh facesToSplit = Mesh_1.GetElementsByType(SMESH.FACE) -print "Splitting %d rectangular face(s) to %d triangles..."%(len(facesToSplit), 2*len(facesToSplit)) +print("Splitting %d rectangular face(s) to %d triangles..."%(len(facesToSplit), 2*len(facesToSplit))) pattern.ApplyToMeshFaces(Mesh_1.GetMesh(), facesToSplit, 0, 0) isDone = pattern.MakeMesh(Mesh_1.GetMesh(), 0, 0) -if (isDone != 1): print 'MakeMesh :', pattern.GetErrorCode() +if (isDone != 1): print('MakeMesh :', pattern.GetErrorCode()) # create quadrangle mesh Mesh_3 = smesh.Mesh(Box_1) @@ -61,7 +61,7 @@ Mesh_3.Segment().NumberOfSegments(1) Mesh_3.Quadrangle() Mesh_3.Hexahedron() isDone = Mesh_3.Compute() -if not isDone: print 'Mesh Mesh_3 : computation failed' +if not isDone: print('Mesh Mesh_3 : computation failed') # create a 3d pattern (hexahedrons) pattern_hexa = smesh.GetPattern() @@ -93,10 +93,10 @@ pattern_hexa.LoadFromFile(smp_hexa) # apply the pattern to a mesh volsToSplit = Mesh_3.GetElementsByType(SMESH.VOLUME) -print "Splitting %d hexa volume(s) to %d hexas..."%(len(volsToSplit), 4*len(volsToSplit)) +print("Splitting %d hexa volume(s) to %d hexas..."%(len(volsToSplit), 4*len(volsToSplit))) pattern_hexa.ApplyToHexahedrons(Mesh_3.GetMesh(), volsToSplit,0,3) isDone = pattern_hexa.MakeMesh(Mesh_3.GetMesh(), True, True) -if (isDone != 1): print 'MakeMesh :', pattern_hexa.GetErrorCode() +if (isDone != 1): print('MakeMesh :', pattern_hexa.GetErrorCode()) # create one more quadrangle mesh Mesh_4 = smesh.Mesh(Box_1) @@ -104,7 +104,7 @@ Mesh_4.Segment().NumberOfSegments(1) Mesh_4.Quadrangle() Mesh_4.Hexahedron() isDone = Mesh_4.Compute() -if not isDone: print 'Mesh Mesh_4 : computation failed' +if not isDone: print('Mesh Mesh_4 : computation failed') # create another 3d pattern (pyramids) pattern_pyra = smesh.GetPattern() @@ -132,7 +132,7 @@ pattern_pyra.LoadFromFile(smp_pyra) # apply the pattern to a face mesh volsToSplit = Mesh_4.GetElementsByType(SMESH.VOLUME) -print "Splitting %d hexa volume(s) to %d hexas..."%(len(volsToSplit), 6*len(volsToSplit)) +print("Splitting %d hexa volume(s) to %d hexas..."%(len(volsToSplit), 6*len(volsToSplit))) pattern_pyra.ApplyToHexahedrons(Mesh_4.GetMesh(), volsToSplit,1,0) isDone = pattern_pyra.MakeMesh(Mesh_4.GetMesh(), True, True) -if (isDone != 1): print 'MakeMesh :', pattern_pyra.GetErrorCode() +if (isDone != 1): print('MakeMesh :', pattern_pyra.GetErrorCode()) diff --git a/doc/salome/examples/quality_controls_ex01.py b/doc/salome/examples/quality_controls_ex01.py index 6990aa66b..a64a1f073 100644 --- a/doc/salome/examples/quality_controls_ex01.py +++ b/doc/salome/examples/quality_controls_ex01.py @@ -31,14 +31,14 @@ aFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_FreeBorders) anIds = mesh.GetIdsFromFilter(aFilter) # print the result -print "Criterion: Free borders Nb = ", len(anIds) +print("Criterion: Free borders Nb = ", len(anIds)) j = 1 for i in range(len(anIds)): - if j > 20: j = 1; print "" - print anIds[i], + if j > 20: j = 1; print("") + print(anIds[i], end=' ') j = j + 1 pass -print "" +print("") # create a group aGroup = mesh.GetMesh().CreateGroup(SMESH.EDGE, "Free borders") diff --git a/doc/salome/examples/quality_controls_ex02.py b/doc/salome/examples/quality_controls_ex02.py index c2fc56f86..8b6be1c73 100644 --- a/doc/salome/examples/quality_controls_ex02.py +++ b/doc/salome/examples/quality_controls_ex02.py @@ -33,14 +33,14 @@ aFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_MultiConnection, SMESH.FT_EqualTo anIds = mesh.GetIdsFromFilter(aFilter) # print the result -print "Criterion: Borders at multi-connections Nb = ", len(anIds) +print("Criterion: Borders at multi-connections Nb = ", len(anIds)) j = 1 for i in range(len(anIds)): - if j > 20: j = 1; print "" - print anIds[i], + if j > 20: j = 1; print("") + print(anIds[i], end=' ') j = j + 1 pass -print "" +print("") # create a group aGroup = mesh.GetMesh().CreateGroup(SMESH.EDGE, "Borders at multi-connections") diff --git a/doc/salome/examples/quality_controls_ex03.py b/doc/salome/examples/quality_controls_ex03.py index 7c5a804f5..089341109 100644 --- a/doc/salome/examples/quality_controls_ex03.py +++ b/doc/salome/examples/quality_controls_ex03.py @@ -33,17 +33,17 @@ aFilter = smesh.GetFilter(SMESH.EDGE, SMESH.FT_Length, SMESH.FT_MoreThan, length anIds = mesh.GetIdsFromFilter(aFilter) # print the result -print "Criterion: Edges length > ", length_margin, " Nb = ", len(anIds) +print("Criterion: Edges length > ", length_margin, " Nb = ", len(anIds)) j = 1 for i in range(len(anIds)): - if j > 20: j = 1; print "" - print anIds[i], + if j > 20: j = 1; print("") + print(anIds[i], end=' ') j = j + 1 pass -print "" +print("") # create a group -aGroup = mesh.GetMesh().CreateGroup(SMESH.EDGE, "Edges with length > " + `length_margin`) +aGroup = mesh.GetMesh().CreateGroup(SMESH.EDGE, "Edges with length > " + repr(length_margin)) aGroup.Add(anIds) salome.sg.updateObjBrowser(True) diff --git a/doc/salome/examples/quality_controls_ex04.py b/doc/salome/examples/quality_controls_ex04.py index 373ddbe02..786f0d24f 100644 --- a/doc/salome/examples/quality_controls_ex04.py +++ b/doc/salome/examples/quality_controls_ex04.py @@ -27,12 +27,12 @@ aGroupF = mesh.CreateEmptyGroup(SMESH.FACE, "Faces with free edges") aGroupN = mesh.CreateEmptyGroup(SMESH.NODE, "Nodes on free edges") # fill groups with elements, corresponding to the criterion -print "" -print "Criterion: Free edges Nb = ", len(aBorders) +print("") +print("Criterion: Free edges Nb = ", len(aBorders)) for i in range(len(aBorders)): aBorder = aBorders[i] - print "Face # ", aBorder.myElemId, " : Edge between nodes (", - print aBorder.myPnt1, ", ", aBorder.myPnt2, ")" + print("Face # ", aBorder.myElemId, " : Edge between nodes (", end=' ') + print(aBorder.myPnt1, ", ", aBorder.myPnt2, ")") aGroupF.Add([aBorder.myElemId]) aGroupN.Add([aBorder.myPnt1, aBorder.myPnt2]) diff --git a/doc/salome/examples/quality_controls_ex05.py b/doc/salome/examples/quality_controls_ex05.py index cbd217839..7d60b91ac 100644 --- a/doc/salome/examples/quality_controls_ex05.py +++ b/doc/salome/examples/quality_controls_ex05.py @@ -42,13 +42,13 @@ aGroup = mesh.CreateEmptyGroup(SMESH.NODE, "Free_nodes") aGroup.Add(anNodeIds) # print the result -print "Criterion: Free nodes Nb = ", len(anNodeIds) +print("Criterion: Free nodes Nb = ", len(anNodeIds)) j = 1 for i in range(len(anNodeIds)): - if j > 20: j = 1; print "" - print anNodeIds[i], + if j > 20: j = 1; print("") + print(anNodeIds[i], end=' ') j = j + 1 pass -print "" +print("") salome.sg.updateObjBrowser(True) diff --git a/doc/salome/examples/quality_controls_ex06.py b/doc/salome/examples/quality_controls_ex06.py index 1bd007bf6..0de0911e1 100644 --- a/doc/salome/examples/quality_controls_ex06.py +++ b/doc/salome/examples/quality_controls_ex06.py @@ -54,14 +54,14 @@ aGroup = Mesh_1.CreateEmptyGroup(SMESH.FACE, "Free_faces") aGroup.Add(aFaceIds) # print the result -print "Criterion: Free faces Nb = ", len(aFaceIds) +print("Criterion: Free faces Nb = ", len(aFaceIds)) j = 1 for i in range(len(aFaceIds)): - if j > 20: j = 1; print "" - print aFaceIds[i], + if j > 20: j = 1; print("") + print(aFaceIds[i], end=' ') j = j + 1 pass -print "" +print("") #filter faces from plane 2 aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_BelongToPlane, Plane_2) diff --git a/doc/salome/examples/quality_controls_ex11.py b/doc/salome/examples/quality_controls_ex11.py index b0b5e3f24..d108ef6d2 100644 --- a/doc/salome/examples/quality_controls_ex11.py +++ b/doc/salome/examples/quality_controls_ex11.py @@ -34,17 +34,17 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Length2D, SMESH.FT_MoreThan, leng anIds = mesh.GetIdsFromFilter(aFilter) # print the result -print "Criterion: Edges length 2D > ", length_margin, " Nb = ", len(anIds) +print("Criterion: Edges length 2D > ", length_margin, " Nb = ", len(anIds)) j = 1 for i in range(len(anIds)): - if j > 20: j = 1; print "" - print anIds[i], + if j > 20: j = 1; print("") + print(anIds[i], end=' ') j = j + 1 pass -print "" +print("") # create a group -aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Faces with length 2D > " + `length_margin`) +aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Faces with length 2D > " + repr(length_margin)) aGroup.Add(anIds) salome.sg.updateObjBrowser(True) diff --git a/doc/salome/examples/quality_controls_ex12.py b/doc/salome/examples/quality_controls_ex12.py index ba6fb9d7d..8e81e5130 100644 --- a/doc/salome/examples/quality_controls_ex12.py +++ b/doc/salome/examples/quality_controls_ex12.py @@ -34,17 +34,17 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MultiConnection2D, SMESH.FT_Equal anIds = mesh.GetIdsFromFilter(aFilter) # print the result -print "Criterion: Borders at multi-connection 2D = ", nb_conn, " Nb = ", len(anIds) +print("Criterion: Borders at multi-connection 2D = ", nb_conn, " Nb = ", len(anIds)) j = 1 for i in range(len(anIds)): - if j > 20: j = 1; print "" - print anIds[i], + if j > 20: j = 1; print("") + print(anIds[i], end=' ') j = j + 1 pass -print "" +print("") # create a group -aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Borders at multi-connection 2D = " + `nb_conn`) +aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Borders at multi-connection 2D = " + repr(nb_conn)) aGroup.Add(anIds) salome.sg.updateObjBrowser(True) diff --git a/doc/salome/examples/quality_controls_ex13.py b/doc/salome/examples/quality_controls_ex13.py index 3b52dbc12..f623081e5 100644 --- a/doc/salome/examples/quality_controls_ex13.py +++ b/doc/salome/examples/quality_controls_ex13.py @@ -15,17 +15,17 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreThan, area_mar anIds = mesh.GetIdsFromFilter(aFilter) # print the result -print "Criterion: Area > ", area_margin, " Nb = ", len(anIds) +print("Criterion: Area > ", area_margin, " Nb = ", len(anIds)) j = 1 for i in range(len(anIds)): - if j > 20: j = 1; print "" - print anIds[i], + if j > 20: j = 1; print("") + print(anIds[i], end=' ') j = j + 1 pass -print "" +print("") # create a group -aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Area > " + `area_margin`) +aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Area > " + repr(area_margin)) aGroup.Add(anIds) salome.sg.updateObjBrowser(True) diff --git a/doc/salome/examples/quality_controls_ex14.py b/doc/salome/examples/quality_controls_ex14.py index b66d9413a..7ed0afcfe 100644 --- a/doc/salome/examples/quality_controls_ex14.py +++ b/doc/salome/examples/quality_controls_ex14.py @@ -15,17 +15,17 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Taper, SMESH.FT_MoreThan, taper_m anIds = mesh.GetIdsFromFilter(aFilter) # print the result -print "Criterion: Taper > ", taper_margin, " Nb = ", len(anIds) +print("Criterion: Taper > ", taper_margin, " Nb = ", len(anIds)) j = 1 for i in range(len(anIds)): - if j > 20: j = 1; print "" - print anIds[i], + if j > 20: j = 1; print("") + print(anIds[i], end=' ') j = j + 1 pass -print "" +print("") # create a group -aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Taper > " + `taper_margin`) +aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Taper > " + repr(taper_margin)) aGroup.Add(anIds) salome.sg.updateObjBrowser(True) diff --git a/doc/salome/examples/quality_controls_ex15.py b/doc/salome/examples/quality_controls_ex15.py index 0aeedbfa8..7c2029a1e 100644 --- a/doc/salome/examples/quality_controls_ex15.py +++ b/doc/salome/examples/quality_controls_ex15.py @@ -15,17 +15,17 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_AspectRatio, SMESH.FT_MoreThan, a anIds = mesh.GetIdsFromFilter(aFilter) # print the result -print "Criterion: Aspect Ratio > ", ar_margin, " Nb = ", len(anIds) +print("Criterion: Aspect Ratio > ", ar_margin, " Nb = ", len(anIds)) j = 1 for i in range(len(anIds)): - if j > 20: j = 1; print "" - print anIds[i], + if j > 20: j = 1; print("") + print(anIds[i], end=' ') j = j + 1 pass -print "" +print("") # create a group -aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Aspect Ratio > " + `ar_margin`) +aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Aspect Ratio > " + repr(ar_margin)) aGroup.Add(anIds) salome.sg.updateObjBrowser(True) diff --git a/doc/salome/examples/quality_controls_ex16.py b/doc/salome/examples/quality_controls_ex16.py index e80e91f48..e0e59b3cd 100644 --- a/doc/salome/examples/quality_controls_ex16.py +++ b/doc/salome/examples/quality_controls_ex16.py @@ -15,17 +15,17 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MinimumAngle, SMESH.FT_LessThan, anIds = mesh.GetIdsFromFilter(aFilter) # print the result -print "Criterion: Minimum Angle < ", min_angle, " Nb = ", len(anIds) +print("Criterion: Minimum Angle < ", min_angle, " Nb = ", len(anIds)) j = 1 for i in range(len(anIds)): - if j > 20: j = 1; print "" - print anIds[i], + if j > 20: j = 1; print("") + print(anIds[i], end=' ') j = j + 1 pass -print "" +print("") # create a group -aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Minimum Angle < " + `min_angle`) +aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Minimum Angle < " + repr(min_angle)) aGroup.Add(anIds) diff --git a/doc/salome/examples/quality_controls_ex17.py b/doc/salome/examples/quality_controls_ex17.py index 8f7f39c48..89c6bfb1e 100644 --- a/doc/salome/examples/quality_controls_ex17.py +++ b/doc/salome/examples/quality_controls_ex17.py @@ -15,17 +15,17 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Warping, SMESH.FT_MoreThan, wa_ma anIds = mesh.GetIdsFromFilter(aFilter) # print the result -print "Criterion: Warp > ", wa_margin, " Nb = ", len(anIds) +print("Criterion: Warp > ", wa_margin, " Nb = ", len(anIds)) j = 1 for i in range(len(anIds)): - if j > 20: j = 1; print "" - print anIds[i], + if j > 20: j = 1; print("") + print(anIds[i], end=' ') j = j + 1 pass -print "" +print("") # create a group -aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Warp > " + `wa_margin`) +aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Warp > " + repr(wa_margin)) aGroup.Add(anIds) diff --git a/doc/salome/examples/quality_controls_ex18.py b/doc/salome/examples/quality_controls_ex18.py index ad6dff185..514653527 100644 --- a/doc/salome/examples/quality_controls_ex18.py +++ b/doc/salome/examples/quality_controls_ex18.py @@ -15,17 +15,17 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Skew, SMESH.FT_MoreThan, skew_mar anIds = mesh.GetIdsFromFilter(aFilter) # print the result -print "Criterion: Skew > ", skew_margin, " Nb = ", len(anIds) +print("Criterion: Skew > ", skew_margin, " Nb = ", len(anIds)) j = 1 for i in range(len(anIds)): - if j > 20: j = 1; print "" - print anIds[i], + if j > 20: j = 1; print("") + print(anIds[i], end=' ') j = j + 1 pass -print "" +print("") # create a group -aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Skew > " + `skew_margin`) +aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Skew > " + repr(skew_margin)) aGroup.Add(anIds) salome.sg.updateObjBrowser(True) diff --git a/doc/salome/examples/quality_controls_ex19.py b/doc/salome/examples/quality_controls_ex19.py index 814cb5ba5..5713800c8 100644 --- a/doc/salome/examples/quality_controls_ex19.py +++ b/doc/salome/examples/quality_controls_ex19.py @@ -15,17 +15,17 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MaxElementLength2D, SMESH.FT_More anIds = mesh.GetIdsFromFilter(aFilter) # print the result -print "Criterion: Element Diameter 2D Ratio > ", mel_2d_margin, " Nb = ", len(anIds) +print("Criterion: Element Diameter 2D Ratio > ", mel_2d_margin, " Nb = ", len(anIds)) j = 1 for i in range(len(anIds)): - if j > 20: j = 1; print "" - print anIds[i], + if j > 20: j = 1; print("") + print(anIds[i], end=' ') j = j + 1 pass -print "" +print("") # create a group -aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Element Diameter 2D > " + `mel_2d_margin`) +aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Element Diameter 2D > " + repr(mel_2d_margin)) aGroup.Add(anIds) salome.sg.updateObjBrowser(True) diff --git a/doc/salome/examples/quality_controls_ex20.py b/doc/salome/examples/quality_controls_ex20.py index 3a7c44f94..e18332407 100644 --- a/doc/salome/examples/quality_controls_ex20.py +++ b/doc/salome/examples/quality_controls_ex20.py @@ -15,17 +15,17 @@ aFilter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_AspectRatio3D, SMESH.FT_MoreTha anIds = mesh.GetIdsFromFilter(aFilter) # print the result -print "Criterion: Aspect Ratio 3D > ", ar_margin, " Nb = ", len(anIds) +print("Criterion: Aspect Ratio 3D > ", ar_margin, " Nb = ", len(anIds)) j = 1 for i in range(len(anIds)): - if j > 20: j = 1; print "" - print anIds[i], + if j > 20: j = 1; print("") + print(anIds[i], end=' ') j = j + 1 pass -print "" +print("") # create a group -aGroup = mesh.CreateEmptyGroup(SMESH.VOLUME, "Aspect Ratio 3D > " + `ar_margin`) +aGroup = mesh.CreateEmptyGroup(SMESH.VOLUME, "Aspect Ratio 3D > " + repr(ar_margin)) aGroup.Add(anIds) diff --git a/doc/salome/examples/quality_controls_ex21.py b/doc/salome/examples/quality_controls_ex21.py index 1f27eef3a..0e80e5069 100644 --- a/doc/salome/examples/quality_controls_ex21.py +++ b/doc/salome/examples/quality_controls_ex21.py @@ -15,18 +15,18 @@ aFilter = smesh.GetFilter(SMESH.VOLUME, SMESH.FT_Volume3D, SMESH.FT_LessThan, vo anIds = mesh.GetIdsFromFilter(aFilter) # print the result -print "" -print "Criterion: Volume < ", volume_margin, " Nb = ", len(anIds) +print("") +print("Criterion: Volume < ", volume_margin, " Nb = ", len(anIds)) j = 1 for i in range(len(anIds)): - if j > 20: j = 1; print "" - print anIds[i], + if j > 20: j = 1; print("") + print(anIds[i], end=' ') j = j + 1 pass -print "" +print("") # create a group -aGroup = mesh.CreateEmptyGroup(SMESH.VOLUME, "Volume < " + `volume_margin`) +aGroup = mesh.CreateEmptyGroup(SMESH.VOLUME, "Volume < " + repr(volume_margin)) aGroup.Add(anIds) diff --git a/doc/salome/examples/quality_controls_ex22.py b/doc/salome/examples/quality_controls_ex22.py index e43e5c1b8..aff8d25d3 100644 --- a/doc/salome/examples/quality_controls_ex22.py +++ b/doc/salome/examples/quality_controls_ex22.py @@ -15,17 +15,17 @@ aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_MaxElementLength3D, SMESH.FT_More anIds = mesh.GetIdsFromFilter(aFilter) # print the result -print "Criterion: Element Diameter 3D Ratio > ", mel_3d_margin, " Nb = ", len(anIds) +print("Criterion: Element Diameter 3D Ratio > ", mel_3d_margin, " Nb = ", len(anIds)) j = 1 for i in range(len(anIds)): - if j > 20: j = 1; print "" - print anIds[i], + if j > 20: j = 1; print("") + print(anIds[i], end=' ') j = j + 1 pass -print "" +print("") # create a group -aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Element Diameter 3D > " + `mel_3d_margin`) +aGroup = mesh.CreateEmptyGroup(SMESH.FACE, "Element Diameter 3D > " + repr(mel_3d_margin)) aGroup.Add(anIds) salome.sg.updateObjBrowser(True) diff --git a/doc/salome/examples/transforming_meshes_ex06.py b/doc/salome/examples/transforming_meshes_ex06.py index 47c25b1ea..bd1a36f61 100644 --- a/doc/salome/examples/transforming_meshes_ex06.py +++ b/doc/salome/examples/transforming_meshes_ex06.py @@ -54,27 +54,27 @@ trias.ExtrusionAlongPath([], circlemesh, circle, 1, 0, [], 0, SMESH.PointStruct(0, 0, 0)) # merge nodes -print "Number of nodes before MergeNodes:", +print("Number of nodes before MergeNodes:", end=' ') trias.NbNodes() tolerance = 0.001 array_of_nodes_groups = trias.FindCoincidentNodes(tolerance) trias.MergeNodes(array_of_nodes_groups) -print "Number of nodes after MergeNodes:", trias.NbNodes() -print "" -print "Number of elements before MergeEqualElements:" -print "Edges : ", trias.NbEdges() -print "Triangles : ", trias.NbTriangles() -print "Quadrangles: ", trias.NbQuadrangles() -print "Volumes : ", trias.NbVolumes() +print("Number of nodes after MergeNodes:", trias.NbNodes()) +print("") +print("Number of elements before MergeEqualElements:") +print("Edges : ", trias.NbEdges()) +print("Triangles : ", trias.NbTriangles()) +print("Quadrangles: ", trias.NbQuadrangles()) +print("Volumes : ", trias.NbVolumes()) # merge elements trias.MergeEqualElements() -print "Number of elements after MergeEqualElements:" -print "Edges : ", trias.NbEdges() -print "Triangles : ", trias.NbTriangles() -print "Quadrangles: ", trias.NbQuadrangles() -print "Volumes : ", trias.NbVolumes() +print("Number of elements after MergeEqualElements:") +print("Edges : ", trias.NbEdges()) +print("Triangles : ", trias.NbTriangles()) +print("Quadrangles: ", trias.NbQuadrangles()) +print("Volumes : ", trias.NbVolumes()) salome.sg.updateObjBrowser(True) diff --git a/doc/salome/examples/transforming_meshes_ex09.py b/doc/salome/examples/transforming_meshes_ex09.py index 9264a5c4c..ac2707ccc 100644 --- a/doc/salome/examples/transforming_meshes_ex09.py +++ b/doc/salome/examples/transforming_meshes_ex09.py @@ -45,6 +45,6 @@ CreatePolyedrs = False res = mesh.SewFreeBorders(FirstNodeID1, SecondNodeID1, LastNodeID1, FirstNodeID2, SecondNodeID2, LastNodeID2, CreatePolygons, CreatePolyedrs ) -print res -print "nb polygons:", mesh.NbPolygons() +print(res) +print("nb polygons:", mesh.NbPolygons()) diff --git a/doc/salome/examples/transforming_meshes_ex10.py b/doc/salome/examples/transforming_meshes_ex10.py index e0120b481..7f6656135 100644 --- a/doc/salome/examples/transforming_meshes_ex10.py +++ b/doc/salome/examples/transforming_meshes_ex10.py @@ -37,27 +37,27 @@ mesh.Compute() # find elements to sew face1 = geompy.GetFaceNearPoint( aComp, geompy.MakeVertex( 5, 10, 5 )) IDsOfSide1Elements = mesh.GetSubMeshElementsId( face1 ) -print "side faces 1:",IDsOfSide1Elements +print("side faces 1:",IDsOfSide1Elements) face1Translated = geompy.MakeTranslation( face1, 0,5,0 ) faceFilter = smesh.GetFilter( SMESH.FACE, SMESH.FT_BelongToGeom,'=', face1Translated ) IDsOfSide2Elements = mesh.GetIdsFromFilter( faceFilter ) -print "side faces 2:",IDsOfSide2Elements +print("side faces 2:",IDsOfSide2Elements) # find corresponding nodes on sides edge1 = geompy.GetEdgeNearPoint( aComp, geompy.MakeVertex( 0, 10, 5 )) segs1 = mesh.GetSubMeshElementsId( edge1 ) # mesh segments generated on edge1 NodeID1OfSide1ToMerge = mesh.GetElemNode( segs1[0], 0 ) NodeID2OfSide1ToMerge = mesh.GetElemNode( segs1[0], 1 ) -print "nodes of side1:", [NodeID1OfSide1ToMerge,NodeID2OfSide1ToMerge] +print("nodes of side1:", [NodeID1OfSide1ToMerge,NodeID2OfSide1ToMerge]) edge2 = geompy.GetEdgeNearPoint( aComp, geompy.MakeVertex( 0, 15, 5 )) segs2 = mesh.GetSubMeshElementsId( edge2 ) # mesh segments generated on edge2 NodeID1OfSide2ToMerge = mesh.GetElemNode( segs2[0], 0 ) NodeID2OfSide2ToMerge = mesh.GetElemNode( segs2[0], 1 ) -print "nodes of side2:", [NodeID1OfSide2ToMerge,NodeID2OfSide2ToMerge] +print("nodes of side2:", [NodeID1OfSide2ToMerge,NodeID2OfSide2ToMerge]) res = mesh.SewSideElements(IDsOfSide1Elements, IDsOfSide2Elements, NodeID1OfSide1ToMerge, NodeID1OfSide2ToMerge, NodeID2OfSide1ToMerge, NodeID2OfSide2ToMerge) -print res +print(res) diff --git a/doc/salome/examples/transforming_meshes_ex11.py b/doc/salome/examples/transforming_meshes_ex11.py index 0abe52013..d827909ad 100644 --- a/doc/salome/examples/transforming_meshes_ex11.py +++ b/doc/salome/examples/transforming_meshes_ex11.py @@ -36,18 +36,18 @@ faces1 = mesh.CreateEmptyGroup( SMESH.FACE, 'faces1' ) faces1.Add( [ 144, 151, 158 ] ) # Duplicate nodes -print "\nMesh before the first nodes duplication:" -print "Nodes : ", mesh.NbNodes() -print "Edges : ", mesh.NbEdges() -print "Quadrangles : ", mesh.NbQuadrangles() +print("\nMesh before the first nodes duplication:") +print("Nodes : ", mesh.NbNodes()) +print("Edges : ", mesh.NbEdges()) +print("Quadrangles : ", mesh.NbQuadrangles()) groupOfCreatedNodes = mesh.DoubleNodeGroup(nodes1, faces1, theMakeGroup=True) -print "New nodes:", groupOfCreatedNodes.GetIDs() +print("New nodes:", groupOfCreatedNodes.GetIDs()) -print "\nMesh after the first nodes duplication:" -print "Nodes : ", mesh.NbNodes() -print "Edges : ", mesh.NbEdges() -print "Quadrangles : ", mesh.NbQuadrangles() +print("\nMesh after the first nodes duplication:") +print("Nodes : ", mesh.NbNodes()) +print("Edges : ", mesh.NbEdges()) +print("Quadrangles : ", mesh.NbQuadrangles()) # Duplicate nodes and border elements @@ -64,18 +64,18 @@ faces2 = mesh.CreateEmptyGroup( SMESH.FACE, 'faces2' ) faces2.Add( [ 141, 148, 155 ] ) # Duplicate nodes -print "\nMesh before the second nodes duplication:" -print "Nodes : ", mesh.NbNodes() -print "Edges : ", mesh.NbEdges() -print "Quadrangles : ", mesh.NbQuadrangles() +print("\nMesh before the second nodes duplication:") +print("Nodes : ", mesh.NbNodes()) +print("Edges : ", mesh.NbEdges()) +print("Quadrangles : ", mesh.NbQuadrangles()) groupOfNewEdges = mesh.DoubleNodeElemGroup( edges, nodes2, faces2, theMakeGroup=True ) -print "New edges:", groupOfNewEdges.GetIDs() +print("New edges:", groupOfNewEdges.GetIDs()) -print "\nMesh after the second nodes duplication:" -print "Nodes : ", mesh.NbNodes() -print "Edges : ", mesh.NbEdges() -print "Quadrangles : ", mesh.NbQuadrangles() +print("\nMesh after the second nodes duplication:") +print("Nodes : ", mesh.NbNodes()) +print("Edges : ", mesh.NbEdges()) +print("Quadrangles : ", mesh.NbQuadrangles()) # Duplicate elements only diff --git a/doc/salome/examples/transforming_meshes_ex13.py b/doc/salome/examples/transforming_meshes_ex13.py index 37a3f5eed..dfa412358 100644 --- a/doc/salome/examples/transforming_meshes_ex13.py +++ b/doc/salome/examples/transforming_meshes_ex13.py @@ -63,9 +63,9 @@ group1 = mesh3D.Group( faces[1] ) # pass group0 and ids of faces of group1 to inverse nbRev = mesh3D.Reorient2DBy3D([ group0, group1.GetIDs() ], mesh3D, theOutsideNormal=False) -print "Nb reoriented faces:", nbRev +print("Nb reoriented faces:", nbRev) # orient the reversed faces back nbRev = mesh3D.Reorient2DBy3D( mesh3D, mesh3D, theOutsideNormal=True) -print "Nb re-reoriented faces:", nbRev +print("Nb re-reoriented faces:", nbRev) diff --git a/doc/salome/examples/viewing_meshes_ex01.py b/doc/salome/examples/viewing_meshes_ex01.py index 85bc69fbc..f61a59af4 100644 --- a/doc/salome/examples/viewing_meshes_ex01.py +++ b/doc/salome/examples/viewing_meshes_ex01.py @@ -44,40 +44,40 @@ group = tetra.CreateEmptyGroup( SMESH.FACE, 'Group' ) nbAdd = group.Add( [ 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76 ] ) # Print information about the mesh -print "Information about mesh:" -print "Number of nodes : ", tetra.NbNodes() -print "Number of edges : ", tetra.NbEdges() -print "Number of faces : ", tetra.NbFaces() -print " triangles : ", tetra.NbTriangles() -print " quadrangles : ", tetra.NbQuadrangles() -print " polygons : ", tetra.NbPolygons() -print "Number of volumes : ", tetra.NbVolumes() -print " tetrahedrons: ", tetra.NbTetras() -print " hexahedrons : ", tetra.NbHexas() -print " prisms : ", tetra.NbPrisms() -print " pyramids : ", tetra.NbPyramids() -print " polyhedrons : ", tetra.NbPolyhedrons() +print("Information about mesh:") +print("Number of nodes : ", tetra.NbNodes()) +print("Number of edges : ", tetra.NbEdges()) +print("Number of faces : ", tetra.NbFaces()) +print(" triangles : ", tetra.NbTriangles()) +print(" quadrangles : ", tetra.NbQuadrangles()) +print(" polygons : ", tetra.NbPolygons()) +print("Number of volumes : ", tetra.NbVolumes()) +print(" tetrahedrons: ", tetra.NbTetras()) +print(" hexahedrons : ", tetra.NbHexas()) +print(" prisms : ", tetra.NbPrisms()) +print(" pyramids : ", tetra.NbPyramids()) +print(" polyhedrons : ", tetra.NbPolyhedrons()) # Get Information About Mesh by GetMeshInfo -print "\nInformation about mesh by GetMeshInfo:" +print("\nInformation about mesh by GetMeshInfo:") info = smesh.GetMeshInfo(tetra) -keys = info.keys(); keys.sort() +keys = list(info.keys()); keys.sort() for i in keys: - print " %s : %d" % ( i, info[i] ) + print(" %s : %d" % ( i, info[i] )) pass # Get Information About Group by GetMeshInfo -print "\nInformation about group by GetMeshInfo:" +print("\nInformation about group by GetMeshInfo:") info = smesh.GetMeshInfo(group) -keys = info.keys(); keys.sort() +keys = list(info.keys()); keys.sort() for i in keys: - print " %s : %d" % ( i, info[i] ) + print(" %s : %d" % ( i, info[i] )) pass # Get Information About SubMesh by GetMeshInfo -print "\nInformation about Submesh by GetMeshInfo:" +print("\nInformation about Submesh by GetMeshInfo:") info = smesh.GetMeshInfo(submesh) -keys = info.keys(); keys.sort() +keys = list(info.keys()); keys.sort() for i in keys: - print " %s : %d" % ( i, info[i] ) + print(" %s : %d" % ( i, info[i] )) pass diff --git a/doc/salome/gui/SMESH/collect_mesh_methods.py b/doc/salome/gui/SMESH/collect_mesh_methods.py index 7aa83b084..5c89fc9b0 100755 --- a/doc/salome/gui/SMESH/collect_mesh_methods.py +++ b/doc/salome/gui/SMESH/collect_mesh_methods.py @@ -116,8 +116,8 @@ def main(plugin_name, dummymeshhelp = True, output_file = "smeshBuilder.py"): f.close() pass pass - except Exception, e: - print e + except Exception as e: + print(e) pass pass diff --git a/src/SMESH_PY/smeshstudytools.py b/src/SMESH_PY/smeshstudytools.py index 3d407f85b..1b82fa5de 100644 --- a/src/SMESH_PY/smeshstudytools.py +++ b/src/SMESH_PY/smeshstudytools.py @@ -155,7 +155,7 @@ class SMeshStudyTools: self.smeshGui = salome.ImportComponentGUI("SMESH") if not helper.SalomeGUI.hasDesktop(): - print "displayMeshObject: no desktop available" + print("displayMeshObject: no desktop available") return self.smeshGui.CreateAndDisplayActor(entry) diff --git a/src/SMESH_SWIG/PAL_MESH_041_mesh.py b/src/SMESH_SWIG/PAL_MESH_041_mesh.py index 67f0ba76d..5cb4dfed0 100755 --- a/src/SMESH_SWIG/PAL_MESH_041_mesh.py +++ b/src/SMESH_SWIG/PAL_MESH_041_mesh.py @@ -67,7 +67,7 @@ plane_mesh = salome.IDToObject( Id_face1) mesh = smesh.Mesh(plane_mesh, "Mesh_1") -print"---------------------Hypothesis and Algorithms" +print("---------------------Hypothesis and Algorithms") #---------------- NumberOfSegments @@ -75,12 +75,12 @@ numberOfSegment = 9 algoWireDes = mesh.Segment() listHyp = algoWireDes.GetCompatibleHypothesis() -print algoWireDes.GetName() +print(algoWireDes.GetName()) algoWireDes.SetName("Ware descritisation") hypNbSeg = algoWireDes.NumberOfSegments(numberOfSegment) -print hypNbSeg.GetName() -print hypNbSeg.GetNumberOfSegments() +print(hypNbSeg.GetName()) +print(hypNbSeg.GetNumberOfSegments()) smesh.SetName(hypNbSeg, "Nb. Segments") @@ -89,19 +89,19 @@ maxElementArea = 200 algoMef = mesh.Triangle() listHyp = algoMef.GetCompatibleHypothesis() -print algoMef.GetName() +print(algoMef.GetName()) algoMef.SetName("Triangle (Mefisto)") hypArea200 = algoMef.MaxElementArea(maxElementArea) -print hypArea200.GetName() -print hypArea200.GetMaxElementArea() +print(hypArea200.GetName()) +print(hypArea200.GetMaxElementArea()) smesh.SetName(hypArea200, "Max. Element Area") -print "---------------------Compute the mesh" +print("---------------------Compute the mesh") ret = mesh.Compute() -print ret +print(ret) salome.sg.updateObjBrowser(True) diff --git a/src/SMESH_SWIG/SMESH_AdvancedEditor.py b/src/SMESH_SWIG/SMESH_AdvancedEditor.py index 7d2ee5a09..373242831 100644 --- a/src/SMESH_SWIG/SMESH_AdvancedEditor.py +++ b/src/SMESH_SWIG/SMESH_AdvancedEditor.py @@ -118,7 +118,7 @@ for i in range(0,nbzsteps): pass pass if len(nfaces)!=nbf: - print "len(nfaces)!=nbf" + print("len(nfaces)!=nbf") break newfaces.append(nfaces) # update faces for before next step of extrusion diff --git a/src/SMESH_SWIG/SMESH_BelongToGeom.py b/src/SMESH_SWIG/SMESH_BelongToGeom.py index cc25ccda9..16b67e7de 100644 --- a/src/SMESH_SWIG/SMESH_BelongToGeom.py +++ b/src/SMESH_SWIG/SMESH_BelongToGeom.py @@ -21,7 +21,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -from SMESH_test1 import * +from .SMESH_test1 import * ## Old style def CheckBelongToGeomFilterOld(theMeshGen, theMesh, theShape, theSubShape, theElemType): @@ -54,11 +54,11 @@ def CheckBelongToGeomFilter(theMesh, theShape, theSubShape, theElemType): anElemType = SMESH.FACE; -print "anElemType =", anElemType +print("anElemType =", anElemType) #anIds = CheckBelongToGeomFilter(mesh,box,subShapeList[1],anElemType) anIds = CheckBelongToGeomFilter(mesh,box,box,anElemType) -print "Number of ids = ", len(anIds) -print "anIds = ", anIds +print("Number of ids = ", len(anIds)) +print("anIds = ", anIds) ## Check old version #anIds = CheckBelongToGeomFilterOld(smesh,mesh.GetMesh(),box,box,anElemType) #print "anIds = ", anIds diff --git a/src/SMESH_SWIG/SMESH_GroupFromGeom.py b/src/SMESH_SWIG/SMESH_GroupFromGeom.py index b0e936b19..7da0c130d 100644 --- a/src/SMESH_SWIG/SMESH_GroupFromGeom.py +++ b/src/SMESH_SWIG/SMESH_GroupFromGeom.py @@ -24,7 +24,7 @@ # File : SMESH_GroupFromGeom.py # Module : SMESH # -from SMESH_test1 import * +from .SMESH_test1 import * # Compute the mesh created in SMESH_test1 diff --git a/src/SMESH_SWIG/SMESH_GroupFromGeom2.py b/src/SMESH_SWIG/SMESH_GroupFromGeom2.py index 498235198..b02c47cd8 100755 --- a/src/SMESH_SWIG/SMESH_GroupFromGeom2.py +++ b/src/SMESH_SWIG/SMESH_GroupFromGeom2.py @@ -29,7 +29,7 @@ # Project : PAL/SALOME #============================================================================== # -from SMESH_test1 import * +from .SMESH_test1 import * # Compute the mesh created in SMESH_test1 @@ -53,25 +53,25 @@ geompy.addToStudy(aGeomGroup2, "Group on Edges") aSmeshGroup1 = mesh.GroupOnGeom(aGeomGroup1, "SMESHGroup1", SMESH.FACE) aSmeshGroup2 = mesh.GroupOnGeom(aGeomGroup2, "SMESHGroup2", SMESH.EDGE) -print "Create aGroupOnShell - a group linked to a shell" +print("Create aGroupOnShell - a group linked to a shell") aGroupOnShell = mesh.GroupOnGeom(shell, "GroupOnShell", SMESH.EDGE) -print "aGroupOnShell type =", aGroupOnShell.GetType() -print "aGroupOnShell size =", aGroupOnShell.Size() -print "aGroupOnShell ids :", aGroupOnShell.GetListOfID() +print("aGroupOnShell type =", aGroupOnShell.GetType()) +print("aGroupOnShell size =", aGroupOnShell.Size()) +print("aGroupOnShell ids :", aGroupOnShell.GetListOfID()) -print " " +print(" ") -print "Modify hypothesis: 100 -> 50" +print("Modify hypothesis: 100 -> 50") hypLen1.SetLength(50) -print "Contents of aGroupOnShell changes:" -print "aGroupOnShell size =", aGroupOnShell.Size() -print "aGroupOnShell ids :", aGroupOnShell.GetListOfID() +print("Contents of aGroupOnShell changes:") +print("aGroupOnShell size =", aGroupOnShell.Size()) +print("aGroupOnShell ids :", aGroupOnShell.GetListOfID()) -print " " +print(" ") -print "Re-compute mesh, contents of aGroupOnShell changes again:" +print("Re-compute mesh, contents of aGroupOnShell changes again:") mesh.Compute() -print "aGroupOnShell size =", aGroupOnShell.Size() -print "aGroupOnShell ids :", aGroupOnShell.GetListOfID() +print("aGroupOnShell size =", aGroupOnShell.Size()) +print("aGroupOnShell ids :", aGroupOnShell.GetListOfID()) salome.sg.updateObjBrowser(True) diff --git a/src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py b/src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py index 4d7f05901..47bb94fbd 100644 --- a/src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py +++ b/src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py @@ -37,7 +37,7 @@ def BuildGroupLyingOn(theMesh, theElemType, theName, theShape): aGroup.Add(anIds) #Example -from SMESH_test1 import * +from .SMESH_test1 import * mesh.Compute() diff --git a/src/SMESH_SWIG/SMESH_Nut.py b/src/SMESH_SWIG/SMESH_Nut.py index 3e27b57ce..323304674 100755 --- a/src/SMESH_SWIG/SMESH_Nut.py +++ b/src/SMESH_SWIG/SMESH_Nut.py @@ -40,36 +40,36 @@ import os import math #Sketcher_1 creation -print "Sketcher creation..." +print("Sketcher creation...") Sketcher_1 = geompy.MakeSketcher("Sketcher:F 100 -57.7:TT 100 57.7:TT 0 115.47:TT -100 57.7:TT -100 -57.7:TT 0 -115.47:WW") geompy.addToStudy(Sketcher_1, "Sketcher_1") Face_1 = geompy.MakeFace(Sketcher_1, 1) geompy.addToStudy(Face_1, "Face_1") #Line creation -print "Line creation..." +print("Line creation...") Line_1 = geompy.MakeLineTwoPnt(geompy.MakeVertex(0,0,0), geompy.MakeVertex(0,0,100)) geompy.addToStudy(Line_1, "Line_1") #Prism creation -print "Prism creation..." +print("Prism creation...") Prism_1 = geompy.MakePrismVecH(Face_1, Line_1, 100) geompy.addToStudy(Prism_1, "Prism_1") #Sketcher_2 creation -print "Sketcher creation..." +print("Sketcher creation...") Sketcher_2 = geompy.MakeSketcher("Sketcher:F 50 0:TT 80 0:TT 112 13:TT 112 48:TT 80 63:TT 80 90:TT 50 90:WW", [0,0,0, 1,0,0, 0,1,0]) geompy.addToStudy(Sketcher_2, "Sketcher_2") Face_2 = geompy.MakeFace(Sketcher_2, 1) geompy.addToStudy(Face_2, "Face_2") #Revolution creation -print "Revolution creation..." +print("Revolution creation...") Revolution_1 = geompy.MakeRevolution(Face_2, Line_1, 2*math.pi) geompy.addToStudy(Revolution_1, "Revolution_1") #Common applying -print "Common of Revolution and Prism..." +print("Common of Revolution and Prism...") Common_1 = geompy.MakeBoolean(Revolution_1, Prism_1, 1) geompy.addToStudy(Common_1, "Common_1") @@ -80,12 +80,12 @@ for i in range(0, len(CommonExplodedListEdges)): geompy.addToStudyInFather(Common_1, CommonExplodedListEdges[i], name) #Fillet applying -print "Fillet creation..." +print("Fillet creation...") Fillet_1 = geompy.MakeFillet(Common_1, 10, geompy.ShapeType["EDGE"], [5]) geompy.addToStudy(Fillet_1, "Fillet_1") #Chamfer applying -print "Chamfer creation..." +print("Chamfer creation...") cyl_face = geompy.GetFaceNearPoint( Fillet_1, geompy.MakeVertex( 50, 0, 45 ), theName='cyl_face') cyl_face_id = geompy.GetSubShapeID( Fillet_1, cyl_face ) top_face = geompy.GetFaceNearPoint( Fillet_1, geompy.MakeVertex( 60, 0, 90 ), theName='top_face') @@ -99,14 +99,14 @@ top_face_id = geompy.GetSubShapeID( Chamfer_1, top_face ) Chamfer_2 = geompy.MakeChamferEdge(Chamfer_1, 10, 10, cyl_face_id, top_face_id, theName='Chamfer_2' ) #Import of the shape from "slots.brep" -print "Import multi-rotation from the DATA_DIR/Shapes/Brep/slots.brep" +print("Import multi-rotation from the DATA_DIR/Shapes/Brep/slots.brep") thePath = os.getenv("DATA_DIR") theFileName = os.path.join( thePath,"Shapes","Brep","slots.brep") theShapeForCut = geompy.ImportBREP(theFileName) geompy.addToStudy(theShapeForCut, "slot.brep_1") #Cut applying -print "Cut..." +print("Cut...") Cut_1 = geompy.MakeBoolean(Chamfer_2, theShapeForCut, 2) Cut_1_ID = geompy.addToStudy(Cut_1, "Cut_1") @@ -118,44 +118,44 @@ shape_mesh = salome.IDToObject( Cut_1_ID ) mesh = smesh.Mesh(shape_mesh, "Nut") #HYPOTHESIS CREATION -print "-------------------------- Average length" +print("-------------------------- Average length") theAverageLength = 5 algoReg1D = mesh.Segment() hAvLength = algoReg1D.LocalLength(theAverageLength) -print hAvLength.GetName() -print hAvLength.GetId() -print hAvLength.GetLength() +print(hAvLength.GetName()) +print(hAvLength.GetId()) +print(hAvLength.GetLength()) smesh.SetName(hAvLength, "AverageLength_"+str(theAverageLength)) -print "-------------------------- MaxElementArea" +print("-------------------------- MaxElementArea") theMaxElementArea = 20 algoMef = mesh.Triangle(smeshBuilder.MEFISTO) hArea = algoMef.MaxElementArea( theMaxElementArea ) -print hArea.GetName() -print hArea.GetId() -print hArea.GetMaxElementArea() +print(hArea.GetName()) +print(hArea.GetId()) +print(hArea.GetMaxElementArea()) smesh.SetName(hArea, "MaxElementArea_"+str(theMaxElementArea)) -print "-------------------------- MaxElementVolume" +print("-------------------------- MaxElementVolume") theMaxElementVolume = 150 algoNg = mesh.Tetrahedron(smeshBuilder.NETGEN) hVolume = algoNg.MaxElementVolume( theMaxElementVolume ) -print hVolume.GetName() -print hVolume.GetId() -print hVolume.GetMaxElementVolume() +print(hVolume.GetName()) +print(hVolume.GetId()) +print(hVolume.GetMaxElementVolume()) smesh.SetName(hVolume, "MaxElementVolume_"+str(theMaxElementVolume)) -print "-------------------------- compute the mesh of the mechanic piece" +print("-------------------------- compute the mesh of the mechanic piece") mesh.Compute() -print "Information about the Nut:" -print "Number of nodes : ", mesh.NbNodes() -print "Number of edges : ", mesh.NbEdges() -print "Number of faces : ", mesh.NbFaces() -print "Number of triangles : ", mesh.NbTriangles() -print "Number of quadrangles : ", mesh.NbQuadrangles() -print "Number of volumes : ", mesh.NbVolumes() -print "Number of tetrahedrons: ", mesh.NbTetras() +print("Information about the Nut:") +print("Number of nodes : ", mesh.NbNodes()) +print("Number of edges : ", mesh.NbEdges()) +print("Number of faces : ", mesh.NbFaces()) +print("Number of triangles : ", mesh.NbTriangles()) +print("Number of quadrangles : ", mesh.NbQuadrangles()) +print("Number of volumes : ", mesh.NbVolumes()) +print("Number of tetrahedrons: ", mesh.NbTetras()) salome.sg.updateObjBrowser(True) diff --git a/src/SMESH_SWIG/SMESH_Partition1_tetra.py b/src/SMESH_SWIG/SMESH_Partition1_tetra.py index aee34bb7e..0b6b98245 100644 --- a/src/SMESH_SWIG/SMESH_Partition1_tetra.py +++ b/src/SMESH_SWIG/SMESH_Partition1_tetra.py @@ -83,15 +83,15 @@ Compound1 = geompy.MakeCompound([colis_cc_multi, barier]) SubShape_theShape = geompy.SubShapeAll(Compound1,geompy.ShapeType["SOLID"]) alveole = geompy.MakePartition(SubShape_theShape) -print "Analysis of the geometry to mesh (right after the Partition) :" +print("Analysis of the geometry to mesh (right after the Partition) :") subShellList = geompy.SubShapeAll(alveole, geompy.ShapeType["SHELL"]) subFaceList = geompy.SubShapeAll(alveole, geompy.ShapeType["FACE"]) subEdgeList = geompy.SubShapeAll(alveole, geompy.ShapeType["EDGE"]) -print "number of Shells in alveole : ", len(subShellList) -print "number of Faces in alveole : ", len(subFaceList) -print "number of Edges in alveole : ", len(subEdgeList) +print("number of Shells in alveole : ", len(subShellList)) +print("number of Faces in alveole : ", len(subFaceList)) +print("number of Edges in alveole : ", len(subEdgeList)) subshapes = geompy.SubShapeAll(alveole, geompy.ShapeType["SHAPE"]) @@ -113,18 +113,18 @@ alveole = geompy.MakeCompound( [ comp, subshapes[8] ]) idalveole = geompy.addToStudy(alveole, "alveole") -print "Analysis of the geometry to mesh (right after the MakeCompound) :" +print("Analysis of the geometry to mesh (right after the MakeCompound) :") subShellList = geompy.SubShapeAll(alveole, geompy.ShapeType["SHELL"]) subFaceList = geompy.SubShapeAll(alveole, geompy.ShapeType["FACE"]) subEdgeList = geompy.SubShapeAll(alveole, geompy.ShapeType["EDGE"]) -print "number of Shells in alveole : ", len(subShellList) -print "number of Faces in alveole : ", len(subFaceList) -print "number of Edges in alveole : ", len(subEdgeList) +print("number of Shells in alveole : ", len(subShellList)) +print("number of Faces in alveole : ", len(subFaceList)) +print("number of Edges in alveole : ", len(subEdgeList)) status = geompy.CheckShape(alveole) -print " check status ", status +print(" check status ", status) # ---- init a Mesh with the alveole @@ -132,56 +132,56 @@ shape_mesh = salome.IDToObject( idalveole ) mesh = smesh.Mesh(shape_mesh, "MeshAlveole") -print "-------------------------- create Hypothesis (In this case global hypothesis are used)" +print("-------------------------- create Hypothesis (In this case global hypothesis are used)") -print "-------------------------- NumberOfSegments" +print("-------------------------- NumberOfSegments") numberOfSegments = 10 regular1D = mesh.Segment() hypNbSeg = regular1D.NumberOfSegments(numberOfSegments) -print hypNbSeg.GetName() -print hypNbSeg.GetId() -print hypNbSeg.GetNumberOfSegments() +print(hypNbSeg.GetName()) +print(hypNbSeg.GetId()) +print(hypNbSeg.GetNumberOfSegments()) smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments)) -print "-------------------------- MaxElementArea" +print("-------------------------- MaxElementArea") maxElementArea = 0.1 mefisto2D = mesh.Triangle() hypArea = mefisto2D.MaxElementArea(maxElementArea) -print hypArea.GetName() -print hypArea.GetId() -print hypArea.GetMaxElementArea() +print(hypArea.GetName()) +print(hypArea.GetId()) +print(hypArea.GetMaxElementArea()) smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea)) -print "-------------------------- MaxElementVolume" +print("-------------------------- MaxElementVolume") maxElementVolume = 0.5 netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN) hypVolume = netgen3D.MaxElementVolume(maxElementVolume) -print hypVolume.GetName() -print hypVolume.GetId() -print hypVolume.GetMaxElementVolume() +print(hypVolume.GetName()) +print(hypVolume.GetId()) +print(hypVolume.GetMaxElementVolume()) smesh.SetName(hypVolume, "MaxElementVolume_" + str(maxElementVolume)) -print "-------------------------- compute the mesh of alveole " +print("-------------------------- compute the mesh of alveole ") ret = mesh.Compute() if ret != 0: log=mesh.GetLog(0) # no erase trace for linelog in log: - print linelog - print "Information about the Mesh_mechanic:" - print "Number of nodes : ", mesh.NbNodes() - print "Number of edges : ", mesh.NbEdges() - print "Number of faces : ", mesh.NbFaces() - print "Number of triangles : ", mesh.NbTriangles() - print "Number of volumes : ", mesh.NbVolumes() - print "Number of tetrahedrons: ", mesh.NbTetras() + print(linelog) + print("Information about the Mesh_mechanic:") + print("Number of nodes : ", mesh.NbNodes()) + print("Number of edges : ", mesh.NbEdges()) + print("Number of faces : ", mesh.NbFaces()) + print("Number of triangles : ", mesh.NbTriangles()) + print("Number of volumes : ", mesh.NbVolumes()) + print("Number of tetrahedrons: ", mesh.NbTetras()) else: - print "problem when computing the mesh" + print("problem when computing the mesh") salome.sg.updateObjBrowser(True) diff --git a/src/SMESH_SWIG/SMESH_box2_tetra.py b/src/SMESH_SWIG/SMESH_box2_tetra.py index 6bba8e165..f8b123616 100644 --- a/src/SMESH_SWIG/SMESH_box2_tetra.py +++ b/src/SMESH_SWIG/SMESH_box2_tetra.py @@ -41,27 +41,27 @@ box1 = geompy.MakeBox(0., 0., 0., 100., 200., 300.) idbox1 = geompy.addToStudy(box1, "box1") -print "Analysis of the geometry box1 :" +print("Analysis of the geometry box1 :") subShellList = geompy.SubShapeAll(box1, geompy.ShapeType["SHELL"]) subFaceList = geompy.SubShapeAll(box1, geompy.ShapeType["FACE"]) subEdgeList = geompy.SubShapeAll(box1, geompy.ShapeType["EDGE"]) -print "number of Shells in box1 : ", len(subShellList) -print "number of Faces in box1 : ", len(subFaceList) -print "number of Edges in box1 : ", len(subEdgeList) +print("number of Shells in box1 : ", len(subShellList)) +print("number of Faces in box1 : ", len(subFaceList)) +print("number of Edges in box1 : ", len(subEdgeList)) box2 = geompy.MakeBox(100., 0., 0., 200., 200., 300.) idbox2 = geompy.addToStudy(box2, "box2") -print "Analysis of the geometry box2 :" +print("Analysis of the geometry box2 :") subShellList = geompy.SubShapeAll(box2, geompy.ShapeType["SHELL"]) subFaceList = geompy.SubShapeAll(box2, geompy.ShapeType["FACE"]) subEdgeList = geompy.SubShapeAll(box2, geompy.ShapeType["EDGE"]) -print "number of Shells in box2 : ", len(subShellList) -print "number of Faces in box2 : ", len(subFaceList) -print "number of Edges in box2 : ", len(subEdgeList) +print("number of Shells in box2 : ", len(subShellList)) +print("number of Faces in box2 : ", len(subFaceList)) +print("number of Edges in box2 : ", len(subEdgeList)) # append the tow boxes to make ine shel, referrencing only once # the internal interface @@ -69,14 +69,14 @@ print "number of Edges in box2 : ", len(subEdgeList) shell = geompy.MakePartition([box1, box2]) idshell = geompy.addToStudy(shell, "shell") -print "Analysis of the geometry shell (union of box1 and box2) :" +print("Analysis of the geometry shell (union of box1 and box2) :") subShellList = geompy.SubShapeAll(shell, geompy.ShapeType["SHELL"]) subFaceList = geompy.SubShapeAll(shell, geompy.ShapeType["FACE"]) subEdgeList = geompy.SubShapeAll(shell, geompy.ShapeType["EDGE"]) -print "number of Shells in shell : ", len(subShellList) -print "number of Faces in shell : ", len(subFaceList) -print "number of Edges in shell : ", len(subEdgeList) +print("number of Shells in shell : ", len(subShellList)) +print("number of Faces in shell : ", len(subFaceList)) +print("number of Edges in shell : ", len(subEdgeList)) ### ---------------------------- SMESH -------------------------------------- @@ -88,54 +88,54 @@ mesh = smesh.Mesh(shell, "MeshBox2") # ---- set Hypothesis and Algorithm -print "-------------------------- NumberOfSegments" +print("-------------------------- NumberOfSegments") numberOfSegments = 10 regular1D = mesh.Segment() hypNbSeg = regular1D.NumberOfSegments(numberOfSegments) -print hypNbSeg.GetName() -print hypNbSeg.GetId() -print hypNbSeg.GetNumberOfSegments() +print(hypNbSeg.GetName()) +print(hypNbSeg.GetId()) +print(hypNbSeg.GetNumberOfSegments()) smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments)) -print "-------------------------- MaxElementArea" +print("-------------------------- MaxElementArea") maxElementArea = 500 mefisto2D = mesh.Triangle() hypArea = mefisto2D.MaxElementArea(maxElementArea) -print hypArea.GetName() -print hypArea.GetId() -print hypArea.GetMaxElementArea() +print(hypArea.GetName()) +print(hypArea.GetId()) +print(hypArea.GetMaxElementArea()) smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea)) -print "-------------------------- MaxElementVolume" +print("-------------------------- MaxElementVolume") maxElementVolume = 500 netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN) hypVolume = netgen3D.MaxElementVolume(maxElementVolume) -print hypVolume.GetName() -print hypVolume.GetId() -print hypVolume.GetMaxElementVolume() +print(hypVolume.GetName()) +print(hypVolume.GetId()) +print(hypVolume.GetMaxElementVolume()) smesh.SetName(hypVolume, "MaxElementVolume_" + str(maxElementVolume)) -print "-------------------------- compute shell" +print("-------------------------- compute shell") ret = mesh.Compute() -print ret +print(ret) if ret != 0: log = mesh.GetLog(0) # no erase trace for linelog in log: - print linelog - print "Information about the MeshBox2:" - print "Number of nodes : ", mesh.NbNodes() - print "Number of edges : ", mesh.NbEdges() - print "Number of faces : ", mesh.NbFaces() - print "Number of triangles : ", mesh.NbTriangles() - print "Number of volumes : ", mesh.NbVolumes() - print "Number of tetrahedrons: ", mesh.NbTetras() + print(linelog) + print("Information about the MeshBox2:") + print("Number of nodes : ", mesh.NbNodes()) + print("Number of edges : ", mesh.NbEdges()) + print("Number of faces : ", mesh.NbFaces()) + print("Number of triangles : ", mesh.NbTriangles()) + print("Number of volumes : ", mesh.NbVolumes()) + print("Number of tetrahedrons: ", mesh.NbTetras()) else: - print "probleme when computing the mesh" + print("probleme when computing the mesh") salome.sg.updateObjBrowser(True) diff --git a/src/SMESH_SWIG/SMESH_box3_tetra.py b/src/SMESH_SWIG/SMESH_box3_tetra.py index 6121df448..55e047583 100644 --- a/src/SMESH_SWIG/SMESH_box3_tetra.py +++ b/src/SMESH_SWIG/SMESH_box3_tetra.py @@ -41,52 +41,52 @@ box1 = geompy.MakeBox(0., 0., 0., 100., 200., 300.) idbox1 = geompy.addToStudy(box1, "box1") -print "Analysis of the geometry box1 :" +print("Analysis of the geometry box1 :") subShellList = geompy.SubShapeAll(box1, geompy.ShapeType["SHELL"]) subFaceList = geompy.SubShapeAll(box1, geompy.ShapeType["FACE"]) subEdgeList = geompy.SubShapeAll(box1, geompy.ShapeType["EDGE"]) -print "number of Shells in box1 : ", len(subShellList) -print "number of Faces in box1 : ", len(subFaceList) -print "number of Edges in box1 : ", len(subEdgeList) +print("number of Shells in box1 : ", len(subShellList)) +print("number of Faces in box1 : ", len(subFaceList)) +print("number of Edges in box1 : ", len(subEdgeList)) box2 = geompy.MakeBox(100., 0., 0., 200., 200., 300.) idbox2 = geompy.addToStudy(box2, "box2") -print "Analysis of the geometry box2 :" +print("Analysis of the geometry box2 :") subShellList = geompy.SubShapeAll(box2, geompy.ShapeType["SHELL"]) subFaceList = geompy.SubShapeAll(box2, geompy.ShapeType["FACE"]) subEdgeList = geompy.SubShapeAll(box2, geompy.ShapeType["EDGE"]) -print "number of Shells in box2 : ", len(subShellList) -print "number of Faces in box2 : ", len(subFaceList) -print "number of Edges in box2 : ", len(subEdgeList) +print("number of Shells in box2 : ", len(subShellList)) +print("number of Faces in box2 : ", len(subFaceList)) +print("number of Edges in box2 : ", len(subEdgeList)) box3 = geompy.MakeBox(0., 0., 300., 200., 200., 500.) idbox3 = geompy.addToStudy(box3, "box3") -print "Analysis of the geometry box3 :" +print("Analysis of the geometry box3 :") subShellList = geompy.SubShapeAll(box3, geompy.ShapeType["SHELL"]) subFaceList = geompy.SubShapeAll(box3, geompy.ShapeType["FACE"]) subEdgeList = geompy.SubShapeAll(box3, geompy.ShapeType["EDGE"]) -print "number of Shells in box3 : ", len(subShellList) -print "number of Faces in box3 : ", len(subFaceList) -print "number of Edges in box3 : ", len(subEdgeList) +print("number of Shells in box3 : ", len(subShellList)) +print("number of Faces in box3 : ", len(subFaceList)) +print("number of Edges in box3 : ", len(subEdgeList)) shell = geompy.MakePartition([box1, box2, box3]) idshell = geompy.addToStudy(shell,"shell") -print "Analysis of the geometry shell (union of box1, box2 and box3) :" +print("Analysis of the geometry shell (union of box1, box2 and box3) :") subShellList = geompy.SubShapeAll(shell, geompy.ShapeType["SHELL"]) subFaceList = geompy.SubShapeAll(shell, geompy.ShapeType["FACE"]) subEdgeList = geompy.SubShapeAll(shell, geompy.ShapeType["EDGE"]) -print "number of Shells in shell : ", len(subShellList) -print "number of Faces in shell : ", len(subFaceList) -print "number of Edges in shell : ", len(subEdgeList) +print("number of Shells in shell : ", len(subShellList)) +print("number of Faces in shell : ", len(subFaceList)) +print("number of Edges in shell : ", len(subEdgeList)) ### ---------------------------- SMESH -------------------------------------- @@ -98,54 +98,54 @@ mesh = smesh.Mesh(shell, "MeshBox3") # ---- set Hypothesis and Algorithm -print "-------------------------- NumberOfSegments" +print("-------------------------- NumberOfSegments") numberOfSegments = 10 regular1D = mesh.Segment() hypNbSeg = regular1D.NumberOfSegments(numberOfSegments) -print hypNbSeg.GetName() -print hypNbSeg.GetId() -print hypNbSeg.GetNumberOfSegments() +print(hypNbSeg.GetName()) +print(hypNbSeg.GetId()) +print(hypNbSeg.GetNumberOfSegments()) smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments)) -print "-------------------------- MaxElementArea" +print("-------------------------- MaxElementArea") maxElementArea = 500 mefisto2D = mesh.Triangle() hypArea = mefisto2D.MaxElementArea(maxElementArea) -print hypArea.GetName() -print hypArea.GetId() -print hypArea.GetMaxElementArea() +print(hypArea.GetName()) +print(hypArea.GetId()) +print(hypArea.GetMaxElementArea()) smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea)) -print "-------------------------- MaxElementVolume" +print("-------------------------- MaxElementVolume") maxElementVolume = 500 netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN) hypVolume = netgen3D.MaxElementVolume(maxElementVolume) -print hypVolume.GetName() -print hypVolume.GetId() -print hypVolume.GetMaxElementVolume() +print(hypVolume.GetName()) +print(hypVolume.GetId()) +print(hypVolume.GetMaxElementVolume()) smesh.SetName(hypVolume, "MaxElementVolume_" + str(maxElementVolume)) -print "-------------------------- compute shell" +print("-------------------------- compute shell") ret = mesh.Compute() -print ret +print(ret) if ret != 0: log = mesh.GetLog(0) # no erase trace for linelog in log: - print linelog - print "Information about the MeshBox3:" - print "Number of nodes : ", mesh.NbNodes() - print "Number of edges : ", mesh.NbEdges() - print "Number of faces : ", mesh.NbFaces() - print "Number of triangles : ", mesh.NbTriangles() - print "Number of volumes : ", mesh.NbVolumes() - print "Number of tetrahedrons: ", mesh.NbTetras() + print(linelog) + print("Information about the MeshBox3:") + print("Number of nodes : ", mesh.NbNodes()) + print("Number of edges : ", mesh.NbEdges()) + print("Number of faces : ", mesh.NbFaces()) + print("Number of triangles : ", mesh.NbTriangles()) + print("Number of volumes : ", mesh.NbVolumes()) + print("Number of tetrahedrons: ", mesh.NbTetras()) else: - print "probleme when computing the mesh" + print("probleme when computing the mesh") salome.sg.updateObjBrowser(True) diff --git a/src/SMESH_SWIG/SMESH_box_tetra.py b/src/SMESH_SWIG/SMESH_box_tetra.py index 4938de61e..d2e6c8e71 100644 --- a/src/SMESH_SWIG/SMESH_box_tetra.py +++ b/src/SMESH_SWIG/SMESH_box_tetra.py @@ -40,14 +40,14 @@ box = geompy.MakeBox(0., 0., 0., 100., 200., 300.) idbox = geompy.addToStudy(box, "box") -print "Analysis of the geometry box :" +print("Analysis of the geometry box :") subShellList = geompy.SubShapeAll(box, geompy.ShapeType["SHELL"]) subFaceList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"]) subEdgeList = geompy.SubShapeAll(box, geompy.ShapeType["EDGE"]) -print "number of Shells in box : ", len(subShellList) -print "number of Faces in box : ", len(subFaceList) -print "number of Edges in box : ", len(subEdgeList) +print("number of Shells in box : ", len(subShellList)) +print("number of Faces in box : ", len(subFaceList)) +print("number of Edges in box : ", len(subEdgeList)) ### ---------------------------- SMESH -------------------------------------- @@ -58,53 +58,53 @@ mesh = smesh.Mesh(box, "MeshBox") # ---- set Hypothesis and Algorithm -print "-------------------------- NumberOfSegments" +print("-------------------------- NumberOfSegments") numberOfSegments = 10 regular1D = mesh.Segment() hypNbSeg = regular1D.NumberOfSegments(numberOfSegments) -print hypNbSeg.GetName() -print hypNbSeg.GetId() -print hypNbSeg.GetNumberOfSegments() +print(hypNbSeg.GetName()) +print(hypNbSeg.GetId()) +print(hypNbSeg.GetNumberOfSegments()) smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments)) -print "-------------------------- MaxElementArea" +print("-------------------------- MaxElementArea") maxElementArea = 500 mefisto2D = mesh.Triangle() hypArea = mefisto2D.MaxElementArea(maxElementArea) -print hypArea.GetName() -print hypArea.GetId() -print hypArea.GetMaxElementArea() +print(hypArea.GetName()) +print(hypArea.GetId()) +print(hypArea.GetMaxElementArea()) smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea)) -print "-------------------------- MaxElementVolume" +print("-------------------------- MaxElementVolume") maxElementVolume = 500 netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN) hypVolume = netgen3D.MaxElementVolume(maxElementVolume) -print hypVolume.GetName() -print hypVolume.GetId() -print hypVolume.GetMaxElementVolume() +print(hypVolume.GetName()) +print(hypVolume.GetId()) +print(hypVolume.GetMaxElementVolume()) smesh.SetName(hypVolume, "MaxElementVolume_" + str(maxElementVolume)) -print "-------------------------- compute the mesh of the boxe" +print("-------------------------- compute the mesh of the boxe") ret = mesh.Compute() -print ret +print(ret) if ret != 0: log = mesh.GetLog(0) # no erase trace for linelog in log: - print linelog - print "Information about the MeshBox:" - print "Number of nodes : ", mesh.NbNodes() - print "Number of edges : ", mesh.NbEdges() - print "Number of faces : ", mesh.NbFaces() - print "Number of triangles : ", mesh.NbTriangles() - print "Number of volumes : ", mesh.NbVolumes() - print "Number of tetrahedrons: ", mesh.NbTetras() + print(linelog) + print("Information about the MeshBox:") + print("Number of nodes : ", mesh.NbNodes()) + print("Number of edges : ", mesh.NbEdges()) + print("Number of faces : ", mesh.NbFaces()) + print("Number of triangles : ", mesh.NbTriangles()) + print("Number of volumes : ", mesh.NbVolumes()) + print("Number of tetrahedrons: ", mesh.NbTetras()) else: - print "probleme when computing the mesh" + print("probleme when computing the mesh") salome.sg.updateObjBrowser(True) diff --git a/src/SMESH_SWIG/SMESH_controls.py b/src/SMESH_SWIG/SMESH_controls.py index dfefee94c..a2b36a212 100644 --- a/src/SMESH_SWIG/SMESH_controls.py +++ b/src/SMESH_SWIG/SMESH_controls.py @@ -26,7 +26,7 @@ # Module : SMESH # import salome -import SMESH_mechanic +from . import SMESH_mechanic import SMESH, SALOMEDS from salome.smesh import smeshBuilder @@ -40,7 +40,7 @@ aGroup = mesh.MakeGroup("Area > 100", SMESH.FACE, SMESH.FT_Area, SMESH.FT_MoreTh # print result anIds = aGroup.GetIDs() -print "Criterion: Area > 100 Nb = ", len( anIds ) +print("Criterion: Area > 100 Nb = ", len( anIds )) #for i in range( len( anIds ) ): #print anIds[ i ] @@ -52,7 +52,7 @@ aGroup = mesh.MakeGroup("Taper > 3e-15", SMESH.FACE, SMESH.FT_Taper, SMESH.FT_Mo # print result anIds = aGroup.GetIDs() -print "Criterion: Taper > 3e-15 Nb = ", len( anIds ) +print("Criterion: Taper > 3e-15 Nb = ", len( anIds )) #for i in range( len( anIds ) ): #print anIds[ i ] @@ -64,7 +64,7 @@ aGroup = mesh.MakeGroup("Aspect Ratio > 1.3", SMESH.FACE, SMESH.FT_AspectRatio, # print result anIds = aGroup.GetIDs() -print "Criterion: Aspect Ratio > 1.3 Nb = ", len( anIds ) +print("Criterion: Aspect Ratio > 1.3 Nb = ", len( anIds )) #for i in range( len( anIds ) ): #print anIds[ i ] @@ -76,7 +76,7 @@ aGroup = mesh.MakeGroup("Minimum Angle < 30", SMESH.FACE, SMESH.FT_MinimumAngle, # print result anIds = aGroup.GetIDs() -print "Criterion: Minimum Angle < 30 Nb = ", len( anIds ) +print("Criterion: Minimum Angle < 30 Nb = ", len( anIds )) #for i in range( len( anIds ) ): #print anIds[ i ] @@ -88,7 +88,7 @@ aGroup = mesh.MakeGroup("Warp > 2e-13", SMESH.FACE, SMESH.FT_Warping, SMESH.FT_M # print result anIds = aGroup.GetIDs() -print "Criterion: Warp > 2e-13 Nb = ", len( anIds ) +print("Criterion: Warp > 2e-13 Nb = ", len( anIds )) #for i in range( len( anIds ) ): #print anIds[ i ] @@ -100,7 +100,7 @@ aGroup = mesh.MakeGroup("Skew > 18", SMESH.FACE, SMESH.FT_Skew, SMESH.FT_MoreTha # print result anIds = aGroup.GetIDs() -print "Criterion: Skew > 18 Nb = ", len( anIds ) +print("Criterion: Skew > 18 Nb = ", len( anIds )) #for i in range( len( anIds ) ): #print anIds[ i ] @@ -112,7 +112,7 @@ aGroup = mesh.MakeGroup("Length > 10", SMESH.FACE, SMESH.FT_Length, SMESH.FT_Mor # print result anIds = aGroup.GetIDs() -print "Criterion: Length > 10 Nb = ", len( anIds ) +print("Criterion: Length > 10 Nb = ", len( anIds )) #for i in range( len( anIds ) ): #print anIds[ i ] @@ -124,7 +124,7 @@ aGroup = mesh.MakeGroup("Borders at multi-connections = 2", SMESH.EDGE, SMESH.FT # print result anIds = aGroup.GetIDs() -print "Criterion: Borders at multi-connections = 2 Nb = ", len( anIds ) +print("Criterion: Borders at multi-connections = 2 Nb = ", len( anIds )) #for i in range( len( anIds ) ): #print anIds[ i ] @@ -136,7 +136,7 @@ aGroup = mesh.MakeGroup("Element Diameter 2D > 10", SMESH.FACE, SMESH.FT_MaxElem # print result anIds = aGroup.GetIDs() -print "Criterion: Element Diameter 2D > 10 Nb = ", len( anIds ) +print("Criterion: Element Diameter 2D > 10 Nb = ", len( anIds )) #for i in range( len( anIds ) ): #print anIds[ i ] diff --git a/src/SMESH_SWIG/SMESH_demo_hexa2_upd.py b/src/SMESH_SWIG/SMESH_demo_hexa2_upd.py index ef6ea57c1..604f21714 100755 --- a/src/SMESH_SWIG/SMESH_demo_hexa2_upd.py +++ b/src/SMESH_SWIG/SMESH_demo_hexa2_upd.py @@ -103,14 +103,14 @@ tol3d = 1.e-3 vol = geompy.MakeGlueFaces(volComp,tol3d) idVol = geompy.addToStudy(vol,"volume") -print "Analysis of the final volume:" +print("Analysis of the final volume:") subShellList = geompy.SubShapeAllSorted(vol,ShapeTypeShell) subFaceList = geompy.SubShapeAllSorted(vol,ShapeTypeFace) subEdgeList = geompy.SubShapeAllSorted(vol,ShapeTypeEdge) -print "number of Shells in the volume : ",len(subShellList) -print "number of Faces in the volume : ",len(subFaceList) -print "number of Edges in the volume : ",len(subEdgeList) +print("number of Shells in the volume : ",len(subShellList)) +print("number of Faces in the volume : ",len(subFaceList)) +print("number of Edges in the volume : ",len(subEdgeList)) idSubEdge = [] for k in range(len(subEdgeList)): @@ -139,36 +139,36 @@ mesh = smesh.Mesh(vol, "meshVolume") # ---- set Hypothesis and Algorithm to main shape -print "-------------------------- NumberOfSegments the global one" +print("-------------------------- NumberOfSegments the global one") numberOfSegments = 10 regular1D = mesh.Segment() regular1D.SetName("Wire Discretisation") hypNbSeg = regular1D.NumberOfSegments(numberOfSegments) -print hypNbSeg.GetName() -print hypNbSeg.GetId() -print hypNbSeg.GetNumberOfSegments() +print(hypNbSeg.GetName()) +print(hypNbSeg.GetId()) +print(hypNbSeg.GetNumberOfSegments()) smesh.SetName(hypNbSeg, "NumberOfSegments") -print "-------------------------- Quadrangle_2D" +print("-------------------------- Quadrangle_2D") quad2D=mesh.Quadrangle() quad2D.SetName("Quadrangle_2D") -print "-------------------------- Hexa_3D" +print("-------------------------- Hexa_3D") hexa3D=mesh.Hexahedron() hexa3D.SetName("Hexa_3D") -print "-------------------------- NumberOfSegments in the Z direction" +print("-------------------------- NumberOfSegments in the Z direction") numberOfSegmentsZ = 40 for i in range(8): - print "-------------------------- add hypothesis to edge in the Z directions", (i+1) + print("-------------------------- add hypothesis to edge in the Z directions", (i+1)) algo = mesh.Segment(edgeZ[i]) hyp = algo.NumberOfSegments(numberOfSegmentsZ) @@ -178,23 +178,23 @@ for i in range(8): salome.sg.updateObjBrowser(True) -print "-------------------------- compute the mesh of the volume" +print("-------------------------- compute the mesh of the volume") ret=mesh.Compute() -print ret +print(ret) if ret != 0: ## log=mesh.GetLog(0) # no erase trace ## for linelog in log: ## print linelog - print "Information about the MeshBox :" - print "Number of nodes : ", mesh.NbNodes() - print "Number of edges : ", mesh.NbEdges() - print "Number of faces : ", mesh.NbFaces() - print "Number of triangles : ", mesh.NbTriangles() - print "Number of volumes : ", mesh.NbVolumes() - print "Number of tetrahedrons: ", mesh.NbTetras() + print("Information about the MeshBox :") + print("Number of nodes : ", mesh.NbNodes()) + print("Number of edges : ", mesh.NbEdges()) + print("Number of faces : ", mesh.NbFaces()) + print("Number of triangles : ", mesh.NbTriangles()) + print("Number of volumes : ", mesh.NbVolumes()) + print("Number of tetrahedrons: ", mesh.NbTetras()) else: - print "problem when Computing the mesh" + print("problem when Computing the mesh") salome.sg.updateObjBrowser(True) diff --git a/src/SMESH_SWIG/SMESH_fixation_hexa.py b/src/SMESH_SWIG/SMESH_fixation_hexa.py index 7d9245c3b..cb5e77e0f 100644 --- a/src/SMESH_SWIG/SMESH_fixation_hexa.py +++ b/src/SMESH_SWIG/SMESH_fixation_hexa.py @@ -26,7 +26,7 @@ # Hypothesis and algorithms for the mesh generation are global # import salome -import SMESH_fixation +from . import SMESH_fixation import SMESH, SALOMEDS from salome.smesh import smeshBuilder @@ -37,17 +37,17 @@ idcomp = SMESH_fixation.idcomp geompy = SMESH_fixation.geompy salome = SMESH_fixation.salome -print "Analysis of the geometry to be meshed :" +print("Analysis of the geometry to be meshed :") subShellList = geompy.SubShapeAll(compshell, geompy.ShapeType["SHELL"]) subFaceList = geompy.SubShapeAll(compshell, geompy.ShapeType["FACE"]) subEdgeList = geompy.SubShapeAll(compshell, geompy.ShapeType["EDGE"]) -print "number of Shells in compshell : ", len(subShellList) -print "number of Faces in compshell : ", len(subFaceList) -print "number of Edges in compshell : ", len(subEdgeList) +print("number of Shells in compshell : ", len(subShellList)) +print("number of Faces in compshell : ", len(subFaceList)) +print("number of Edges in compshell : ", len(subEdgeList)) status = geompy.CheckShape(compshell) -print " check status ", status +print(" check status ", status) ### ---------------------------- SMESH -------------------------------------- smesh.SetCurrentStudy(salome.myStudy) @@ -60,43 +60,43 @@ mesh = smesh.Mesh(shape_mesh, "MeshCompShell") # ---- set Hypothesis and Algorithm -print "-------------------------- NumberOfSegments" +print("-------------------------- NumberOfSegments") numberOfSegments = 5 regular1D = mesh.Segment() regular1D.SetName("Wire Discretisation") hypNbSeg = regular1D.NumberOfSegments(numberOfSegments) -print hypNbSeg.GetName() -print hypNbSeg.GetId() -print hypNbSeg.GetNumberOfSegments() +print(hypNbSeg.GetName()) +print(hypNbSeg.GetId()) +print(hypNbSeg.GetNumberOfSegments()) smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments)) -print "-------------------------- Quadrangle_2D" +print("-------------------------- Quadrangle_2D") quad2D = mesh.Quadrangle() quad2D.SetName("Quadrangle_2D") -print "-------------------------- Hexa_3D" +print("-------------------------- Hexa_3D") hexa3D = mesh.Hexahedron() hexa3D.SetName("Hexa_3D") -print "-------------------------- compute compshell" +print("-------------------------- compute compshell") ret = mesh.Compute() -print ret +print(ret) if ret != 0: log = mesh.GetLog(0) # no erase trace for linelog in log: - print linelog - print "Information about the MeshcompShel:" - print "Number of nodes : ", mesh.NbNodes() - print "Number of edges : ", mesh.NbEdges() - print "Number of faces : ", mesh.NbFaces() - print "Number of quadrangles : ", mesh.NbQuadrangles() - print "Number of volumes : ", mesh.NbVolumes() - print "Number of hexahedrons : ", mesh.NbHexas() + print(linelog) + print("Information about the MeshcompShel:") + print("Number of nodes : ", mesh.NbNodes()) + print("Number of edges : ", mesh.NbEdges()) + print("Number of faces : ", mesh.NbFaces()) + print("Number of quadrangles : ", mesh.NbQuadrangles()) + print("Number of volumes : ", mesh.NbVolumes()) + print("Number of hexahedrons : ", mesh.NbHexas()) else: - print "problem when Computing the mesh" + print("problem when Computing the mesh") salome.sg.updateObjBrowser(True) diff --git a/src/SMESH_SWIG/SMESH_fixation_netgen.py b/src/SMESH_SWIG/SMESH_fixation_netgen.py index ed2c999f4..6731d63f5 100644 --- a/src/SMESH_SWIG/SMESH_fixation_netgen.py +++ b/src/SMESH_SWIG/SMESH_fixation_netgen.py @@ -26,7 +26,7 @@ # The new Netgen algorithm is used that discretizes baoundaries itself # import salome -import SMESH_fixation +from . import SMESH_fixation import SMESH, SALOMEDS from salome.smesh import smeshBuilder @@ -37,22 +37,22 @@ idcomp = SMESH_fixation.idcomp geompy = SMESH_fixation.geompy salome = SMESH_fixation.salome -print "Analysis of the geometry to be meshed :" +print("Analysis of the geometry to be meshed :") subShellList = geompy.SubShapeAll(compshell, geompy.ShapeType["SHELL"]) subFaceList = geompy.SubShapeAll(compshell, geompy.ShapeType["FACE"]) subEdgeList = geompy.SubShapeAll(compshell, geompy.ShapeType["EDGE"]) -print "number of Shells in compshell : ", len(subShellList) -print "number of Faces in compshell : ", len(subFaceList) -print "number of Edges in compshell : ", len(subEdgeList) +print("number of Shells in compshell : ", len(subShellList)) +print("number of Faces in compshell : ", len(subFaceList)) +print("number of Edges in compshell : ", len(subEdgeList)) status = geompy.CheckShape(compshell) -print " check status ", status +print(" check status ", status) ### ---------------------------- SMESH -------------------------------------- smesh.SetCurrentStudy(salome.myStudy) -print "-------------------------- create Mesh, algorithm, hypothesis" +print("-------------------------- create Mesh, algorithm, hypothesis") mesh = smesh.Mesh(compshell, "MeshcompShel"); netgen = mesh.Tetrahedron(smeshBuilder.FULL_NETGEN) @@ -61,19 +61,19 @@ netgen.SetMaxSize( 50 ) netgen.SetFineness( smeshBuilder.Fine ) #netgen.SetOptimize( 1 ) -print "-------------------------- compute mesh" +print("-------------------------- compute mesh") ret = mesh.Compute() -print ret +print(ret) if ret != 0: - print "Information about the MeshcompShel:" - print "Number of nodes : ", mesh.GetMesh().NbNodes() - print "Number of edges : ", mesh.GetMesh().NbEdges() - print "Number of faces : ", mesh.GetMesh().NbFaces() - print "Number of triangles : ", mesh.GetMesh().NbTriangles() - print "Number of volumes : ", mesh.GetMesh().NbVolumes() - print "Number of tetrahedrons : ", mesh.GetMesh().NbTetras() + print("Information about the MeshcompShel:") + print("Number of nodes : ", mesh.GetMesh().NbNodes()) + print("Number of edges : ", mesh.GetMesh().NbEdges()) + print("Number of faces : ", mesh.GetMesh().NbFaces()) + print("Number of triangles : ", mesh.GetMesh().NbTriangles()) + print("Number of volumes : ", mesh.GetMesh().NbVolumes()) + print("Number of tetrahedrons : ", mesh.GetMesh().NbTetras()) else: - print "problem when computing the mesh" + print("problem when computing the mesh") salome.sg.updateObjBrowser(True) diff --git a/src/SMESH_SWIG/SMESH_fixation_tetra.py b/src/SMESH_SWIG/SMESH_fixation_tetra.py index 4f578dd01..3e8732a53 100644 --- a/src/SMESH_SWIG/SMESH_fixation_tetra.py +++ b/src/SMESH_SWIG/SMESH_fixation_tetra.py @@ -26,7 +26,7 @@ # Hypothesis and algorithms for the mesh generation are global # import salome -import SMESH_fixation +from . import SMESH_fixation import SMESH, SALOMEDS from salome.smesh import smeshBuilder @@ -37,17 +37,17 @@ idcomp = SMESH_fixation.idcomp geompy = SMESH_fixation.geompy salome = SMESH_fixation.salome -print "Analysis of the geometry to be meshed :" +print("Analysis of the geometry to be meshed :") subShellList = geompy.SubShapeAll(compshell, geompy.ShapeType["SHELL"]) subFaceList = geompy.SubShapeAll(compshell, geompy.ShapeType["FACE"]) subEdgeList = geompy.SubShapeAll(compshell, geompy.ShapeType["EDGE"]) -print "number of Shells in compshell : ", len(subShellList) -print "number of Faces in compshell : ", len(subFaceList) -print "number of Edges in compshell : ", len(subEdgeList) +print("number of Shells in compshell : ", len(subShellList)) +print("number of Faces in compshell : ", len(subFaceList)) +print("number of Edges in compshell : ", len(subEdgeList)) status = geompy.CheckShape(compshell) -print " check status ", status +print(" check status ", status) ### ---------------------------- SMESH -------------------------------------- smesh.SetCurrentStudy(salome.myStudy) @@ -59,16 +59,16 @@ mesh = smesh.Mesh(compshell, "MeshcompShell") # ---- set Hypothesis and Algorithm -print "-------------------------- NumberOfSegments" +print("-------------------------- NumberOfSegments") numberOfSegments = 5 regular1D = mesh.Segment() regular1D.SetName("Wire Discretisation") hypNbSeg = regular1D.NumberOfSegments(numberOfSegments) -print hypNbSeg.GetName() -print hypNbSeg.GetId() -print hypNbSeg.GetNumberOfSegments() +print(hypNbSeg.GetName()) +print(hypNbSeg.GetId()) +print(hypNbSeg.GetNumberOfSegments()) smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments)) ## print "-------------------------- MaxElementArea" @@ -83,44 +83,44 @@ smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegments)) ## print hypArea.GetMaxElementArea() ## smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea)) -print "-------------------------- LengthFromEdges" +print("-------------------------- LengthFromEdges") mefisto2D = mesh.Triangle() mefisto2D.SetName("MEFISTO_2D") hypLengthFromEdges = mefisto2D.LengthFromEdges() -print hypLengthFromEdges.GetName() -print hypLengthFromEdges.GetId() +print(hypLengthFromEdges.GetName()) +print(hypLengthFromEdges.GetId()) smesh.SetName(hypLengthFromEdges, "LengthFromEdges") -print "-------------------------- MaxElementVolume" +print("-------------------------- MaxElementVolume") maxElementVolume = 1000 netgen3D = mesh.Tetrahedron(smeshBuilder.NETGEN) netgen3D.SetName("NETGEN_3D") hypVolume = netgen3D.MaxElementVolume(maxElementVolume) -print hypVolume.GetName() -print hypVolume.GetId() -print hypVolume.GetMaxElementVolume() +print(hypVolume.GetName()) +print(hypVolume.GetId()) +print(hypVolume.GetMaxElementVolume()) smesh.SetName(hypVolume, "MaxElementVolume_" + str(maxElementVolume)) -print "-------------------------- compute compshell" +print("-------------------------- compute compshell") ret = mesh.Compute(mesh) -print ret +print(ret) if ret != 0: log = mesh.GetLog(0) # no erase trace for linelog in log: - print linelog - print "Information about the MeshcompShel:" - print "Number of nodes : ", mesh.NbNodes() - print "Number of edges : ", mesh.NbEdges() - print "Number of faces : ", mesh.NbFaces() - print "Number of triangles : ", mesh.NbTriangles() - print "Number of volumes : ", mesh.NbVolumes() - print "Number of tetrahedrons : ", mesh.NbTetras() + print(linelog) + print("Information about the MeshcompShel:") + print("Number of nodes : ", mesh.NbNodes()) + print("Number of edges : ", mesh.NbEdges()) + print("Number of faces : ", mesh.NbFaces()) + print("Number of triangles : ", mesh.NbTriangles()) + print("Number of volumes : ", mesh.NbVolumes()) + print("Number of tetrahedrons : ", mesh.NbTetras()) else: - print "problem when computing the mesh" + print("problem when computing the mesh") salome.sg.updateObjBrowser(True) diff --git a/src/SMESH_SWIG/SMESH_flight_skin.py b/src/SMESH_SWIG/SMESH_flight_skin.py index 44ca46630..144a9fab9 100644 --- a/src/SMESH_SWIG/SMESH_flight_skin.py +++ b/src/SMESH_SWIG/SMESH_flight_skin.py @@ -51,14 +51,14 @@ filename = filePath + filename shape = geompy.Import(filename, "BREP") idShape = geompy.addToStudy(shape, "flight") -print "Analysis of the geometry flight :" +print("Analysis of the geometry flight :") subShellList = geompy.SubShapeAll(shape, geompy.ShapeType["SHELL"]) subFaceList = geompy.SubShapeAll(shape, geompy.ShapeType["FACE"]) subEdgeList = geompy.SubShapeAll(shape, geompy.ShapeType["EDGE"]) -print "number of Shells in flight : ", len(subShellList) -print "number of Faces in flight : ", len(subFaceList) -print "number of Edges in flight : ", len(subEdgeList) +print("number of Shells in flight : ", len(subShellList)) +print("number of Faces in flight : ", len(subFaceList)) +print("number of Edges in flight : ", len(subEdgeList)) ### ---------------------------- SMESH -------------------------------------- @@ -72,39 +72,39 @@ mesh = smesh.Mesh(shape_mesh, "MeshFlight") # ---- set Hypothesis and Algorithm -print "-------------------------- LocalLength" +print("-------------------------- LocalLength") lengthOfSegments = 0.3 regular1D = mesh.Segment() hypLength = regular1D.LocalLength(lengthOfSegments) -print hypLength.GetName() -print hypLength.GetId() -print hypLength.GetLength() +print(hypLength.GetName()) +print(hypLength.GetId()) +print(hypLength.GetLength()) smesh.SetName(hypLength, "LocalLength_" + str(lengthOfSegments)) -print "-------------------------- LengthFromEdges" +print("-------------------------- LengthFromEdges") mefisto2D = mesh.Triangle() hypLengthFromEdge = mefisto2D.LengthFromEdges() -print hypLengthFromEdge.GetName() -print hypLengthFromEdge.GetId() +print(hypLengthFromEdge.GetName()) +print(hypLengthFromEdge.GetId()) smesh.SetName(hypLengthFromEdge,"LengthFromEdge") -print "-------------------------- compute the skin flight" +print("-------------------------- compute the skin flight") ret = mesh.Compute() -print ret +print(ret) if ret != 0: log = mesh.GetLog(0) # no erase trace for linelog in log: - print linelog - print "Information about the Mesh_mechanic_tetra:" - print "Number of nodes : ", mesh.NbNodes() - print "Number of edges : ", mesh.NbEdges() - print "Number of faces : ", mesh.NbFaces() - print "Number of triangles : ", mesh.NbTriangles() - print "Number of volumes : ", mesh.NbVolumes() + print(linelog) + print("Information about the Mesh_mechanic_tetra:") + print("Number of nodes : ", mesh.NbNodes()) + print("Number of edges : ", mesh.NbEdges()) + print("Number of faces : ", mesh.NbFaces()) + print("Number of triangles : ", mesh.NbTriangles()) + print("Number of volumes : ", mesh.NbVolumes()) else: - print "probleme when computing the mesh" + print("probleme when computing the mesh") salome.sg.updateObjBrowser(True) diff --git a/src/SMESH_SWIG/SMESH_freebord.py b/src/SMESH_SWIG/SMESH_freebord.py index 7bd4f3a83..6422701ab 100644 --- a/src/SMESH_SWIG/SMESH_freebord.py +++ b/src/SMESH_SWIG/SMESH_freebord.py @@ -71,8 +71,8 @@ aGroup = mesh.MakeGroupByCriterion("Free edges", aCriterion) anIds = aGroup.GetIDs() # print result -print "Criterion: Free edges Nb = ", len( anIds ) +print("Criterion: Free edges Nb = ", len( anIds )) for i in range( len( anIds ) ): - print anIds[ i ] + print(anIds[ i ]) salome.sg.updateObjBrowser(True) diff --git a/src/SMESH_SWIG/SMESH_hexaedre.py b/src/SMESH_SWIG/SMESH_hexaedre.py index a2dd15b93..0373a57f4 100755 --- a/src/SMESH_SWIG/SMESH_hexaedre.py +++ b/src/SMESH_SWIG/SMESH_hexaedre.py @@ -62,14 +62,14 @@ salome.sg.updateObjBrowser(True) # ----------------------------------------------------------------------------- -print "-------------------------- mesh" +print("-------------------------- mesh") smesh.SetCurrentStudy(salome.myStudy) # ---- define a mesh on the geom shape 'blob' mesh=smesh.Mesh(blob, "MeshBlob") # ---- assign global hypothesis and algorithms to mesh -print "-------------------------- add hypothesis to mesh" +print("-------------------------- add hypothesis to mesh") algo1 = mesh.Segment() algo2 = mesh.Quadrangle() algo3 = mesh.Hexahedron() @@ -85,17 +85,17 @@ for edges in edgeGroups: # loop on groups of logically parallel edges pass # ---- compute mesh -print "-------------------------- compute mesh" +print("-------------------------- compute mesh") ok = mesh.Compute() if ok: - print "Information about the Mesh:" - print "Number of nodes : ", mesh.NbNodes() - print "Number of edges : ", mesh.NbEdges() - print "Number of faces : ", mesh.NbFaces() - print "Number of quadrangles : ", mesh.NbQuadrangles() - print "Number of volumes : ", mesh.NbVolumes() - print "Number of hexahedrons : ", mesh.NbHexas() + print("Information about the Mesh:") + print("Number of nodes : ", mesh.NbNodes()) + print("Number of edges : ", mesh.NbEdges()) + print("Number of faces : ", mesh.NbFaces()) + print("Number of quadrangles : ", mesh.NbQuadrangles()) + print("Number of volumes : ", mesh.NbVolumes()) + print("Number of hexahedrons : ", mesh.NbHexas()) else: - print "problem when Computing the mesh" + print("problem when Computing the mesh") salome.sg.updateObjBrowser(True) diff --git a/src/SMESH_SWIG/SMESH_mechanic.py b/src/SMESH_SWIG/SMESH_mechanic.py index b04453581..f74a37208 100644 --- a/src/SMESH_SWIG/SMESH_mechanic.py +++ b/src/SMESH_SWIG/SMESH_mechanic.py @@ -134,26 +134,26 @@ shape_mesh = salome.IDToObject( Id_mechanic ) mesh = smesh.Mesh(shape_mesh, "Mesh_mechanic") -print "-------------------------- NumberOfSegments" +print("-------------------------- NumberOfSegments") numberOfSegment = 10 algo = mesh.Segment() hypNbSeg = algo.NumberOfSegments(numberOfSegment) -print hypNbSeg.GetName() -print hypNbSeg.GetId() -print hypNbSeg.GetNumberOfSegments() +print(hypNbSeg.GetName()) +print(hypNbSeg.GetId()) +print(hypNbSeg.GetNumberOfSegments()) smesh.SetName(hypNbSeg, "NumberOfSegments_10") -print "-------------------------- MaxElementArea" +print("-------------------------- MaxElementArea") maxElementArea = 25 algo = mesh.Triangle() hypArea25 = algo.MaxElementArea(maxElementArea) -print hypArea25.GetName() -print hypArea25.GetId() -print hypArea25.GetMaxElementArea() +print(hypArea25.GetName()) +print(hypArea25.GetId()) +print(hypArea25.GetMaxElementArea()) smesh.SetName(hypArea25, "MaxElementArea_25") # Create submesh on sub_face1 - sub_face4 @@ -175,17 +175,17 @@ smesh.SetName(algo.GetSubMesh(), "SubMeshFace3") algo = mesh.Quadrangle(sub_face4) smesh.SetName(algo.GetSubMesh(), "SubMeshFace4") -print "-------------------------- compute the mesh of the mechanic piece" +print("-------------------------- compute the mesh of the mechanic piece") mesh.Compute() -print "Information about the Mesh_mechanic:" -print "Number of nodes : ", mesh.NbNodes() -print "Number of edges : ", mesh.NbEdges() -print "Number of faces : ", mesh.NbFaces() -print "Number of triangles : ", mesh.NbTriangles() -print "Number of quadrangles : ", mesh.NbQuadrangles() -print "Number of volumes : ", mesh.NbVolumes() -print "Number of tetrahedrons: ", mesh.NbTetras() +print("Information about the Mesh_mechanic:") +print("Number of nodes : ", mesh.NbNodes()) +print("Number of edges : ", mesh.NbEdges()) +print("Number of faces : ", mesh.NbFaces()) +print("Number of triangles : ", mesh.NbTriangles()) +print("Number of quadrangles : ", mesh.NbQuadrangles()) +print("Number of volumes : ", mesh.NbVolumes()) +print("Number of tetrahedrons: ", mesh.NbTetras()) salome.sg.updateObjBrowser(True) diff --git a/src/SMESH_SWIG/SMESH_mechanic_editor.py b/src/SMESH_SWIG/SMESH_mechanic_editor.py index bb340bc95..739854230 100644 --- a/src/SMESH_SWIG/SMESH_mechanic_editor.py +++ b/src/SMESH_SWIG/SMESH_mechanic_editor.py @@ -131,27 +131,27 @@ shape_mesh = salome.IDToObject( Id_mechanic ) mesh = smesh.Mesh(shape_mesh, "Mesh_mechanic") -print "-------------------------- NumberOfSegments" +print("-------------------------- NumberOfSegments") numberOfSegment = 10 algo = mesh.Segment() hypNbSeg = algo.NumberOfSegments(numberOfSegment) -print hypNbSeg.GetName() -print hypNbSeg.GetId() -print hypNbSeg.GetNumberOfSegments() +print(hypNbSeg.GetName()) +print(hypNbSeg.GetId()) +print(hypNbSeg.GetNumberOfSegments()) smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegment)) -print "-------------------------- MaxElementArea" +print("-------------------------- MaxElementArea") maxElementArea = 25 algo = mesh.Triangle() hypArea25 = algo.MaxElementArea(maxElementArea) -print hypArea25.GetName() -print hypArea25.GetId() -print hypArea25.GetMaxElementArea() +print(hypArea25.GetName()) +print(hypArea25.GetId()) +print(hypArea25.GetMaxElementArea()) smesh.SetName(hypArea25, "MaxElementArea_" + str(maxElementArea)) @@ -179,18 +179,18 @@ smesh.SetName(algo.GetSubMesh(), "SubMeshFace4") submesh4 = algo.GetSubMesh() -print "-------------------------- compute the mesh of the mechanic piece" +print("-------------------------- compute the mesh of the mechanic piece") mesh.Compute() -print "Information about the Mesh_mechanic:" -print "Number of nodes : ", mesh.NbNodes() -print "Number of edges : ", mesh.NbEdges() -print "Number of faces : ", mesh.NbFaces() -print "Number of triangles : ", mesh.NbTriangles() -print "Number of quadrangles : ", mesh.NbQuadrangles() -print "Number of volumes : ", mesh.NbVolumes() -print "Number of tetrahedrons: ", mesh.NbTetras() +print("Information about the Mesh_mechanic:") +print("Number of nodes : ", mesh.NbNodes()) +print("Number of edges : ", mesh.NbEdges()) +print("Number of faces : ", mesh.NbFaces()) +print("Number of triangles : ", mesh.NbTriangles()) +print("Number of quadrangles : ", mesh.NbQuadrangles()) +print("Number of volumes : ", mesh.NbVolumes()) +print("Number of tetrahedrons: ", mesh.NbTetras()) #1 cutting of quadrangles of the 'SubMeshFace2' submesh diff --git a/src/SMESH_SWIG/SMESH_mechanic_netgen.py b/src/SMESH_SWIG/SMESH_mechanic_netgen.py index 326348b7c..388d42e3c 100644 --- a/src/SMESH_SWIG/SMESH_mechanic_netgen.py +++ b/src/SMESH_SWIG/SMESH_mechanic_netgen.py @@ -97,19 +97,19 @@ Id_mechanic = geompy.addToStudy( mechanic, "mechanic" ) # ---- Analysis of the geometry -print "Analysis of the geometry mechanic :" +print("Analysis of the geometry mechanic :") subShellList = geompy.SubShapeAll(mechanic,geompy.ShapeType["SHELL"]) subFaceList = geompy.SubShapeAll(mechanic,geompy.ShapeType["FACE"]) subEdgeList = geompy.SubShapeAll(mechanic,geompy.ShapeType["EDGE"]) -print "number of Shells in mechanic : ",len(subShellList) -print "number of Faces in mechanic : ",len(subFaceList) -print "number of Edges in mechanic : ",len(subEdgeList) +print("number of Shells in mechanic : ",len(subShellList)) +print("number of Faces in mechanic : ",len(subFaceList)) +print("number of Edges in mechanic : ",len(subEdgeList)) ### ---------------------------- SMESH -------------------------------------- -print "-------------------------- create Mesh, algorithm, hypothesis" +print("-------------------------- create Mesh, algorithm, hypothesis") mesh = smesh.Mesh(mechanic, "Mesh_mechanic"); netgen = mesh.Triangle(smeshBuilder.NETGEN) @@ -119,20 +119,20 @@ netgen.SetFineness( smeshBuilder.Fine ) netgen.SetQuadAllowed( 1 ) #netgen.SetOptimize( 1 ) -print "-------------------------- compute mesh" +print("-------------------------- compute mesh") ret = mesh.Compute() -print ret +print(ret) if ret != 0: - print "Information about the MeshcompShel:" - print "Number of nodes : ", mesh.NbNodes() - print "Number of edges : ", mesh.NbEdges() - print "Number of faces : ", mesh.NbFaces() - print "Number of triangles : ", mesh.NbTriangles() - print "Number of quadrangles : ", mesh.NbQuadrangles() - print "Number of volumes : ", mesh.NbVolumes() - print "Number of tetrahedrons : ", mesh.NbTetras() + print("Information about the MeshcompShel:") + print("Number of nodes : ", mesh.NbNodes()) + print("Number of edges : ", mesh.NbEdges()) + print("Number of faces : ", mesh.NbFaces()) + print("Number of triangles : ", mesh.NbTriangles()) + print("Number of quadrangles : ", mesh.NbQuadrangles()) + print("Number of volumes : ", mesh.NbVolumes()) + print("Number of tetrahedrons : ", mesh.NbTetras()) else: - print "problem when computing the mesh" + print("problem when computing the mesh") salome.sg.updateObjBrowser(True) diff --git a/src/SMESH_SWIG/SMESH_mechanic_tetra.py b/src/SMESH_SWIG/SMESH_mechanic_tetra.py index 18925dac7..284da9268 100644 --- a/src/SMESH_SWIG/SMESH_mechanic_tetra.py +++ b/src/SMESH_SWIG/SMESH_mechanic_tetra.py @@ -98,15 +98,15 @@ Id_mechanic = geompy.addToStudy( mechanic, "mechanic" ) # ---- Analysis of the geometry -print "Analysis of the geometry mechanic :" +print("Analysis of the geometry mechanic :") subShellList = geompy.SubShapeAll(mechanic,geompy.ShapeType["SHELL"]) subFaceList = geompy.SubShapeAll(mechanic,geompy.ShapeType["FACE"]) subEdgeList = geompy.SubShapeAll(mechanic,geompy.ShapeType["EDGE"]) -print "number of Shells in mechanic : ",len(subShellList) -print "number of Faces in mechanic : ",len(subFaceList) -print "number of Edges in mechanic : ",len(subEdgeList) +print("number of Shells in mechanic : ",len(subShellList)) +print("number of Faces in mechanic : ",len(subFaceList)) +print("number of Edges in mechanic : ",len(subEdgeList)) ### ---------------------------- SMESH -------------------------------------- @@ -114,15 +114,15 @@ shape_mesh = salome.IDToObject( Id_mechanic ) mesh = smesh.Mesh(shape_mesh, "Mesh_mechanic_tetra") -print "-------------------------- add hypothesis to main mechanic" +print("-------------------------- add hypothesis to main mechanic") numberOfSegment = 10 algo1 = mesh.Segment() hypNbSeg = algo1.NumberOfSegments(numberOfSegment) -print hypNbSeg.GetName() -print hypNbSeg.GetId() -print hypNbSeg.GetNumberOfSegments() +print(hypNbSeg.GetName()) +print(hypNbSeg.GetId()) +print(hypNbSeg.GetNumberOfSegments()) smesh.SetName(hypNbSeg, "NumberOfSegments_" + str(numberOfSegment)) @@ -130,9 +130,9 @@ maxElementArea = 20 algo2 = mesh.Triangle(smeshBuilder.MEFISTO) hypArea = algo2.MaxElementArea(maxElementArea) -print hypArea.GetName() -print hypArea.GetId() -print hypArea.GetMaxElementArea() +print(hypArea.GetName()) +print(hypArea.GetId()) +print(hypArea.GetMaxElementArea()) smesh.SetName(hypArea, "MaxElementArea_" + str(maxElementArea)) @@ -140,22 +140,22 @@ maxElementVolume = 20 algo3 = mesh.Tetrahedron(smeshBuilder.NETGEN) hypVolume = algo3.MaxElementVolume(maxElementVolume) -print hypVolume.GetName() -print hypVolume.GetId() -print hypVolume.GetMaxElementVolume() +print(hypVolume.GetName()) +print(hypVolume.GetId()) +print(hypVolume.GetMaxElementVolume()) smesh.SetName(hypVolume, "maxElementVolume_" + str(maxElementVolume)) -print "-------------------------- compute the mesh of the mechanic piece" +print("-------------------------- compute the mesh of the mechanic piece") mesh.Compute() -print "Information about the Mesh_mechanic_tetra:" -print "Number of nodes : ", mesh.NbNodes() -print "Number of edges : ", mesh.NbEdges() -print "Number of faces : ", mesh.NbFaces() -print "Number of triangles : ", mesh.NbTriangles() -print "Number of quadrangles: ", mesh.NbQuadrangles() -print "Number of volumes : ", mesh.NbVolumes() -print "Number of tetrahedrons: ", mesh.NbTetras() +print("Information about the Mesh_mechanic_tetra:") +print("Number of nodes : ", mesh.NbNodes()) +print("Number of edges : ", mesh.NbEdges()) +print("Number of faces : ", mesh.NbFaces()) +print("Number of triangles : ", mesh.NbTriangles()) +print("Number of quadrangles: ", mesh.NbQuadrangles()) +print("Number of volumes : ", mesh.NbVolumes()) +print("Number of tetrahedrons: ", mesh.NbTetras()) salome.sg.updateObjBrowser(True) diff --git a/src/SMESH_SWIG/SMESH_reg.py b/src/SMESH_SWIG/SMESH_reg.py index 1ce3e6cba..2c5aa2465 100644 --- a/src/SMESH_SWIG/SMESH_reg.py +++ b/src/SMESH_SWIG/SMESH_reg.py @@ -38,26 +38,26 @@ from salome.StdMeshers import StdMeshersBuilder # ---- define a box -print "Define box" +print("Define box") box = geompy.MakeBox(0., 0., 0., 100., 200., 300.) idbox = geompy.addToStudy(box, "box") # ---- add faces of box to study -print "Add faces to study" +print("Add faces to study") idface = [] subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"]) for f in subShapeList: name = geompy.SubShapeName(f, box) - print name + print(name) idface.append( geompy.addToStudyInFather(box, f, name) ) # ---- add edges of box to study -print "Add edges to study" +print("Add edges to study") idedge = [] subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["EDGE"]) for f in subShapeList: name = geompy.SubShapeName(f, box) - print name + print(name) idedge.append( geompy.addToStudyInFather(box, f, name) ) salome.sg.updateObjBrowser(True) @@ -73,7 +73,7 @@ box = salome.IDToObject(idbox) names = [ "MeshBoxReg", "MeshBoxScale", "MeshBoxTable", "MeshBoxExpr" ] -print "-------------------------- Create ", names[0], " mesh" +print("-------------------------- Create ", names[0], " mesh") mesh = smesh.Mesh(box, names[0]) algo = mesh.Segment() hyp = algo.NumberOfSegments(7) @@ -82,7 +82,7 @@ smesh.SetName(hyp, "NumberOfSegmentsReg") algo = mesh.Triangle() algo.MaxElementArea(2500) -print "-------------------------- Create ", names[1], " mesh" +print("-------------------------- Create ", names[1], " mesh") mesh = smesh.Mesh(box, names[1]) algo = mesh.Segment() hyp = algo.NumberOfSegments(7) @@ -92,7 +92,7 @@ smesh.SetName(hyp, "NumberOfSegmentsScale") algo = mesh.Triangle() algo.MaxElementArea(2500) -print "-------------------------- Create ", names[2], " mesh" +print("-------------------------- Create ", names[2], " mesh") mesh = smesh.Mesh(box,names[2]) algo = mesh.Segment() hyp = algo.NumberOfSegments(7) @@ -103,7 +103,7 @@ smesh.SetName(hyp, "NumberOfSegmentsTable") algo = mesh.Triangle() algo.MaxElementArea(2500) -print "-------------------------- Create ", names[3], " mesh" +print("-------------------------- Create ", names[3], " mesh") mesh = smesh.Mesh(box, names[3]) algo = mesh.Segment() hyp = algo.NumberOfSegments(10) diff --git a/src/SMESH_SWIG/SMESH_shared_modules.py b/src/SMESH_SWIG/SMESH_shared_modules.py index e664de617..89e49ce88 100644 --- a/src/SMESH_SWIG/SMESH_shared_modules.py +++ b/src/SMESH_SWIG/SMESH_shared_modules.py @@ -31,7 +31,7 @@ from launchConfigureParser import verbose -if verbose(): print "============== import SMESH =======================" +if verbose(): print("============== import SMESH =======================") import SMESH diff --git a/src/SMESH_SWIG/SMESH_test.py b/src/SMESH_SWIG/SMESH_test.py index 463b77382..0de274585 100644 --- a/src/SMESH_SWIG/SMESH_test.py +++ b/src/SMESH_SWIG/SMESH_test.py @@ -67,45 +67,45 @@ smesh.SetCurrentStudy(salome.myStudy) box = salome.IDToObject(idb) mesh = smesh.Mesh(box, "Meshbox") -print "-------------------------- add hypothesis to box" +print("-------------------------- add hypothesis to box") algo_1 = mesh.Segment(box) hyp = algo_1.LocalLength(100) -print hyp.GetName() -print hyp.GetId() -print hyp.GetLength() +print(hyp.GetName()) +print(hyp.GetId()) +print(hyp.GetLength()) algo_2 = mesh.Triangle(smeshBuilder.MEFISTO, box) hyp = algo_2.MaxElementArea(5000) -print hyp.GetName() -print hyp.GetId() -print hyp.GetMaxElementArea() +print(hyp.GetName()) +print(hyp.GetId()) +print(hyp.GetMaxElementArea()) smesh.SetName(algo_2.GetSubMesh(), "SubMeshBox") -print "-------------------------- add hypothesis to edge" +print("-------------------------- add hypothesis to edge") edge = salome.IDToObject(ide) algo_3 = mesh.Segment(edge) hyp = algo_3.LocalLength(100) -print hyp.GetName() -print hyp.GetId() -print hyp.GetLength() +print(hyp.GetName()) +print(hyp.GetId()) +print(hyp.GetLength()) smesh.SetName(algo_3.GetSubMesh(), "SubMeshEdge") -print "-------------------------- compute face" +print("-------------------------- compute face") face = salome.IDToObject(idf) ret = mesh.Compute(face) -print ret +print(ret) log = mesh.GetLog(0) # 0 - GetLog without ClearLog after, else if 1 - ClearLog after for a in log: - print "-------" + print("-------") ii = 0 ir = 0 comType = a.commandType @@ -119,7 +119,7 @@ for a in log: ir = ir+1 r3 = a.coords[ir] ir = ir+1 - print "AddNode %i - %g %g %g" % (ind, r1, r2, r3) + print("AddNode %i - %g %g %g" % (ind, r1, r2, r3)) elif comType == 1: for i in range(a.number): ind = a.indexes[ii] @@ -128,23 +128,23 @@ for a in log: ii = ii+1 i2 = a.indexes[ii] ii = ii+1 - print "AddEdge %i - %i %i" % (ind, i1, i2) + print("AddEdge %i - %i %i" % (ind, i1, i2)) elif comType == 2: for i in range(a.number): ind = a.indexes[ii] - print ind + print(ind) ii = ii+1 - print ii + print(ii) i1 = a.indexes[ii] ii = ii+1 i2 = a.indexes[ii] - print i2 + print(i2) ii = ii+1 - print "ii", ii + print("ii", ii) i3 = a.indexes[ii] - print i3 + print(i3) #ii = ii+1 ii = ii+1 - print "AddTriangle %i - %i %i %i" % (ind, i1, i2, i3) + print("AddTriangle %i - %i %i %i" % (ind, i1, i2, i3)) salome.sg.updateObjBrowser(True) diff --git a/src/SMESH_SWIG/SMESH_test0.py b/src/SMESH_SWIG/SMESH_test0.py index 23339f35f..bc70c54d9 100644 --- a/src/SMESH_SWIG/SMESH_test0.py +++ b/src/SMESH_SWIG/SMESH_test0.py @@ -44,7 +44,7 @@ idbox = geompy.addToStudy(box, "box") subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"]) face = subShapeList[0] name = geompy.SubShapeName(face, box) -print name +print(name) idface = geompy.addToStudyInFather(box, face, name) # ---- add shell from box in study @@ -52,7 +52,7 @@ idface = geompy.addToStudyInFather(box, face, name) subShellList = geompy.SubShapeAll(box, geompy.ShapeType["SHELL"]) shell = subShellList[0] name = geompy.SubShapeName(shell, box) -print name +print(name) idshell = geompy.addToStudyInFather(box, shell, name) # ---- add first edge of face in study @@ -60,7 +60,7 @@ idshell = geompy.addToStudyInFather(box, shell, name) edgeList = geompy.SubShapeAll(face, geompy.ShapeType["EDGE"]) edge = edgeList[0] name = geompy.SubShapeName(edge, face) -print name +print(name) idedge = geompy.addToStudyInFather(face, edge, name) salome.sg.updateObjBrowser(True) diff --git a/src/SMESH_SWIG/SMESH_test1.py b/src/SMESH_SWIG/SMESH_test1.py index ffc08c680..d9c6f179f 100644 --- a/src/SMESH_SWIG/SMESH_test1.py +++ b/src/SMESH_SWIG/SMESH_test1.py @@ -44,7 +44,7 @@ idbox = geompy.addToStudy(box, "box") subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"]) face = subShapeList[0] name = geompy.SubShapeName(face, box) -print name +print(name) idface = geompy.addToStudyInFather(box, face, name) # ---- add shell from box in study @@ -52,7 +52,7 @@ idface = geompy.addToStudyInFather(box, face, name) subShellList = geompy.SubShapeAll(box, geompy.ShapeType["SHELL"]) shell = subShellList[0] name = geompy.SubShapeName(shell, box) -print name +print(name) idshell = geompy.addToStudyInFather(box, shell, name) # ---- add first edge of face in study @@ -60,7 +60,7 @@ idshell = geompy.addToStudyInFather(box, shell, name) edgeList = geompy.SubShapeAll(face, geompy.ShapeType["EDGE"]) edge = edgeList[0] name = geompy.SubShapeName(edge, face) -print name +print(name) idedge = geompy.addToStudyInFather(face, edge, name) @@ -70,43 +70,43 @@ idedge = geompy.addToStudyInFather(face, edge, name) mesh = smesh.Mesh(box, "Meshbox") -print "-------------------------- add hypothesis to box" +print("-------------------------- add hypothesis to box") algoReg1 = mesh.Segment() hypNbSeg1 = algoReg1.NumberOfSegments(7) -print hypNbSeg1.GetName() -print hypNbSeg1.GetId() -print hypNbSeg1.GetNumberOfSegments() +print(hypNbSeg1.GetName()) +print(hypNbSeg1.GetId()) +print(hypNbSeg1.GetNumberOfSegments()) smesh.SetName(hypNbSeg1, "NumberOfSegments_7") algoMef1 = mesh.Triangle() hypArea1 = algoMef1.MaxElementArea(2500) -print hypArea1.GetName() -print hypArea1.GetId() -print hypArea1.GetMaxElementArea() +print(hypArea1.GetName()) +print(hypArea1.GetId()) +print(hypArea1.GetMaxElementArea()) smesh.SetName(hypArea1, "MaxElementArea_2500") # ---- add hypothesis to edge -print "-------------------------- add hypothesis to edge" +print("-------------------------- add hypothesis to edge") edge = salome.IDToObject(idedge) algoReg2 = mesh.Segment(edge) hypLen1 = algoReg2.LocalLength(100) smesh.SetName(algoReg2.GetSubMesh(), "SubMeshEdge") -print hypLen1.GetName() -print hypLen1.GetId() -print hypLen1.GetLength() +print(hypLen1.GetName()) +print(hypLen1.GetId()) +print(hypLen1.GetLength()) smesh.SetName(hypLen1, "Local_Length_100") # ---- add hypothesis to face -print "-------------------------- add hypothesis to face" +print("-------------------------- add hypothesis to face") face = salome.IDToObject(idface) algoMef2 = mesh.Triangle(face) hypArea2 = algoMef2.MaxElementArea(500) smesh.SetName(algoMef2.GetSubMesh(), "SubMeshFace") -print hypArea2.GetName() -print hypArea2.GetId() -print hypArea2.GetMaxElementArea() +print(hypArea2.GetName()) +print(hypArea2.GetId()) +print(hypArea2.GetMaxElementArea()) smesh.SetName(hypArea2, "MaxElementArea_500") diff --git a/src/SMESH_SWIG/SMESH_test1_AndDisplay.py b/src/SMESH_SWIG/SMESH_test1_AndDisplay.py index 0c510a129..6212075af 100644 --- a/src/SMESH_SWIG/SMESH_test1_AndDisplay.py +++ b/src/SMESH_SWIG/SMESH_test1_AndDisplay.py @@ -44,7 +44,7 @@ idbox = geompy.addToStudy(box, "box") subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"]) face = subShapeList[0] name = geompy.SubShapeName(face, box) -print name +print(name) idface = geompy.addToStudyInFather(box, face, name) # ---- add shell from box in study @@ -52,7 +52,7 @@ idface = geompy.addToStudyInFather(box, face, name) subShellList = geompy.SubShapeAll(box, geompy.ShapeType["SHELL"]) shell = subShellList[0] name = geompy.SubShapeName(shell, box) -print name +print(name) idshell = geompy.addToStudyInFather(box, shell, name) # ---- add first edge of face in study @@ -60,7 +60,7 @@ idshell = geompy.addToStudyInFather(box, shell, name) edgeList = geompy.SubShapeAll(face, geompy.ShapeType["EDGE"]) edge = edgeList[0] name = geompy.SubShapeName(edge, face) -print name +print(name) idedge = geompy.addToStudyInFather(face, edge, name) @@ -70,43 +70,43 @@ idedge = geompy.addToStudyInFather(face, edge, name) mesh = smesh.Mesh(box, "Meshbox") -print "-------------------------- add hypothesis to box" +print("-------------------------- add hypothesis to box") algoReg1 = mesh.Segment() hypNbSeg1 = algoReg1.NumberOfSegments(7) -print hypNbSeg1.GetName() -print hypNbSeg1.GetId() -print hypNbSeg1.GetNumberOfSegments() +print(hypNbSeg1.GetName()) +print(hypNbSeg1.GetId()) +print(hypNbSeg1.GetNumberOfSegments()) smesh.SetName(hypNbSeg1, "NumberOfSegments_7") algoMef1 = mesh.Triangle() hypArea1 = algoMef1.MaxElementArea(2500) -print hypArea1.GetName() -print hypArea1.GetId() -print hypArea1.GetMaxElementArea() +print(hypArea1.GetName()) +print(hypArea1.GetId()) +print(hypArea1.GetMaxElementArea()) smesh.SetName(hypArea1, "MaxElementArea_2500") # ---- add hypothesis to edge -print "-------------------------- add hypothesis to edge" +print("-------------------------- add hypothesis to edge") edge = salome.IDToObject(idedge) algoReg2 = mesh.Segment(edge) hypLen1 = algoReg2.LocalLength(100) smesh.SetName(algoReg2.GetSubMesh(), "SubMeshEdge") -print hypLen1.GetName() -print hypLen1.GetId() -print hypLen1.GetLength() +print(hypLen1.GetName()) +print(hypLen1.GetId()) +print(hypLen1.GetLength()) smesh.SetName(hypLen1, "Local_Length_100") # ---- add hypothesis to face -print "-------------------------- add hypothesis to face" +print("-------------------------- add hypothesis to face") face = salome.IDToObject(idface) algoMef2 = mesh.Triangle(face) hypArea2 = algoMef2.MaxElementArea(500) smesh.SetName(algoMef2.GetSubMesh(), "SubMeshFace") -print hypArea2.GetName() -print hypArea2.GetId() -print hypArea2.GetMaxElementArea() +print(hypArea2.GetName()) +print(hypArea2.GetId()) +print(hypArea2.GetMaxElementArea()) smesh.SetName(hypArea2, "MaxElementArea_500") mesh.Compute() diff --git a/src/SMESH_SWIG/SMESH_test2.py b/src/SMESH_SWIG/SMESH_test2.py index c7dc5b14a..67793b8b7 100644 --- a/src/SMESH_SWIG/SMESH_test2.py +++ b/src/SMESH_SWIG/SMESH_test2.py @@ -24,15 +24,15 @@ # File : SMESH_test2.py # Module : SMESH # -from SMESH_test1 import * +from .SMESH_test1 import * # ---- compute box -print "-------------------------- compute box" +print("-------------------------- compute box") ret = mesh.Compute() -print ret +print(ret) log = mesh.GetLog(0); # no erase trace for linelog in log: - print linelog + print(linelog) salome.sg.updateObjBrowser(True) diff --git a/src/SMESH_SWIG/SMESH_test4.py b/src/SMESH_SWIG/SMESH_test4.py index 6467319a6..d1d6ce701 100755 --- a/src/SMESH_SWIG/SMESH_test4.py +++ b/src/SMESH_SWIG/SMESH_test4.py @@ -71,7 +71,7 @@ mesh.Compute() faces = submesh.GetElementsByType(SMESH.FACE) if len(faces) > 1: - print len(faces), len(faces)/2 + print(len(faces), len(faces)/2) group1 = mesh.CreateEmptyGroup(SMESH.FACE,"Group of faces") group2 = mesh.CreateEmptyGroup(SMESH.FACE,"Another group of faces") group1.Add(faces[:int(len(faces)/2)]) diff --git a/src/SMESH_SWIG/SMESH_test5.py b/src/SMESH_SWIG/SMESH_test5.py index 0464598cc..2b8dcaaa4 100644 --- a/src/SMESH_SWIG/SMESH_test5.py +++ b/src/SMESH_SWIG/SMESH_test5.py @@ -48,36 +48,36 @@ def SetSObjName(theSObj,theName) : def ConvertMED2UNV(thePath,theFile) : anInitFileName = thePath + theFile aMeshes,aResult = smesh.CreateMeshesFromMED(anInitFileName) - print aResult, aMeshes + print(aResult, aMeshes) for iMesh in range(len(aMeshes)) : aMesh = aMeshes[iMesh] - print aMesh.GetName(), + print(aMesh.GetName(), end=' ') aFileName = anInitFileName aFileName = os.path.basename(aFileName) aMesh.SetName(aFileName) - print aMesh.GetName() + print(aMesh.GetName()) aOutPath = '/tmp/' aFileName = aOutPath + theFile + "." + str(iMesh) + ".unv" aMesh.ExportUNV(aFileName) aMesh = smesh.CreateMeshesFromUNV(aFileName) - print aMesh.GetName(), + print(aMesh.GetName(), end=' ') os.remove(aFileName) aFileName = os.path.basename(aFileName) aMesh.SetName(aFileName) - print aMesh.GetName() + print(aMesh.GetName()) aPath = os.getenv('DATA_DIR') + '/MedFiles/' aListDir = os.listdir(aPath) -print aListDir +print(aListDir) for iFile in range(len(aListDir)) : aFileName = aListDir[iFile] aName,anExt = os.path.splitext(aFileName) if anExt == ".med" : aFileName = os.path.basename(aFileName) - print aFileName + print(aFileName) ConvertMED2UNV(aPath,aFileName) #break diff --git a/src/SMESH_SWIG/StdMeshersBuilder.py b/src/SMESH_SWIG/StdMeshersBuilder.py index 4fef40fab..73af7d5ae 100644 --- a/src/SMESH_SWIG/StdMeshersBuilder.py +++ b/src/SMESH_SWIG/StdMeshersBuilder.py @@ -369,7 +369,7 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm): def LengthNearVertex(self, length, vertex=0, UseExisting=0): import types store_geom = self.geom - if type(vertex) is types.IntType: + if type(vertex) is int: if vertex == 0 or vertex == 1: from salome.geom import geomBuilder vertex = self.mesh.geompyD.ExtractShapes(self.geom, geomBuilder.geomBuilder.ShapeType["VERTEX"],True)[vertex] @@ -382,7 +382,7 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm): # 0D algorithm if self.geom is None: self.geom = store_geom - raise RuntimeError, "Attempt to create SegmentAroundVertex_0D algorithm on None shape" + raise RuntimeError("Attempt to create SegmentAroundVertex_0D algorithm on None shape") from salome.smesh.smeshBuilder import AssureGeomPublished, GetName, TreatHypoStatus AssureGeomPublished( self.mesh, self.geom ) name = GetName(self.geom) @@ -979,7 +979,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm): ## Return 3D hypothesis holding the 1D one def Get3DHypothesis(self): if self.algoType != "RadialPrism_3D": - print "Prism_3D algorith doesn't support any hyposesis" + print("Prism_3D algorith doesn't support any hyposesis") return None return self.distribHyp @@ -987,7 +987,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm): # hypothesis. Returns the created hypothesis def OwnHypothesis(self, hypType, args=[], so="libStdMeshersEngine.so"): if self.algoType != "RadialPrism_3D": - print "Prism_3D algorith doesn't support any hyposesis" + print("Prism_3D algorith doesn't support any hyposesis") return None if not self.nbLayers is None: self.mesh.GetMesh().RemoveHypothesis( self.geom, self.nbLayers ) @@ -1008,7 +1008,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm): # the same parameters, else (default) - creates a new one def NumberOfLayers(self, n, UseExisting=0): if self.algoType != "RadialPrism_3D": - print "Prism_3D algorith doesn't support any hyposesis" + print("Prism_3D algorith doesn't support any hyposesis") return None self.mesh.RemoveHypothesis( self.distribHyp, self.geom ) from salome.smesh.smeshBuilder import IsEqual @@ -1024,7 +1024,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm): # @param p the precision of rounding def LocalLength(self, l, p=1e-07): if self.algoType != "RadialPrism_3D": - print "Prism_3D algorith doesn't support any hyposesis" + print("Prism_3D algorith doesn't support any hyposesis") return None hyp = self.OwnHypothesis("LocalLength", [l,p]) hyp.SetLength(l) @@ -1037,7 +1037,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm): # @param s the scale factor (optional) def NumberOfSegments(self, n, s=[]): if self.algoType != "RadialPrism_3D": - print "Prism_3D algorith doesn't support any hyposesis" + print("Prism_3D algorith doesn't support any hyposesis") return None if not s: hyp = self.OwnHypothesis("NumberOfSegments", [n]) @@ -1054,7 +1054,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm): # @param end the length of the last segment def Arithmetic1D(self, start, end ): if self.algoType != "RadialPrism_3D": - print "Prism_3D algorith doesn't support any hyposesis" + print("Prism_3D algorith doesn't support any hyposesis") return None hyp = self.OwnHypothesis("Arithmetic1D", [start, end]) hyp.SetLength(start, 1) @@ -1068,7 +1068,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm): # @param ratio the common ratio of the geometric progression def GeometricProgression(self, start, ratio ): if self.algoType != "RadialPrism_3D": - print "Prism_3D algorith doesn't support any hyposesis" + print("Prism_3D algorith doesn't support any hyposesis") return None hyp = self.OwnHypothesis("GeometricProgression", [start, ratio]) hyp.SetStartLength( start ) @@ -1081,7 +1081,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm): # @param end for the length of the last segment def StartEndLength(self, start, end): if self.algoType != "RadialPrism_3D": - print "Prism_3D algorith doesn't support any hyposesis" + print("Prism_3D algorith doesn't support any hyposesis") return None hyp = self.OwnHypothesis("StartEndLength", [start, end]) hyp.SetLength(start, 1) @@ -1093,7 +1093,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm): # @param fineness defines the quality of the mesh within the range [0-1] def AutomaticLength(self, fineness=0): if self.algoType != "RadialPrism_3D": - print "Prism_3D algorith doesn't support any hyposesis" + print("Prism_3D algorith doesn't support any hyposesis") return None hyp = self.OwnHypothesis("AutomaticLength") hyp.SetFineness( fineness ) @@ -1489,7 +1489,7 @@ class StdMeshersBuilder_Cartesian_3D(Mesh_Algorithm): self.mesh.AddHypothesis( self.hyp, self.geom ) for axis, gridDef in enumerate( [xGridDef, yGridDef, zGridDef] ): - if not gridDef: raise ValueError, "Empty grid definition" + if not gridDef: raise ValueError("Empty grid definition") if isinstance( gridDef, str ): self.hyp.SetGridSpacing( [gridDef], [], axis ) elif isinstance( gridDef[0], str ): diff --git a/src/SMESH_SWIG/batchmode_mefisto.py b/src/SMESH_SWIG/batchmode_mefisto.py index baf57efa9..6989529fb 100644 --- a/src/SMESH_SWIG/batchmode_mefisto.py +++ b/src/SMESH_SWIG/batchmode_mefisto.py @@ -26,7 +26,7 @@ import re import batchmode_salome import batchmode_geompy -import batchmode_smesh +from . import batchmode_smesh from salome.StdMeshers import StdMeshersBuilder smesh = batchmode_smesh.smesh @@ -35,15 +35,15 @@ smesh.SetCurrentStudy(batchmode_salome.myStudy) def CreateMesh (theFileName, area, len = None, nbseg = None): if not(os.path.isfile(theFileName)) or re.search("\.brep$", theFileName) is None : - print "Incorrect file name !" + print("Incorrect file name !") return if (len is None) and (nbseg is None): - print "Define length or number of segments !" + print("Define length or number of segments !") return if (len is not None) and (nbseg is not None): - print "Only one Hypothesis (from length and number of segments) can be defined !" + print("Only one Hypothesis (from length and number of segments) can be defined !") return @@ -53,75 +53,75 @@ def CreateMesh (theFileName, area, len = None, nbseg = None): # ---- SMESH - print "-------------------------- create mesh" + print("-------------------------- create mesh") mesh = smesh.Mesh(shape_mesh) - print "-------------------------- create Hypothesis" + print("-------------------------- create Hypothesis") if (len is not None): - print "-------------------------- LocalLength" + print("-------------------------- LocalLength") algoReg = mesh.Segment() hypLength1 = algoReg.LocalLength(len) - print "Hypothesis type : ", hypLength1.GetName() - print "Hypothesis ID : ", hypLength1.GetId() - print "Hypothesis Value: ", hypLength1.GetLength() + print("Hypothesis type : ", hypLength1.GetName()) + print("Hypothesis ID : ", hypLength1.GetId()) + print("Hypothesis Value: ", hypLength1.GetLength()) if (nbseg is not None): - print "-------------------------- NumberOfSegments" + print("-------------------------- NumberOfSegments") algoReg = mesh.Segment() hypNbSeg1 = algoReg.NumberOfSegments(nbseg) - print "Hypothesis type : ", hypNbSeg1.GetName() - print "Hypothesis ID : ", hypNbSeg1.GetId() - print "Hypothesis Value: ", hypNbSeg1.GetNumberOfSegments() + print("Hypothesis type : ", hypNbSeg1.GetName()) + print("Hypothesis ID : ", hypNbSeg1.GetId()) + print("Hypothesis Value: ", hypNbSeg1.GetNumberOfSegments()) if (area == "LengthFromEdges"): - print "-------------------------- LengthFromEdges" + print("-------------------------- LengthFromEdges") algoMef = mesh.Triangle() hypLengthFromEdges = algoMef.LengthFromEdges(1) - print "Hypothesis type : ", hypLengthFromEdges.GetName() - print "Hypothesis ID : ", hypLengthFromEdges.GetId() - print "LengthFromEdges Mode: ", hypLengthFromEdges.GetMode() + print("Hypothesis type : ", hypLengthFromEdges.GetName()) + print("Hypothesis ID : ", hypLengthFromEdges.GetId()) + print("LengthFromEdges Mode: ", hypLengthFromEdges.GetMode()) else: - print "-------------------------- MaxElementArea" + print("-------------------------- MaxElementArea") algoMef = mesh.Triangle() hypArea1 = algoMef.MaxElementArea(area) - print "Hypothesis type : ", hypArea1.GetName() - print "Hypothesis ID : ", hypArea1.GetId() - print "Hypothesis Value: ", hypArea1.GetMaxElementArea() + print("Hypothesis type : ", hypArea1.GetName()) + print("Hypothesis ID : ", hypArea1.GetId()) + print("Hypothesis Value: ", hypArea1.GetMaxElementArea()) - print "-------------------------- Regular_1D" + print("-------------------------- Regular_1D") listHyp = algoReg.GetCompatibleHypothesis() for hyp in listHyp: - print hyp + print(hyp) - print "Algo name: ", algoReg.GetName() - print "Algo ID : ", algoReg.GetId() + print("Algo name: ", algoReg.GetName()) + print("Algo ID : ", algoReg.GetId()) - print "-------------------------- MEFISTO_2D" + print("-------------------------- MEFISTO_2D") listHyp = algoMef.GetCompatibleHypothesis() for hyp in listHyp: - print hyp + print(hyp) - print "Algo name: ", algoMef.GetName() - print "Algo ID : ", algoMef.GetId() + print("Algo name: ", algoMef.GetName()) + print("Algo ID : ", algoMef.GetId()) # ---- add hypothesis to shape - print "-------------------------- compute mesh" + print("-------------------------- compute mesh") ret = mesh.Compute() - print "Compute Mesh .... ", - print ret + print("Compute Mesh .... ", end=' ') + print(ret) log = mesh.GetLog(0); # no erase trace #for linelog in log: # print linelog - print "------------ INFORMATION ABOUT MESH ------------" + print("------------ INFORMATION ABOUT MESH ------------") - print "Number of nodes : ", mesh.NbNodes() - print "Number of edges : ", mesh.NbEdges() - print "Number of faces : ", mesh.NbFaces() - print "Number of triangles: ", mesh.NbTriangles() + print("Number of nodes : ", mesh.NbNodes()) + print("Number of edges : ", mesh.NbEdges()) + print("Number of faces : ", mesh.NbFaces()) + print("Number of triangles: ", mesh.NbTriangles()) return mesh diff --git a/src/SMESH_SWIG/batchmode_smesh.py b/src/SMESH_SWIG/batchmode_smesh.py index a78f922ca..28a25a251 100644 --- a/src/SMESH_SWIG/batchmode_smesh.py +++ b/src/SMESH_SWIG/batchmode_smesh.py @@ -38,7 +38,7 @@ smesh.SetCurrentStudy(myStudy) myStudyBuilder = myStudy.NewBuilder() if myStudyBuilder is None: - raise RuntimeError, " Null myStudyBuilder" + raise RuntimeError(" Null myStudyBuilder") father = myStudy.FindComponent("SMESH") if father is None: diff --git a/src/SMESH_SWIG/ex00_all.py b/src/SMESH_SWIG/ex00_all.py index 817552834..c1256b304 100644 --- a/src/SMESH_SWIG/ex00_all.py +++ b/src/SMESH_SWIG/ex00_all.py @@ -25,22 +25,22 @@ # Load all examples # ----------------- # -import ex01_cube2build -import ex02_cube2primitive -import ex03_cube2partition -import ex04_cube5tetraHexa -import ex05_hole1build -import ex06_hole1boolean -import ex07_hole1partition -import ex08_hole2build -import ex09_grid4build -import ex10_grid4geometry -import ex11_grid3partition -import ex12_grid17partition -import ex13_hole1partial -import ex14_cyl1holed -import ex15_cyl2geometry -import ex16_cyl2complementary -import ex17_dome1 -import ex18_dome2 -import ex19_sphereINcube +from . import ex01_cube2build +from . import ex02_cube2primitive +from . import ex03_cube2partition +from . import ex04_cube5tetraHexa +from . import ex05_hole1build +from . import ex06_hole1boolean +from . import ex07_hole1partition +from . import ex08_hole2build +from . import ex09_grid4build +from . import ex10_grid4geometry +from . import ex11_grid3partition +from . import ex12_grid17partition +from . import ex13_hole1partial +from . import ex14_cyl1holed +from . import ex15_cyl2geometry +from . import ex16_cyl2complementary +from . import ex17_dome1 +from . import ex18_dome2 +from . import ex19_sphereINcube diff --git a/src/SMESH_SWIG/ex29_refine.py b/src/SMESH_SWIG/ex29_refine.py index 938d0eac1..1848af2fc 100644 --- a/src/SMESH_SWIG/ex29_refine.py +++ b/src/SMESH_SWIG/ex29_refine.py @@ -202,7 +202,7 @@ MyMesh.ExportMED(path+"110_triangles_2.med", 0) SplitTrianglesIn4(MyMesh) NbCells2 = NbCells1*4 -print("Mesh with "+str(NbCells2)+" cells computed.") +print(("Mesh with "+str(NbCells2)+" cells computed.")) MyMesh.ExportMED(path+str(NbCells2)+"_triangles.med", 0) @@ -212,7 +212,7 @@ MyMesh.ExportMED(path+str(NbCells2)+"_triangles.med", 0) SplitTrianglesIn4(MyMesh) NbCells3 = NbCells2*4 -print("Mesh with "+str(NbCells3)+" cells computed.") +print(("Mesh with "+str(NbCells3)+" cells computed.")) MyMesh.ExportMED(path+str(NbCells3)+"_triangles.med",0) @@ -222,7 +222,7 @@ MyMesh.ExportMED(path+str(NbCells3)+"_triangles.med",0) SplitTrianglesIn4(MyMesh) NbCells4 = NbCells3*4 -print("Mesh with "+str(NbCells4)+" cells computed.") +print(("Mesh with "+str(NbCells4)+" cells computed.")) MyMesh.ExportMED(path+str(NbCells4)+"_triangles.med", 0) diff --git a/src/SMESH_SWIG/ex30_tepal.py b/src/SMESH_SWIG/ex30_tepal.py index cd8e7bdc1..699df1640 100644 --- a/src/SMESH_SWIG/ex30_tepal.py +++ b/src/SMESH_SWIG/ex30_tepal.py @@ -87,9 +87,9 @@ status = m.Compute() # ---------- if os.access(results+".xml", os.F_OK): - print "Ok: tepal" + print("Ok: tepal") else: - print "KO: tepal" + print("KO: tepal") # Update object browser # --------------------- diff --git a/src/SMESH_SWIG/ex31_dimGroup.py b/src/SMESH_SWIG/ex31_dimGroup.py index 1643ae99a..b1777f511 100755 --- a/src/SMESH_SWIG/ex31_dimGroup.py +++ b/src/SMESH_SWIG/ex31_dimGroup.py @@ -45,12 +45,12 @@ isDone = Mesh_1.Compute() ### CreateDimGroup() -aListOf3d_1=range(721,821) +aListOf3d_1=list(range(721,821)) aGrp3D_1=Mesh_1.GetMesh().CreateGroup( SMESH.VOLUME, "Src 3D 1" ) aGrp3D_1.Add( aListOf3d_1 ) -aListOf3d_2=range(821, 921) +aListOf3d_2=list(range(821, 921)) aGrp3D_2=Mesh_1.GetMesh().CreateGroup( SMESH.VOLUME, "Src 3D 2" ) aGrp3D_2.Add( aListOf3d_2 ) diff --git a/src/SMESH_SWIG/smesh.py b/src/SMESH_SWIG/smesh.py index d2ae49598..cf4e911be 100644 --- a/src/SMESH_SWIG/smesh.py +++ b/src/SMESH_SWIG/smesh.py @@ -44,7 +44,7 @@ try: engineSmesh = salome.lcc.FindOrLoadComponent( "FactoryServer", "SMESH" ) smesh = smeshBuilder.New(salome.myStudy, engineSmesh) except: - print "exception in smesh.py: instance creation failed" + print("exception in smesh.py: instance creation failed") smesh = None pass @@ -58,9 +58,9 @@ for pluginName in os.environ[ "SMESH_MeshersList" ].split( ":" ): pluginBuilderName = pluginName + "Builder" try: exec( "from salome.%s.%s import *" % (pluginName, pluginBuilderName)) - except Exception, e: + except Exception as e: from salome_utils import verbose - if verbose(): print "Exception while loading %s: %s" % ( pluginBuilderName, e ) + if verbose(): print("Exception while loading %s: %s" % ( pluginBuilderName, e )) continue exec( "from salome.%s import %s" % (pluginName, pluginBuilderName)) plugin = eval( pluginBuilderName ) @@ -87,7 +87,7 @@ if smesh: del k pass -print """ +print(""" =============================================================================== WARNING: Usage of smesh.py is deprecated in SALOME V7.2! @@ -119,4 +119,4 @@ The smesh.py module works correctly only in the first created study. It does not work in the second, third, etc studies! =============================================================================== -""" +""") diff --git a/src/SMESH_SWIG/smeshBuilder.py b/src/SMESH_SWIG/smeshBuilder.py index d36fb09ba..62b98a816 100644 --- a/src/SMESH_SWIG/smeshBuilder.py +++ b/src/SMESH_SWIG/smeshBuilder.py @@ -90,6 +90,7 @@ from salome.smesh.smesh_algorithm import Mesh_Algorithm import SALOME import SALOMEDS import os +import collections ## Private class used to workaround a problem that sometimes isinstance(m, Mesh) returns False # @@ -123,7 +124,7 @@ def ParseParameters(*args): Parameters = "" hasVariables = False varModifFun=None - if args and callable( args[-1] ): + if args and isinstance( args[-1], collections.Callable): args, varModifFun = args[:-1], args[-1] for parameter in args: @@ -132,7 +133,7 @@ def ParseParameters(*args): if isinstance(parameter,str): # check if there is an inexistent variable name if not notebook.isVariable(parameter): - raise ValueError, "Variable with name '" + parameter + "' doesn't exist!!!" + raise ValueError("Variable with name '" + parameter + "' doesn't exist!!!") parameter = notebook.get(parameter) hasVariables = True if varModifFun: @@ -162,8 +163,7 @@ SMESH.PointStruct.__init__ = __initPointStruct # Parameters are stored in AxisStruct.parameters attribute def __initAxisStruct(ax,*args): if len( args ) != 6: - raise RuntimeError,\ - "Bad nb args (%s) passed in SMESH.AxisStruct(x,y,z,dx,dy,dz)"%(len( args )) + raise RuntimeError("Bad nb args (%s) passed in SMESH.AxisStruct(x,y,z,dx,dy,dz)"%(len( args ))) ax.x, ax.y, ax.z, ax.vx, ax.vy, ax.vz, ax.parameters,hasVars = ParseParameters(*args) pass SMESH.AxisStruct.__init__ = __initAxisStruct @@ -208,7 +208,7 @@ def GetName(obj): # unknown non-CORBA object, having GetName() method return obj.GetName() pass - raise RuntimeError, "Null or invalid object" + raise RuntimeError("Null or invalid object") ## Print error message if a hypothesis was not assigned. def TreatHypoStatus(status, hypName, geomName, isAlgo, mesh): @@ -255,11 +255,11 @@ def TreatHypoStatus(status, hypName, geomName, isAlgo, mesh): if meshName and meshName != NO_NAME: where = '"%s" shape in "%s" mesh ' % ( geomName, meshName ) if status < HYP_UNKNOWN_FATAL and where: - print '"%s" was assigned to %s but %s' %( hypName, where, reason ) + print('"%s" was assigned to %s but %s' %( hypName, where, reason )) elif where: - print '"%s" was not assigned to %s : %s' %( hypName, where, reason ) + print('"%s" was not assigned to %s : %s' %( hypName, where, reason )) else: - print '"%s" was not assigned : %s' %( hypName, reason ) + print('"%s" was not assigned : %s' %( hypName, reason )) pass ## Private method. Add geom (sub-shape of the main shape) into the study if not yet there @@ -286,7 +286,7 @@ def AssureGeomPublished(mesh, geom, name=''): def FirstVertexOnCurve(mesh, edge): vv = mesh.geompyD.SubShapeAll( edge, geomBuilder.geomBuilder.ShapeType["VERTEX"]) if not vv: - raise TypeError, "Given object has no vertices" + raise TypeError("Given object has no vertices") if len( vv ) == 1: return vv[0] v0 = mesh.geompyD.MakeVertexOnCurve(edge,0.) xyz = mesh.geompyD.PointCoordinates( v0 ) # coords of the first vertex @@ -328,7 +328,7 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen): PrecisionConfusion = smeshPrecisionConfusion # TopAbs_State enumeration - [TopAbs_IN, TopAbs_OUT, TopAbs_ON, TopAbs_UNKNOWN] = range(4) + [TopAbs_IN, TopAbs_OUT, TopAbs_ON, TopAbs_UNKNOWN] = list(range(4)) # Methods of splitting a hexahedron into tetrahedra Hex_5Tet, Hex_6Tet, Hex_24Tet, Hex_2Prisms, Hex_4Prisms = 1, 2, 3, 1, 2 @@ -433,7 +433,7 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen): elif isinstance(c, str): val = c else: - raise ValueError, "Color value should be of string or SALOMEDS.Color type" + raise ValueError("Color value should be of string or SALOMEDS.Color type") return val ## Get PointStruct from vertex @@ -451,7 +451,7 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen): def GetDirStruct(self,theVector): vertices = self.geompyD.SubShapeAll( theVector, geomBuilder.geomBuilder.ShapeType["VERTEX"] ) if(len(vertices) != 2): - print "Error: vector object is incorrect." + print("Error: vector object is incorrect.") return None p1 = self.geompyD.PointCoordinates(vertices[0]) p2 = self.geompyD.PointCoordinates(vertices[1]) @@ -601,7 +601,7 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen): aSmeshMesh, error = SMESH._objref_SMESH_Gen.CreateMeshesFromGMF(self, theFileName, True) - if error.comment: print "*** CreateMeshesFromGMF() errors:\n", error.comment + if error.comment: print("*** CreateMeshesFromGMF() errors:\n", error.comment) return Mesh(self, self.geompyD, aSmeshMesh), error ## Concatenate the given meshes into one mesh. All groups of input meshes will be @@ -713,7 +713,7 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen): BinaryOp=FT_Undefined, Tolerance=1e-07): if not CritType in SMESH.FunctorType._items: - raise TypeError, "CritType should be of SMESH.FunctorType" + raise TypeError("CritType should be of SMESH.FunctorType") aCriterion = self.GetEmptyCriterion() aCriterion.TypeOfElement = elementType aCriterion.Type = self.EnumToLong(CritType) @@ -748,7 +748,7 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen): elif isinstance( aThreshold, str ): aCriterion.ThresholdStr = aThreshold else: - raise TypeError, "The Threshold should be a shape." + raise TypeError("The Threshold should be a shape.") if isinstance(UnaryOp,float): aCriterion.Tolerance = UnaryOp UnaryOp = FT_Undefined @@ -757,7 +757,7 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen): # Check that Threshold is a group if isinstance(aThreshold, SMESH._objref_SMESH_GroupBase): if aThreshold.GetType() != elementType: - raise ValueError, "Group type mismatches Element type" + raise ValueError("Group type mismatches Element type") aCriterion.ThresholdStr = aThreshold.GetName() aCriterion.ThresholdID = salome.orb.object_to_string( aThreshold ) study = self.GetCurrentStudy() @@ -768,13 +768,13 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen): if entry: aCriterion.ThresholdID = entry else: - raise TypeError, "The Threshold should be a Mesh Group" + raise TypeError("The Threshold should be a Mesh Group") elif CritType == FT_RangeOfIds: # Check that Threshold is string if isinstance(aThreshold, str): aCriterion.ThresholdStr = aThreshold else: - raise TypeError, "The Threshold should be a string." + raise TypeError("The Threshold should be a string.") elif CritType == FT_CoplanarFaces: # Check the Threshold if isinstance(aThreshold, int): @@ -782,11 +782,10 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen): elif isinstance(aThreshold, str): ID = int(aThreshold) if ID < 1: - raise ValueError, "Invalid ID of mesh face: '%s'"%aThreshold + raise ValueError("Invalid ID of mesh face: '%s'"%aThreshold) aCriterion.ThresholdID = aThreshold else: - raise TypeError,\ - "The Threshold should be an ID of mesh face and not '%s'"%aThreshold + raise TypeError("The Threshold should be an ID of mesh face and not '%s'"%aThreshold) elif CritType == FT_ConnectedElements: # Check the Threshold if isinstance(aThreshold, geomBuilder.GEOM._objref_GEOM_Object): # shape @@ -800,7 +799,7 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen): aCriterion.Threshold = aThreshold elif isinstance(aThreshold, list): # 3 point coordinates if len( aThreshold ) < 3: - raise ValueError, "too few point coordinates, must be 3" + raise ValueError("too few point coordinates, must be 3") aCriterion.ThresholdStr = " ".join( [str(c) for c in aThreshold[:3]] ) elif isinstance(aThreshold, str): if aThreshold.isdigit(): @@ -808,9 +807,8 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen): else: aCriterion.ThresholdStr = aThreshold # hope that it's point coordinates else: - raise TypeError,\ - "The Threshold should either a VERTEX, or a node ID, "\ - "or a list of point coordinates and not '%s'"%aThreshold + raise TypeError("The Threshold should either a VERTEX, or a node ID, "\ + "or a list of point coordinates and not '%s'"%aThreshold) elif CritType == FT_ElemGeomType: # Check the Threshold try: @@ -820,7 +818,7 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen): if isinstance(aThreshold, int): aCriterion.Threshold = aThreshold else: - raise TypeError, "The Threshold should be an integer or SMESH.GeometryType." + raise TypeError("The Threshold should be an integer or SMESH.GeometryType.") pass pass elif CritType == FT_EntityType: @@ -832,7 +830,7 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen): if isinstance(aThreshold, int): aCriterion.Threshold = aThreshold else: - raise TypeError, "The Threshold should be an integer or SMESH.EntityType." + raise TypeError("The Threshold should be an integer or SMESH.EntityType.") pass pass @@ -841,7 +839,7 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen): try: aCriterion.ThresholdStr = self.ColorToString(aThreshold) except: - raise TypeError, "The threshold value should be of SALOMEDS.Color type" + raise TypeError("The threshold value should be of SALOMEDS.Color type") pass elif CritType in [FT_FreeBorders, FT_FreeEdges, FT_FreeNodes, FT_FreeFaces, FT_LinearOrQuadratic, FT_BadOrientedVolume, @@ -859,7 +857,7 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen): aThreshold = float(aThreshold) aCriterion.Threshold = aThreshold except: - raise TypeError, "The Threshold should be a number." + raise TypeError("The Threshold should be a number.") return None if Threshold == FT_LogicalNOT or UnaryOp == FT_LogicalNOT: @@ -971,7 +969,7 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen): elif theCriterion == FT_BallDiameter: functor = aFilterMgr.CreateBallDiameter() else: - print "Error: given parameter is not numerical functor type." + print("Error: given parameter is not numerical functor type.") aFilterMgr.UnRegister() return functor @@ -991,7 +989,7 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen): if not meth_name.startswith("Get") and \ not meth_name in dir ( SMESH._objref_SMESH_Hypothesis ): method = getattr ( hyp.__class__, meth_name ) - if callable(method): + if isinstance(method, collections.Callable): setattr( hyp, meth_name, hypMethodWrapper( hyp, method )) return hyp @@ -1210,9 +1208,7 @@ def New( study, instance=None): # It also has methods to define groups of mesh elements, to modify a mesh (by addition of # new nodes and elements and by changing the existing entities), to get information # about a mesh and to export a mesh in different formats. -class Mesh: - __metaclass__ = MeshMeta - +class Mesh(metaclass=MeshMeta): geom = 0 mesh = 0 editor = 0 @@ -1434,12 +1430,12 @@ class Mesh: if discardModifs and self.mesh.HasModificationsToDiscard(): # issue 0020693 self.mesh.Clear() ok = self.smeshpyD.Compute(self.mesh, geom) - except SALOME.SALOME_Exception, ex: - print "Mesh computation failed, exception caught:" - print " ", ex.details.text + except SALOME.SALOME_Exception as ex: + print("Mesh computation failed, exception caught:") + print(" ", ex.details.text) except: import traceback - print "Mesh computation failed, exception caught:" + print("Mesh computation failed, exception caught:") traceback.print_exc() if True:#not ok: allReasons = "" @@ -1516,8 +1512,8 @@ class Mesh: else: msg += " has not been computed" if allReasons != "": msg += ":" else: msg += "." - print msg - print allReasons + print(msg) + print(allReasons) pass if salome.sg.hasDesktop() and self.mesh.GetStudyId() >= 0: if not isinstance( refresh, list): # not a call from subMesh.Compute() @@ -1600,7 +1596,7 @@ class Mesh: pass groups = [] - for algoName, shapes in algo2shapes.items(): + for algoName, shapes in list(algo2shapes.items()): while shapes: groupType = self.smeshpyD.EnumToLong( shapes[0].GetShapeType() ) otherTypeShapes = [] @@ -1768,7 +1764,7 @@ class Mesh: return self.mesh.RemoveHypothesis( shape, hyp ) hypName = GetName( hyp ) geoName = GetName( shape ) - print "WARNING: RemoveHypothesis() failed as '%s' is not assigned to '%s' shape" % ( hypName, geoName ) + print("WARNING: RemoveHypothesis() failed as '%s' is not assigned to '%s' shape" % ( hypName, geoName )) return None ## Get the list of hypotheses added on a geometry @@ -1982,11 +1978,10 @@ class Mesh: elif tgeo == "COMPOUND": sub = self.geompyD.SubShapeAll( shape, self.geompyD.ShapeType["SHAPE"]) if not sub: - raise ValueError,"_groupTypeFromShape(): empty geometric group or compound '%s'" % GetName(shape) + raise ValueError("_groupTypeFromShape(): empty geometric group or compound '%s'" % GetName(shape)) return self._groupTypeFromShape( sub[0] ) else: - raise ValueError, \ - "_groupTypeFromShape(): invalid geometry '%s'" % GetName(shape) + raise ValueError("_groupTypeFromShape(): invalid geometry '%s'" % GetName(shape)) return typ ## Create a mesh group with given \a name based on the \a filter which @@ -2975,8 +2970,8 @@ class Mesh: VertexID = Vertex try: self.editor.SetNodeOnVertex(NodeID, VertexID) - except SALOME.SALOME_Exception, inst: - raise ValueError, inst.details.text + except SALOME.SALOME_Exception as inst: + raise ValueError(inst.details.text) return True @@ -2993,8 +2988,8 @@ class Mesh: EdgeID = Edge try: self.editor.SetNodeOnEdge(NodeID, EdgeID, paramOnEdge) - except SALOME.SALOME_Exception, inst: - raise ValueError, inst.details.text + except SALOME.SALOME_Exception as inst: + raise ValueError(inst.details.text) return True ## @brief Stores node position on a face @@ -3011,8 +3006,8 @@ class Mesh: FaceID = Face try: self.editor.SetNodeOnFace(NodeID, FaceID, u, v) - except SALOME.SALOME_Exception, inst: - raise ValueError, inst.details.text + except SALOME.SALOME_Exception as inst: + raise ValueError(inst.details.text) return True ## @brief Binds a node to a solid @@ -3027,8 +3022,8 @@ class Mesh: SolidID = Solid try: self.editor.SetNodeInVolume(NodeID, SolidID) - except SALOME.SALOME_Exception, inst: - raise ValueError, inst.details.text + except SALOME.SALOME_Exception as inst: + raise ValueError(inst.details.text) return True ## @brief Bind an element to a shape @@ -3043,8 +3038,8 @@ class Mesh: ShapeID = Shape try: self.editor.SetMeshElementOnShape(ElementID, ShapeID) - except SALOME.SALOME_Exception, inst: - raise ValueError, inst.details.text + except SALOME.SALOME_Exception as inst: + raise ValueError(inst.details.text) return True @@ -3496,12 +3491,12 @@ class Mesh: pattern = self.smeshpyD.GetPattern() isDone = pattern.LoadFromFile(pattern_tetra) if not isDone: - print 'Pattern.LoadFromFile :', pattern.GetErrorCode() + print('Pattern.LoadFromFile :', pattern.GetErrorCode()) return isDone pattern.ApplyToHexahedrons(self.mesh, theObject.GetIDs(), theNode000, theNode001) isDone = pattern.MakeMesh(self.mesh, False, False) - if not isDone: print 'Pattern.MakeMesh :', pattern.GetErrorCode() + if not isDone: print('Pattern.MakeMesh :', pattern.GetErrorCode()) # split quafrangle faces near triangular facets of volumes self.SplitQuadsNearTriangularFacets() @@ -3550,12 +3545,12 @@ class Mesh: pattern = self.smeshpyD.GetPattern() isDone = pattern.LoadFromFile(pattern_prism) if not isDone: - print 'Pattern.LoadFromFile :', pattern.GetErrorCode() + print('Pattern.LoadFromFile :', pattern.GetErrorCode()) return isDone pattern.ApplyToHexahedrons(self.mesh, theObject.GetIDs(), theNode000, theNode001) isDone = pattern.MakeMesh(self.mesh, False, False) - if not isDone: print 'Pattern.MakeMesh :', pattern.GetErrorCode() + if not isDone: print('Pattern.MakeMesh :', pattern.GetErrorCode()) # Split quafrangle faces near triangular facets of volumes self.SplitQuadsNearTriangularFacets() @@ -3655,7 +3650,7 @@ class Mesh: self.editor.ConvertToQuadratic(theForce3d) error = self.editor.GetLastError() if error and error.comment: - print error.comment + print(error.comment) return error ## Convert the mesh from quadratic to ordinary, @@ -3897,7 +3892,7 @@ class Mesh: if isinstance( basePoint, int): xyz = self.GetNodeXYZ( basePoint ) if not xyz: - raise RuntimeError, "Invalid node ID: %s" % basePoint + raise RuntimeError("Invalid node ID: %s" % basePoint) basePoint = xyz if isinstance( basePoint, geomBuilder.GEOM._objref_GEOM_Object ): basePoint = self.geompyD.PointCoordinates( basePoint ) @@ -3955,7 +3950,7 @@ class Mesh: Elements = [ Elements.GetMesh() ] if isinstance( Elements, list ): if not Elements: - raise RuntimeError, "Elements empty!" + raise RuntimeError("Elements empty!") if isinstance( Elements[0], int ): Elements = self.GetIDSource( Elements, SMESH.ALL ) unRegister.set( Elements ) @@ -4628,7 +4623,7 @@ class Mesh: coincidentGroups = [] for nodeList in freeBorders: if not nodeList or len( nodeList ) % 3: - raise ValueError, "Wrong number of nodes in this group: %s" % nodeList + raise ValueError("Wrong number of nodes in this group: %s" % nodeList) group = [] while nodeList: group.append ( SMESH.FreeBorderPart( len(borders), 0, 1, 2 )) @@ -5114,7 +5109,7 @@ class meshEditor(SMESH._objref_SMESH_MeshEditor): return getattr( self.mesh, name ) if name == "ExtrusionAlongPathObjX": return getattr( self.mesh, "ExtrusionAlongPathX" ) # other method name - print "meshEditor: attribute '%s' NOT FOUND" % name + print("meshEditor: attribute '%s' NOT FOUND" % name) return None def __deepcopy__(self, memo=None): new = self.__class__() @@ -5206,11 +5201,11 @@ class algoCreator: if isinstance( arg, str ) and arg: algoType = arg if not algoType and self.algoTypeToClass: - algoType = self.algoTypeToClass.keys()[0] - if self.algoTypeToClass.has_key( algoType ): + algoType = list(self.algoTypeToClass.keys())[0] + if algoType in self.algoTypeToClass: #print "Create algo",algoType return self.algoTypeToClass[ algoType ]( self.mesh, geom ) - raise RuntimeError, "No class found for algo type %s" % algoType + raise RuntimeError("No class found for algo type %s" % algoType) return None ## Private class used to substitute and store variable parameters of hypotheses. @@ -5235,11 +5230,11 @@ class hypMethodWrapper: except omniORB.CORBA.BAD_PARAM: # raised by hypothesis method call # maybe there is a replaced string arg which is not variable result = self.method( self.hyp, *args ) - except ValueError, detail: # raised by ParseParameters() + except ValueError as detail: # raised by ParseParameters() try: result = self.method( self.hyp, *args ) except omniORB.CORBA.BAD_PARAM: - raise ValueError, detail # wrong variable name + raise ValueError(detail) # wrong variable name return result pass @@ -5275,9 +5270,9 @@ for pluginName in os.environ[ "SMESH_MeshersList" ].split( ":" ): pluginBuilderName = pluginName + "Builder" try: exec( "from salome.%s.%s import *" % (pluginName, pluginBuilderName)) - except Exception, e: + except Exception as e: from salome_utils import verbose - if verbose(): print "Exception while loading %s: %s" % ( pluginBuilderName, e ) + if verbose(): print("Exception while loading %s: %s" % ( pluginBuilderName, e )) continue exec( "from salome.%s import %s" % (pluginName, pluginBuilderName)) plugin = eval( pluginBuilderName ) diff --git a/src/SMESH_SWIG/smesh_algorithm.py b/src/SMESH_SWIG/smesh_algorithm.py index 3690f76d8..8d0946de1 100644 --- a/src/SMESH_SWIG/smesh_algorithm.py +++ b/src/SMESH_SWIG/smesh_algorithm.py @@ -183,7 +183,7 @@ class Mesh_Algorithm: ## Private method. def Create(self, mesh, geom, hypo, so="libStdMeshersEngine.so"): if geom is None and mesh.mesh.HasShapeToMesh(): - raise RuntimeError, "Attempt to create " + hypo + " algorithm on None shape" + raise RuntimeError("Attempt to create " + hypo + " algorithm on None shape") algo = self.FindAlgorithm(hypo, mesh.smeshpyD) if algo is None: algo = mesh.smeshpyD.CreateHypothesis(hypo, so) @@ -195,7 +195,7 @@ class Mesh_Algorithm: def Assign(self, algo, mesh, geom): from salome.smesh.smeshBuilder import AssureGeomPublished, TreatHypoStatus, GetName if geom is None and mesh.mesh.HasShapeToMesh(): - raise RuntimeError, "Attempt to create " + algo + " algorithm on None shape" + raise RuntimeError("Attempt to create " + algo + " algorithm on None shape") self.mesh = mesh if not geom or geom.IsSame( mesh.geom ): self.geom = mesh.geom @@ -208,7 +208,7 @@ class Mesh_Algorithm: return def CompareHyp (self, hyp, args): - print "CompareHyp is not implemented for ", self.__class__.__name__, ":", hyp.GetName() + print("CompareHyp is not implemented for ", self.__class__.__name__, ":", hyp.GetName()) return False def CompareEqualHyp (self, hyp, args): @@ -285,9 +285,9 @@ class Mesh_Algorithm: def ViscousLayers(self, thickness, numberOfLayers, stretchFactor, faces=[], isFacesToIgnore=True, extrMethod=StdMeshers.SURF_OFFSET_SMOOTH ): if not isinstance(self.algo, SMESH._objref_SMESH_3D_Algo): - raise TypeError, "ViscousLayers are supported by 3D algorithms only" + raise TypeError("ViscousLayers are supported by 3D algorithms only") if not "ViscousLayers" in self.GetCompatibleHypothesis(): - raise TypeError, "ViscousLayers are not supported by %s"%self.algo.GetName() + raise TypeError("ViscousLayers are not supported by %s"%self.algo.GetName()) if faces and isinstance( faces, geomBuilder.GEOM._objref_GEOM_Object ): faces = [ faces ] if faces and isinstance( faces[0], geomBuilder.GEOM._objref_GEOM_Object ): @@ -323,9 +323,9 @@ class Mesh_Algorithm: def ViscousLayers2D(self, thickness, numberOfLayers, stretchFactor, edges=[], isEdgesToIgnore=True ): if not isinstance(self.algo, SMESH._objref_SMESH_2D_Algo): - raise TypeError, "ViscousLayers2D are supported by 2D algorithms only" + raise TypeError("ViscousLayers2D are supported by 2D algorithms only") if not "ViscousLayers2D" in self.GetCompatibleHypothesis(): - raise TypeError, "ViscousLayers2D are not supported by %s"%self.algo.GetName() + raise TypeError("ViscousLayers2D are not supported by %s"%self.algo.GetName()) if edges and not isinstance( edges, list ) and not isinstance( edges, tuple ): edges = [edges] if edges and isinstance( edges[0], geomBuilder.GEOM._objref_GEOM_Object ): @@ -356,29 +356,29 @@ class Mesh_Algorithm: if isinstance( i, int ): s = geompy.SubShapes(self.mesh.geom, [i])[0] if s.GetShapeType() != geomBuilder.GEOM.EDGE: - raise TypeError, "Not EDGE index given" + raise TypeError("Not EDGE index given") resList.append( i ) elif isinstance( i, geomBuilder.GEOM._objref_GEOM_Object ): if i.GetShapeType() != geomBuilder.GEOM.EDGE: - raise TypeError, "Not an EDGE given" + raise TypeError("Not an EDGE given") resList.append( geompy.GetSubShapeID(self.mesh.geom, i )) elif len( i ) > 1: e = i[0] v = i[1] if not isinstance( e, geomBuilder.GEOM._objref_GEOM_Object ) or \ not isinstance( v, geomBuilder.GEOM._objref_GEOM_Object ): - raise TypeError, "A list item must be a tuple (edge, 1st_vertex_of_edge)" + raise TypeError("A list item must be a tuple (edge, 1st_vertex_of_edge)") if v.GetShapeType() == geomBuilder.GEOM.EDGE and \ e.GetShapeType() == geomBuilder.GEOM.VERTEX: v,e = e,v if e.GetShapeType() != geomBuilder.GEOM.EDGE or \ v.GetShapeType() != geomBuilder.GEOM.VERTEX: - raise TypeError, "A list item must be a tuple (edge, 1st_vertex_of_edge)" + raise TypeError("A list item must be a tuple (edge, 1st_vertex_of_edge)") vFirst = FirstVertexOnCurve( self.mesh, e ) tol = geompy.Tolerance( vFirst )[-1] if geompy.MinDistance( v, vFirst ) > 1.5*tol: resList.append( geompy.GetSubShapeID(self.mesh.geom, e )) else: - raise TypeError, "Item must be either an edge or tuple (edge, 1st_vertex_of_edge)" + raise TypeError("Item must be either an edge or tuple (edge, 1st_vertex_of_edge)") return resList diff --git a/src/SMESH_SWIG/smesh_selection.py b/src/SMESH_SWIG/smesh_selection.py index 882188089..5cc7c9422 100644 --- a/src/SMESH_SWIG/smesh_selection.py +++ b/src/SMESH_SWIG/smesh_selection.py @@ -46,7 +46,7 @@ _converter = { # Converts swig to idl enumeration def _swig2idl( type ): - if _converter.has_key( type ) : + if type in _converter : return _converter[type] return None @@ -80,7 +80,7 @@ def select( mesh, lst, append = False ) : # Check mesh parameter entry = _getEntry(mesh) if entry is None: - print "Wrong 'mesh' parameter" + print("Wrong 'mesh' parameter") return # Check lst parameter @@ -91,7 +91,7 @@ def select( mesh, lst, append = False ) : if isinstance( lst,list ) : tmp = lst else : - print "Wrong 'lst' parameter" + print("Wrong 'lst' parameter") return sm_gui.select( entry, tmp, append ) @@ -99,7 +99,7 @@ def select( mesh, lst, append = False ) : def _preProcess(mesh) : m = _getMesh(mesh); if m is None: - print "Wrong 'mesh' parameter" + print("Wrong 'mesh' parameter") return [None, None] elemType = _swig2idl(sm_gui.getSelectionMode()) diff --git a/src/Tools/MGCleanerPlug/MGCleanerMonPlugDialog.py b/src/Tools/MGCleanerPlug/MGCleanerMonPlugDialog.py index e7a1d5ddd..2f2e5c1ee 100644 --- a/src/Tools/MGCleanerPlug/MGCleanerMonPlugDialog.py +++ b/src/Tools/MGCleanerPlug/MGCleanerMonPlugDialog.py @@ -250,7 +250,7 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget): #myStudy.IsStudyLocked() myComponent = myStudy.FindComponent(name) if myComponent == None: - print "myComponent not found, create" + print("myComponent not found, create") myComponent = myBuilder.NewComponent(name) AName = myBuilder.FindOrCreateAttribute(myComponent, "AttributeName") AName.SetValue(name) @@ -265,7 +265,7 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget): if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(False) self.num += 1 - if verbose: print("save %s in Object Browser done: %s\n%s" % (name, myObject.GetID(), datai)) + if verbose: print(("save %s in Object Browser done: %s\n%s" % (name, myObject.GetID(), datai))) return True def PBSaveHypPressed(self): @@ -309,7 +309,7 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget): if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(False) self.num += 1 - if verbose: print("save %s in Object Browser done:\n%s" % (name, data)) + if verbose: print(("save %s in Object Browser done:\n%s" % (name, data))) return True def SP_toStr(self, widget): @@ -456,7 +456,7 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget): if fd.exec_(): infile = fd.selectedFiles()[0] self.LE_MeshFile.setText(infile) - self.fichierIn=unicode(infile).encode("latin-1") + self.fichierIn=str(infile).encode("latin-1") self.MeshIn="" self.LE_MeshSmesh.setText("") @@ -465,7 +465,7 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget): if fd.exec_(): infile = fd.selectedFiles()[0] self.LE_ParamsFile.setText(infile) - self.paramsFile=unicode(infile).encode("latin-1") + self.paramsFile=str(infile).encode("latin-1") def meshFileNameChanged(self): self.fichierIn=str(self.LE_MeshFile.text()) @@ -587,7 +587,7 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget): if not self.CB_ComputedOverlapDistance.isChecked(): #computed default self.commande+=" --overlap_distance " + self.SP_toStr(self.SP_OverlapDistance) self.commande+=" --overlap_angle " + str(self.SP_OverlapAngle.value()) - if verbose: print("INFO: MGCCleaner command:\n %s" % self.commande) + if verbose: print(("INFO: MGCCleaner command:\n %s" % self.commande)) return True def clean(self): diff --git a/src/Tools/MGCleanerPlug/MGCleanerMonViewText.py b/src/Tools/MGCleanerPlug/MGCleanerMonViewText.py index 01c53069d..99e322d31 100644 --- a/src/Tools/MGCleanerPlug/MGCleanerMonViewText.py +++ b/src/Tools/MGCleanerPlug/MGCleanerMonViewText.py @@ -91,7 +91,7 @@ class MGCleanerMonViewText(Ui_ViewExe, QDialog): f.write(cmds) self.make_executable(nomFichier) - if verbose: print("INFO: MGCleaner launch script file: %s" % nomFichier) + if verbose: print(("INFO: MGCleaner launch script file: %s" % nomFichier)) self.monExe.start(nomFichier) self.monExe.closeWriteChannel() @@ -108,23 +108,23 @@ class MGCleanerMonViewText(Ui_ViewExe, QDialog): savedir=os.environ['HOME'] fn = QFileDialog.getSaveFileName(None, self.trUtf8("Save File"),savedir) if fn.isNull() : return - ulfile = os.path.abspath(unicode(fn)) + ulfile = os.path.abspath(str(fn)) try: f = open(fn, 'wb') f.write(str(self.TB_Exe.toPlainText())) f.close() - except IOError, why: + except IOError as why: QMessageBox.critical(self, self.trUtf8('Save File'), self.trUtf8('The file %1 could not be saved.
Reason: %2') - .arg(unicode(fn)).arg(str(why))) + .arg(str(fn)).arg(str(why))) def readFromStdErr(self): a=self.monExe.readAllStandardError() - self.TB_Exe.append(unicode(a.data())) + self.TB_Exe.append(str(a.data())) def readFromStdOut(self) : a=self.monExe.readAllStandardOutput() - aa=unicode(a.data()) + aa=str(a.data()) self.TB_Exe.append(aa) def finished(self): diff --git a/src/Tools/MacMesh/Example/PressureValve.py.in b/src/Tools/MacMesh/Example/PressureValve.py.in index 612f4f769..abacc092e 100755 --- a/src/Tools/MacMesh/Example/PressureValve.py.in +++ b/src/Tools/MacMesh/Example/PressureValve.py.in @@ -107,7 +107,7 @@ SRVMesh = PublishGroups() RealLocalMeshing = Bloc[0][0].GeoPar[1][0]/Bloc[0][0].DirectionalMeshParams[0] ExtrusionAngle = 2. * math.asin(RealLocalMeshing/(2*R))*180./math.pi -print "\nThe mesh will be revolved with an angle of :",ExtrusionAngle +print("\nThe mesh will be revolved with an angle of :",ExtrusionAngle) RevolveMesh(SRVMesh, Center=[R+0.01,0,0], Direction=[0,1,0], AngleDeg=ExtrusionAngle, Scale=0.001) diff --git a/src/Tools/MacMesh/MacMesh/Alarms.py b/src/Tools/MacMesh/MacMesh/Alarms.py index 1aedce1e1..e0d7de6ac 100644 --- a/src/Tools/MacMesh/MacMesh/Alarms.py +++ b/src/Tools/MacMesh/MacMesh/Alarms.py @@ -23,6 +23,6 @@ def Message (code) : 2 : lambda x: "Fatal: Incorrect input \n", 3 : lambda x: "Fatal: Overlapping objects detected \n", 4 : lambda x: "Fatal: Incompatible object type with neighbouring objects" }[code](str(code)) - print MessageString + print(MessageString) #if code > 1 : sys.exit() return 1 diff --git a/src/Tools/MacMesh/MacMesh/CentralUnrefine.py b/src/Tools/MacMesh/MacMesh/CentralUnrefine.py index 5be20c0bd..de90ea445 100644 --- a/src/Tools/MacMesh/MacMesh/CentralUnrefine.py +++ b/src/Tools/MacMesh/MacMesh/CentralUnrefine.py @@ -24,8 +24,8 @@ -import sys, math, commands -CWD = commands.getoutput('pwd') +import sys, math, subprocess +CWD = subprocess.getoutput('pwd') sys.path.append(CWD) from MacObject import * diff --git a/src/Tools/MacMesh/MacMesh/CompositeBox.py b/src/Tools/MacMesh/MacMesh/CompositeBox.py index c929ede2b..b75ece724 100644 --- a/src/Tools/MacMesh/MacMesh/CompositeBox.py +++ b/src/Tools/MacMesh/MacMesh/CompositeBox.py @@ -20,8 +20,8 @@ # INTRODUCTION HERE -import sys, math, copy, commands -CWD = commands.getoutput('pwd') +import sys, math, copy, subprocess +CWD = subprocess.getoutput('pwd') sys.path.append(CWD) from MacObject import * @@ -42,13 +42,13 @@ def CompositeBox (X0 , Y0 , DX , DY , **args ) : ObjIDLists = SortObjLists(Config.Connections[-1],X0 , Y0 , DX , DY ) RemoveLastObj() - print "ObjIDLists: ", ObjIDLists + print("ObjIDLists: ", ObjIDLists) RealSegments = [] Direction = [] flag = 0 if not(args.__contains__('recursive')) : Config.Count = 0 - print "Config.Count : ", Config.Count + print("Config.Count : ", Config.Count) Config.Criterion = GetCriterion(ObjIDLists) for index, ObjList in enumerate(ObjIDLists) : if not (ObjList[0] == -1 or Config.Count >= Config.Criterion): @@ -163,7 +163,7 @@ def IndexMultiOcc (Array,Element) : """ Output = [] try : Array.index(Element) - except ValueError : print "No more occurrences" + except ValueError : print("No more occurrences") else : Output.append(Array.index(Element)) if not(Output == []) and len(Array) > 1 : diff --git a/src/Tools/MacMesh/MacMesh/CompositeBoxF.py b/src/Tools/MacMesh/MacMesh/CompositeBoxF.py index b4c90e4bc..dc1be5336 100644 --- a/src/Tools/MacMesh/MacMesh/CompositeBoxF.py +++ b/src/Tools/MacMesh/MacMesh/CompositeBoxF.py @@ -20,8 +20,8 @@ # INTRODUCTION HERE -import sys, math, copy, commands -CWD = commands.getoutput('pwd') +import sys, math, copy, subprocess +CWD = subprocess.getoutput('pwd') sys.path.append(CWD) from MacObject import * @@ -42,7 +42,7 @@ def CompositeBoxF (Pt1 , Pt2 , Pt3 , Pt4 , **args ) : BoundaryLengths = [IntLen(dummy.DirBoundaries(i)) for i in range(4) ] # Calculate global mesh element size on each direction GlobalDelta = [1.*BoundaryLengths[i]/ExistingSegments[i] for i in range(4) ] - print "GlobalDelta :",GlobalDelta + print("GlobalDelta :",GlobalDelta) # Sort the connection list for the full Box [(X0,Y0),(DX,DY)] = dummy.GeoPar ObjIDLists = SortObjLists(Config.Connections[-1],X0 , Y0 , DX , DY ) @@ -73,10 +73,10 @@ def CompositeBoxF (Pt1 , Pt2 , Pt3 , Pt4 , **args ) : ToLook2 = [1,0,3,2][index] RealSegments = Config.ListObj[ObjID].DirectionalMeshParams[ToLook2]*IntLen(CommonSide)/IntLen(Config.ListObj[ObjID].DirBoundaries(ToLook1)) LocalDelta = 1.*IntLen(CommonSide)/RealSegments - print "Direction:", ["West","East","South","North"][ToLook2] - print "IntLen(CommonSide):",IntLen(CommonSide) - print "RealSegments:",RealSegments - print "LocalDelta:",LocalDelta + print("Direction:", ["West","East","South","North"][ToLook2]) + print("IntLen(CommonSide):",IntLen(CommonSide)) + print("RealSegments:",RealSegments) + print("LocalDelta:",LocalDelta) if flag and Config.Count < Config.Criterion: if index ==0 : if abs(CommonSide[0] - Ymin)<1e-7 : SouthGR = GroupNames[0] @@ -124,7 +124,7 @@ def CompositeBoxF (Pt1 , Pt2 , Pt3 , Pt4 , **args ) : if Config.Count >= Config.Criterion : break if flag == 0 and Config.Count < Config.Criterion: - print "Creating NonOrtho object with the points:", Pt1,Pt2,Pt3,Pt4 + print("Creating NonOrtho object with the points:", Pt1,Pt2,Pt3,Pt4) MacObject('NonOrtho',[Pt1,Pt2,Pt3,Pt4] ,['auto'], groups = GroupNames) Config.Count += 1 @@ -135,7 +135,7 @@ def CompositeBoxF (Pt1 , Pt2 , Pt3 , Pt4 , **args ) : def FindCommonSide (Int1, Int2) : if max(Int1[0],Int2[0]) 1 : diff --git a/src/Tools/MacMesh/MacMesh/CutnGroup.py b/src/Tools/MacMesh/MacMesh/CutnGroup.py index 6c548653f..da3d7f972 100644 --- a/src/Tools/MacMesh/MacMesh/CutnGroup.py +++ b/src/Tools/MacMesh/MacMesh/CutnGroup.py @@ -51,7 +51,7 @@ def Go(GeoObj, CutPlnLst, OutLvlLst, PrefixLst, Publish): NumCuts = CheckInput(CutPlnLst, OutLvlLst, PrefixLst, 1) OrigType = FindStandType(GeoObj,0) - InvDictionary = dict((v,k) for k, v in geompy.ShapeType.iteritems()) # Give geometry type name as a function of standard type numbering, ex: 4=FACE, 6=EDGE, 7=VERTEX + InvDictionary = dict((v,k) for k, v in geompy.ShapeType.items()) # Give geometry type name as a function of standard type numbering, ex: 4=FACE, 6=EDGE, 7=VERTEX TrimSize = geompy.BasicProperties(GeoObj)[0]*100 CutPlane = [] ; Sections = [] ; Parts = [] @@ -75,7 +75,7 @@ def Go(GeoObj, CutPlnLst, OutLvlLst, PrefixLst, Publish): Sections.append(dummyObj) if Publish:geompy.addToStudyInFather(OutFather, dummyObj, PrefixLst[i]+"_"+InvDictionary[j][0:2]) else : - print "Warning: For the section no.", i, ", No intersection of type " + InvDictionary[j] + " was found. Hence, no corresponding groups were created" + print("Warning: For the section no.", i, ", No intersection of type " + InvDictionary[j] + " was found. Hence, no corresponding groups were created") SubShapesID = geompy.SubShapeAllIDs(OutFather,OrigType+1) # Saving also the groups corresponding to the sectioned item of the same type: ex. A solid into n sub-solids due to the sections for i in range(0,len(SubShapesID)): @@ -113,7 +113,7 @@ def GoTrim(GeoObj, CutPlnLst, OutLvlLst, PrefixLst, Publish): NumCuts = CheckInput(CutPlnLst, OutLvlLst, PrefixLst, 0) OrigType = FindStandType(GeoObj,0) - InvDictionary = dict((v,k) for k, v in geompy.ShapeType.iteritems()) # Give geometry type name as a function of standard type numbering, ex: 4=FACE, 6=EDGE, 7=VERTEX + InvDictionary = dict((v,k) for k, v in geompy.ShapeType.items()) # Give geometry type name as a function of standard type numbering, ex: 4=FACE, 6=EDGE, 7=VERTEX CutPlane = [] ; Sections = [] ; Parts = [] if NumCuts: for i in range(0, NumCuts): # Loop over the cutting planes to create them one by one @@ -135,7 +135,7 @@ def GoTrim(GeoObj, CutPlnLst, OutLvlLst, PrefixLst, Publish): Sections.append(dummyObj) if Publish: geompy.addToStudyInFather(OutFather, dummyObj, PrefixLst[i]+"_"+InvDictionary[j][0:2]) else : - print "Warning: For the section no.", i, ", No intersection of type " + InvDictionary[j] + " was found. Hence, no corresponding groups were created" + print("Warning: For the section no.", i, ", No intersection of type " + InvDictionary[j] + " was found. Hence, no corresponding groups were created") SubShapesID = geompy.SubShapeAllIDs(OutFather,OrigType+1) # Saving also the groups corresponding to the sectioned item of the same type: ex. A solid into n sub-solids due to the sections for i in range(0,len(SubShapesID)): diff --git a/src/Tools/MacMesh/MacMesh/Cylinder.py b/src/Tools/MacMesh/MacMesh/Cylinder.py index 7042e212f..2ddb72c24 100644 --- a/src/Tools/MacMesh/MacMesh/Cylinder.py +++ b/src/Tools/MacMesh/MacMesh/Cylinder.py @@ -25,8 +25,8 @@ # This functions can take a groups input containing the group names of 4 sides in addition to the internal circular boundary # in the following order : [South,North,West,East,Internal]. -import sys, math, commands -CWD = commands.getoutput('pwd') +import sys, math, subprocess +CWD = subprocess.getoutput('pwd') sys.path.append(CWD) @@ -39,11 +39,11 @@ def Cylinder (X0 , Y0 , D , DX , DY , LocalMeshing , **args) : # K is the pitch ratio K = float(D)/(DLocal-D) - print "A local pitch ratio of K =", K ," will be used. " + print("A local pitch ratio of K =", K ," will be used. ") NumCuts = 2*GenFunctions.QuarCylParam(K) InternalMeshing = int(math.ceil(math.pi*D/(4*NumCuts*LocalMeshing))) if InternalMeshing == 0 : InternalMeshing = 1 # This sets a minimum meshing condition in order to avoid an error. The user is notified of the value considered for the local meshing - print "Possible Local meshing is :", math.pi*D/(4*NumCuts*InternalMeshing), "\nThis value is returned by this function for your convenience.\n" + print("Possible Local meshing is :", math.pi*D/(4*NumCuts*InternalMeshing), "\nThis value is returned by this function for your convenience.\n") if args.__contains__('groups') : GroupNames = args['groups'] else : GroupNames = [None, None, None, None, None] diff --git a/src/Tools/MacMesh/MacMesh/GenFunctions.py b/src/Tools/MacMesh/MacMesh/GenFunctions.py index 9b3a33c8b..1c476ec81 100644 --- a/src/Tools/MacMesh/MacMesh/GenFunctions.py +++ b/src/Tools/MacMesh/MacMesh/GenFunctions.py @@ -35,7 +35,7 @@ smesh = smeshBuilder.New( Config.theStudy ) ########################################################################################################## def Box11 (MacObject): - if Config.debug : print "Generating regular box" + if Config.debug : print("Generating regular box") dummy1 = geompy.MakeScaleAlongAxes( ElemBox11 (), None , MacObject.GeoPar[1][0], MacObject.GeoPar[1][1], 1) RectFace = geompy.MakeTranslation(dummy1, MacObject.GeoPar[0][0], MacObject.GeoPar[0][1], 0) @@ -64,7 +64,7 @@ def Box11 (MacObject): ########################################################################################################## def Box42 (MacObject): - if Config.debug : print "Generating box 4-2 reducer" + if Config.debug : print("Generating box 4-2 reducer") Z_Axis = geompy.MakeVectorDXDYDZ(0., 0., 1.) RotAngle = {'SN' : lambda : 0, @@ -105,7 +105,7 @@ def Box42 (MacObject): ########################################################################################################## def BoxAng32 (MacObject): - if Config.debug : print "Generating sharp angle" + if Config.debug : print("Generating sharp angle") Z_Axis = geompy.MakeVectorDXDYDZ(0., 0., 1.) RotAngle = {'NE' : lambda : 0, 'NW' : lambda : math.pi/2, @@ -142,7 +142,7 @@ def BoxAng32 (MacObject): return MacObject ########################################################################################################## def CompBox (MacObject): - if Config.debug : print "Generating composite box" + if Config.debug : print("Generating composite box") dummy1 = geompy.MakeScaleAlongAxes( ElemBox11 (), None , MacObject.GeoPar[1][0], MacObject.GeoPar[1][1], 1) RectFace = geompy.MakeTranslation(dummy1, MacObject.GeoPar[0][0], MacObject.GeoPar[0][1], 0) @@ -184,7 +184,7 @@ def CompBox (MacObject): ########################################################################################################## def CompBoxF (MacObject): - if Config.debug : print "Generating composite box" + if Config.debug : print("Generating composite box") dummy1 = geompy.MakeScaleAlongAxes( ElemBox11 (), None , MacObject.GeoPar[1][0], MacObject.GeoPar[1][1], 1) RectFace = geompy.MakeTranslation(dummy1, MacObject.GeoPar[0][0], MacObject.GeoPar[0][1], 0) @@ -225,7 +225,7 @@ def CompBoxF (MacObject): ########################################################################################################## def NonOrtho (MacObject): - if Config.debug : print "Generating Non-orthogonal quadrangle" + if Config.debug : print("Generating Non-orthogonal quadrangle") RectFace = Quadrangler (MacObject.PtCoor) @@ -260,7 +260,7 @@ def NonOrtho (MacObject): ########################################################################################################## def QuartCyl (MacObject): - if Config.debug : print "Generating quarter cylinder" + if Config.debug : print("Generating quarter cylinder") Z_Axis = geompy.MakeVectorDXDYDZ(0., 0., 1.) RotAngle = {'NE' : lambda : 0, 'NW' : lambda : math.pi/2, @@ -486,7 +486,7 @@ def ReduceRatio (dx, dy): if not (Output==[0,0]) : break if Output == [0,0] : - print "We are having some trouble while interpreting the following ratio: ",ratio, "\nWe will try a recursive method which may in some cases take some time..." + print("We are having some trouble while interpreting the following ratio: ",ratio, "\nWe will try a recursive method which may in some cases take some time...") if dy > dx : A = ReduceRatio (dx, dy-dx) return ([A[0],A[1]+A[0]]) @@ -814,7 +814,7 @@ def IndexMultiOcc (Array,Element) : """ Output = [] try : Array.index(Element) - except ValueError : print "No more occurrences" + except ValueError : print("No more occurrences") else : Output.append(Array.index(Element)) if not(Output == []) and len(Array) > 1 : @@ -852,7 +852,7 @@ def SortPoints(Points): Crit = [(abs(Point[0]-Xmin)+0.1*(Xmax-Xmin))*(abs(Point[1]-Ymin)+0.1*(Ymax-Ymin)) for Point in Points] #print "Input Points : ", Points #print "Sorting Criterion : ", Crit - Order = SortList (range(NbPts), Crit) + Order = SortList (list(range(NbPts)), Crit) #print "Sorted Results : ", Order Output = [] Output.append(Points[Order[0]]) @@ -863,7 +863,7 @@ def SortPoints(Points): V = [[Point1[0]-Point0[0],Point1[1]-Point0[1]] for Point1 in Points] Cosines = [-(vec[0]-1E-10)/(math.sqrt(DotProd(vec,vec)+1e-25)) for vec in V] #print "Cosines criterion :", Cosines - Order = SortList(range(NbPts),Cosines) + Order = SortList(list(range(NbPts)),Cosines) #print "Ordered points:", Order for PtIndex in Order[:-1]: Output.append(Points[PtIndex]) diff --git a/src/Tools/MacMesh/MacMesh/MacObject.py b/src/Tools/MacMesh/MacMesh/MacObject.py index 8c24d560e..f2665083d 100644 --- a/src/Tools/MacMesh/MacMesh/MacObject.py +++ b/src/Tools/MacMesh/MacMesh/MacObject.py @@ -32,7 +32,7 @@ class MacObject: determines meshing parameters if necessary and finally launches the generation process. """ import Config,GenFunctions - if Config.debug : print "Initializing object No. " + str(len(Config.ListObj)+1) + if Config.debug : print("Initializing object No. " + str(len(Config.ListObj)+1)) if 'publish' in args : if args['publish']==0 : Config.publish = 0 @@ -46,7 +46,7 @@ class MacObject: else : self.GroupNames = [None, None, None, None] if ObjectType == 'NonOrtho': - if not(len(GeoParameters)==4): print "Error: trying to construct a non-ortho object but the 4 constitutive vertices are not given!" + if not(len(GeoParameters)==4): print("Error: trying to construct a non-ortho object but the 4 constitutive vertices are not given!") else : Xmin = min([GeoParameters[i][0] for i in range(4)]) Xmax = max([GeoParameters[i][0] for i in range(4)]) @@ -187,7 +187,7 @@ class MacObject: if self.MeshPar[0] < 0 : Alarms.Message(4) - if self.MeshPar[0] == -1 : print ("Problem encountered with object(s) no. "+str(ObjectsInvolved)) + if self.MeshPar[0] == -1 : print(("Problem encountered with object(s) no. "+str(ObjectsInvolved))) elif self.MeshPar[0] == -2 : print ("This object has no neighbours !!!") def Boundaries (self): @@ -286,7 +286,7 @@ class MacObject: from itertools import combinations Boxes = [] if self.Type == 'NonOrtho': - for combi in combinations(range(4),3): + for combi in combinations(list(range(4)),3): Xmin = min([self.PtCoor[i][0] for i in combi]) Xmax = max([self.PtCoor[i][0] for i in combi]) Ymin = min([self.PtCoor[i][1] for i in combi]) diff --git a/src/Tools/MacMesh/MacMesh/PublishGroups.py b/src/Tools/MacMesh/MacMesh/PublishGroups.py index 79304b972..52dcf728a 100644 --- a/src/Tools/MacMesh/MacMesh/PublishGroups.py +++ b/src/Tools/MacMesh/MacMesh/PublishGroups.py @@ -34,7 +34,7 @@ def PublishGroups (): aFilterManager = smesh.CreateFilterManager() # Building geometric and mesh compounds and groups ############################################## - if Config.debug : print "Searching for geometric groups and publishing final compound" + if Config.debug : print("Searching for geometric groups and publishing final compound") TempGEOList = [] TempMESHList = [] @@ -83,7 +83,7 @@ def IndexMultiOcc (Array,Element) : """ Output = [] try : Array.index(Element) - except ValueError : print "No more occurrences" + except ValueError : print("No more occurrences") else : Output.append(Array.index(Element)) if not(Output == [-1]) and len(Array) > 1 : @@ -111,18 +111,18 @@ def RevolveMesh(MainMesh,**args): ################################################################################ if 'Center' in args : CenterCoor = [float(Coor) for Coor in args['Center']] else : - print "\nThe coordinates of the center of revolution were not given\nThe origin is used by default." + print("\nThe coordinates of the center of revolution were not given\nThe origin is used by default.") CenterCoor = [0.,0.,0.] if 'Direction' in args : Direction = [float(Dir) for Dir in args['Direction']] else : - print "\nThe axis vector of revolution was not given\nThe x-axis is used by default." + print("\nThe axis vector of revolution was not given\nThe x-axis is used by default.") Direction = [1.,0.,0.] if 'AngleDeg' in args : Angle = float(args['AngleDeg'])*math.pi/180. elif 'AngleRad' in args : Angle = float(args['AngleRad']) else : - print "\nThe revolution angle was not given\nAn angle of 10 degrees is used by default." + print("\nThe revolution angle was not given\nAn angle of 10 degrees is used by default.") Angle = 10.*math.pi/180. if 'Scale' in args : Scale = float(args['Scale']) @@ -185,12 +185,12 @@ def ExtrudeMesh(MainMesh,**args): ################################################################################ if 'Distance' in args : Distance = float(args['Distance']) else : - print "\nThe extrusion distance was not given\nA default value of 1 is used." + print("\nThe extrusion distance was not given\nA default value of 1 is used.") Distance = 1. if 'Direction' in args : Direction = NormalizeVector([float(Dir) for Dir in args['Direction']],Distance) else : - print "\nThe extrusion vector of revolution was not given\nThe z-axis is used by default." + print("\nThe extrusion vector of revolution was not given\nThe z-axis is used by default.") Direction = NormalizeVector([0.,0.,1.],Distance) if 'Scale' in args : Scale = float(args['Scale']) diff --git a/src/Tools/MacMesh/MacMesh/SharpAngle.py b/src/Tools/MacMesh/MacMesh/SharpAngle.py index 6a544037b..1eed87f19 100644 --- a/src/Tools/MacMesh/MacMesh/SharpAngle.py +++ b/src/Tools/MacMesh/MacMesh/SharpAngle.py @@ -27,8 +27,8 @@ # | NW NE | oo # _____| |_____ -import sys, math, commands -CWD = commands.getoutput('pwd') +import sys, math, subprocess +CWD = subprocess.getoutput('pwd') sys.path.append(CWD) from MacObject import * @@ -42,7 +42,7 @@ def SharpAngleOut (X0 , Y0 , DX , DY , DLocal, LocalMeshing , CornerOrientation InternalMeshing = int(math.ceil(BoxSide/(3*LocalMeshing))) InternalMeshing = InternalMeshing+InternalMeshing%2 # An even number is needed, otherwise the objects would not be compatible once created if InternalMeshing == 0 : InternalMeshing = 2 # This sets a minimum meshing condition in order to avoid an error. The user is notified of the value considered for the local meshing - print "Possible Local meshing is :", BoxSide/(3*InternalMeshing), "\nThis value is returned by this function for your convenience" + print("Possible Local meshing is :", BoxSide/(3*InternalMeshing), "\nThis value is returned by this function for your convenience") DirPar = {'NE' : lambda : ['NE', 'NW', 'SE', 'EW', 'NW', 'SN', 'SN', 'NE', 'WE', 'WE', 'SE', 'NS'], 'NW' : lambda : ['NW', 'NE', 'SW', 'WE', 'NE', 'SN', 'SN', 'NW', 'EW', 'EW', 'SW', 'NS'], @@ -153,7 +153,7 @@ def SharpAngleIn (X0 , Y0 , DX , DY , DLocal, LocalMeshing , CornerOrientation , InternalMeshing = int(math.ceil(BoxSide/(3*LocalMeshing))) InternalMeshing = InternalMeshing+InternalMeshing%2 # An even number is needed, otherwise the objects would not be compatible once created if InternalMeshing == 0 : InternalMeshing = 2 # This sets a minimum meshing condition in order to avoid an error. The user is notified of the value considered for the local meshing - print "Possible Local meshing is :", BoxSide/(3*InternalMeshing), "\nThis value is returned by this function for your convenience..." + print("Possible Local meshing is :", BoxSide/(3*InternalMeshing), "\nThis value is returned by this function for your convenience...") DirPar = {'NE' : lambda : ['NE', 'SN', 'NE', 'WE'], 'NW' : lambda : ['NW', 'SN', 'NW', 'EW'], diff --git a/src/Tools/MeshCut/meshcut_plugin.py b/src/Tools/MeshCut/meshcut_plugin.py index c5abe768a..a233673b8 100644 --- a/src/Tools/MeshCut/meshcut_plugin.py +++ b/src/Tools/MeshCut/meshcut_plugin.py @@ -50,7 +50,7 @@ def MeshCut(context): if fd.exec_(): infile = fd.selectedFiles()[0] self.ui.le_origMeshFile.setText(infile) - insplit = os.path.splitext(unicode(infile).encode()) + insplit = os.path.splitext(str(infile).encode()) outfile = insplit[0] + '_cut' + insplit[1] self.ui.le_cutMeshFile.setText(outfile) pass @@ -97,11 +97,11 @@ and T the tolerance. if result: # dialog accepted args = ['MeshCut'] - args += [unicode(window.ui.le_origMeshFile.text()).encode()] - args += [unicode(window.ui.le_cutMeshFile.text()).encode()] - args += [unicode(window.ui.le_outMeshName.text()).encode()] - args += [unicode(window.ui.le_groupAbove.text()).encode()] - args += [unicode(window.ui.le_groupBelow.text()).encode()] + args += [str(window.ui.le_origMeshFile.text()).encode()] + args += [str(window.ui.le_cutMeshFile.text()).encode()] + args += [str(window.ui.le_outMeshName.text()).encode()] + args += [str(window.ui.le_groupAbove.text()).encode()] + args += [str(window.ui.le_groupBelow.text()).encode()] args += [str(window.ui.dsb_normX.value())] args += [str(window.ui.dsb_normY.value())] args += [str(window.ui.dsb_normZ.value())] diff --git a/src/Tools/Verima/Base/dataBase.py b/src/Tools/Verima/Base/dataBase.py index 8940e06f1..11dcee37e 100644 --- a/src/Tools/Verima/Base/dataBase.py +++ b/src/Tools/Verima/Base/dataBase.py @@ -5,18 +5,18 @@ import datetime import sys from qtsalome import QSqlQuery -from tableMaillages import TableMaillages -from tableMailleurs import TableMailleurs -from tableMachines import TableMachines -from tableVersions import TableVersions -from tableGroupesRef import TableGroupesRef -from tableGroupes import TableGroupes -from tableMailles import TableMailles -from tableTailles import TableTailles -from tableRatios import TableRatios -from tableGroupeRatios import TableGroupeRatios -from tableGroupeTailles import TableGroupeTailles -from tablePerfs import TablePerfs +from .tableMaillages import TableMaillages +from .tableMailleurs import TableMailleurs +from .tableMachines import TableMachines +from .tableVersions import TableVersions +from .tableGroupesRef import TableGroupesRef +from .tableGroupes import TableGroupes +from .tableMailles import TableMailles +from .tableTailles import TableTailles +from .tableRatios import TableRatios +from .tableGroupeRatios import TableGroupeRatios +from .tableGroupeTailles import TableGroupeTailles +from .tablePerfs import TablePerfs from Stats.job import Job from CreeDocuments.jobHtml import Document @@ -29,9 +29,9 @@ class Base: self.db.setUserName(""); self.db.setPassword("") if not self.db.open(): - print(self.db.lastError().text()) + print((self.db.lastError().text())) else: - print "dataBase Open" + print("dataBase Open") self.file=file def create(self): @@ -135,28 +135,28 @@ class Base: bOk,versionId,versionName = self.maTableVersions.chercheVersion(version) if bOk==False: self.maTableVersions.creeVersion(version) - print "nouvelle Version enregistree dans la base" + print("nouvelle Version enregistree dans la base") bOk,versionId,versionName = self.maTableVersions.chercheVersion(version) if bOk==False: - print "Impossible de creer la version" + print("Impossible de creer la version") return bOk,nomMachine = self.maTableMachines.chercheMachine() if bOk==False: self.maTableMachines.creeMachine() - print "enregistrement de la machine dans la table des machines" + print("enregistrement de la machine dans la table des machines") bOk,nomMachine = self.maTableMachines.chercheMachine() if bOk==False: - print "Impossible de creer la version" + print("Impossible de creer la version") return for params in paramMaillage: - print "___________________________________________" - print "" - print " Job : ", params[1] - print " Version de salome : ", versionName + print("___________________________________________") + print("") + print(" Job : ", params[1]) + print(" Version de salome : ", versionName) idJob=params[0] @@ -166,8 +166,8 @@ class Base: if mesGroupesRef != [] : writeFile(fichierGroupesRef,",".join(mesGroupesRef)) monjob=Job(params,salomePath,versionId,mesGroupesRef) - print "" - print " Debut d execution" + print("") + print(" Debut d execution") monjob.execute() # remplit Perfs @@ -217,14 +217,14 @@ class Base: def compare(self,version,ListeVersionRefString,fichier): - print "_________________________________________________________________" - print "Generation du rapport de comparaison" - print version + print("_________________________________________________________________") + print("Generation du rapport de comparaison") + print(version) bOk,versionId,versionName = self.maTableVersions.chercheVersion(version) if bOk==False : - print "version ", version , " inconnue dans la base" + print("version ", version , " inconnue dans la base") exit() - print "Version a comparer : ", versionName + print("Version a comparer : ", versionName) versionCompName=versionName versionCompId=versionId @@ -234,7 +234,7 @@ class Base: for id in ListeVersionRef: bOk,versionId,versionName = self.maTableVersions.chercheVersion(id) if bOk==False : - print "version ", id , " inconnue dans la base" + print("version ", id , " inconnue dans la base") exit() listeVersionRefId.append(versionId) listeVersionRefName.append(versionName) @@ -245,7 +245,7 @@ class Base: maillagesIdListe, maillagesNameListe=self.maTableMaillages.getTous() if len(maillagesIdListe) != len (listeVersionRefId): - print "Pas assez de version de reference" + print("Pas assez de version de reference") exit() allEntitySurMaille=self.maTableMailles.getAllEntity() @@ -253,7 +253,7 @@ class Base: # Boucle sur les maillages for idMaillage in maillagesIdListe : - print idMaillage + print(idMaillage) versionRefId=listeVersionRefId[idMaillage - 1] versionRefName=listeVersionRefName[idMaillage - 1] mailleurId=self.maTableMaillages.getMailleurId(idMaillage) diff --git a/src/Tools/Verima/Base/exportToCSV.py b/src/Tools/Verima/Base/exportToCSV.py index 783e7ac74..7737c5267 100755 --- a/src/Tools/Verima/Base/exportToCSV.py +++ b/src/Tools/Verima/Base/exportToCSV.py @@ -6,7 +6,7 @@ pathRacine=os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__ if os.path.dirname(pathRacine) not in sys.path : sys.path.insert(0,pathRacine) -from dataBase import Base +from .dataBase import Base if __name__ == "__main__": from optparse import OptionParser diff --git a/src/Tools/Verima/Base/importFromCSV.py b/src/Tools/Verima/Base/importFromCSV.py index a394ab16b..5c98544aa 100755 --- a/src/Tools/Verima/Base/importFromCSV.py +++ b/src/Tools/Verima/Base/importFromCSV.py @@ -3,7 +3,7 @@ import sys import os -from dataBase import Base +from .dataBase import Base @@ -15,12 +15,12 @@ if __name__ == "__main__": p.add_option('-d',dest='database',default="myMesh.db",help='nom de la database') options, args = p.parse_args() if len(args) != 1 : - print "entrer SVP le nom de la directory ou sont rangees les fichiers a charger" + print("entrer SVP le nom de la directory ou sont rangees les fichiers a charger") exit() folder=args[0] if not(os.path.isdir(folder)): - print folder , " n existe pas" + print(folder , " n existe pas") exit() maBase=Base(options.database) diff --git a/src/Tools/Verima/Base/tableDeBase.py b/src/Tools/Verima/Base/tableDeBase.py index bd5c92c9f..7bba47cb7 100644 --- a/src/Tools/Verima/Base/tableDeBase.py +++ b/src/Tools/Verima/Base/tableDeBase.py @@ -18,24 +18,24 @@ class TableDeBase : def insereLigne(self,valeurs,debug=False): if self.verifieExitenceId(valeurs[0])!=0 : - print "impossible d inserer " , valeurs, "dans ", self.nom - print "l id est deja existant" + print("impossible d inserer " , valeurs, "dans ", self.nom) + print("l id est deja existant") return False texteQuery='insert into ' + self.nom + " values "+ str(valeurs)+ ';' maQuery=QSqlQuery() - if debug : print texteQuery, " " , maQuery.exec_(texteQuery) + if debug : print(texteQuery, " " , maQuery.exec_(texteQuery)) else : maQuery.exec_(texteQuery) def insereLigneAutoId(self,valeurs,debug=False): texteQuery='insert into ' + self.nom + self.cols+ " values "+ str(valeurs)+ ';' maQuery=QSqlQuery() - if debug : print texteQuery, " " , maQuery.exec_(texteQuery) + if debug : print(texteQuery, " " , maQuery.exec_(texteQuery)) else : maQuery.exec_(texteQuery) def insereOuRemplaceLigne(self,valeurs,debug=False): texteQuery='insert or replace into ' + self.nom + " values "+ str(valeurs)+ ';' maQuery=QSqlQuery() - if debug : print texteQuery, " " , maQuery.exec_(texteQuery) + if debug : print(texteQuery, " " , maQuery.exec_(texteQuery)) else : maQuery.exec_(texteQuery) @@ -45,15 +45,15 @@ class TableDeBase : maQuery=QSqlQuery() maQuery.exec_(texteQuery) nb=0 - while(maQuery.next()): nb=nb+1 + while(next(maQuery)): nb=nb+1 return nb def remplit(self): - print "Pas de remplissage sauf si cette methode est surchargee" + print("Pas de remplissage sauf si cette methode est surchargee") def createSqlTable(self): - print "Pas de creation par defaut : cette methode doit etre surchargee" + print("Pas de creation par defaut : cette methode doit etre surchargee") # On ne se sert pas du csv python entre autre parcequ'il ne gere pas les entetes def exportToCSV(self): @@ -70,7 +70,7 @@ class TableDeBase : maQuery=QSqlQuery() maQuery.exec_(texteQuery) asauver=0 - while(maQuery.next()): + while(next(maQuery)): asauver=1 for i in range(len(self.FieldStringList)): texteSauve+=str(maQuery.value(i).toString())+";" @@ -78,29 +78,29 @@ class TableDeBase : texteSauve+="\n" if asauver == 0 : - print "pas de sauvegarde de : " , self.nom , " table vide" + print("pas de sauvegarde de : " , self.nom , " table vide") return from Stats.utiles import writeFile Bok=writeFile(monFichier,texteSauve) if Bok : - print "sauvegarde de : " , self.nom , " effectuee " + print("sauvegarde de : " , self.nom , " effectuee ") else : - print "pas de sauvegarde de : " , self.nom , " IOerror" + print("pas de sauvegarde de : " , self.nom , " IOerror") def importFromCSV(self,folder,force): monFichier=folder+"/Sauve_"+str(self.nom)+'.csv' try : f=open(monFichier,'r') except: - print "Pas de chargement de la table ", self.nom - print "Impossible d'ouvrir le fichier ", monFichier + print("Pas de chargement de la table ", self.nom) + print("Impossible d'ouvrir le fichier ", monFichier) return 0 lignes=f.readlines() enTete=tuple(lignes[0][0:-1].split(";")) if enTete!=self.FieldStringList: - print "Pas de chargement de la table ", self.nom - print "les entetes ne correspondent pas" + print("Pas de chargement de la table ", self.nom) + print("les entetes ne correspondent pas") return 0 for StrVal in lignes[1:]: listeVal=tuple(StrVal[0:-1].split(";")) diff --git a/src/Tools/Verima/Base/tableGroupeRatios.py b/src/Tools/Verima/Base/tableGroupeRatios.py index 707fff8ae..c435f28ff 100644 --- a/src/Tools/Verima/Base/tableGroupeRatios.py +++ b/src/Tools/Verima/Base/tableGroupeRatios.py @@ -1,5 +1,5 @@ from qtsalome import QSqlQuery -from tableDeBase import TableDeBase +from .tableDeBase import TableDeBase class TableGroupeRatios (TableDeBase): def __init__(self): @@ -20,7 +20,7 @@ class TableGroupeRatios (TableDeBase): texteQuery+="foreign key (idVersion) references Versions(id)," texteQuery+="foreign key (Groupe) references GroupesRef(nomGroupe)," texteQuery+="primary key (idMaillage,idVersion,Groupe));" - print "Creation de TableGroupeRatios : " , query.exec_(texteQuery) + print("Creation de TableGroupeRatios : " , query.exec_(texteQuery)) def getVal(self,idMaillage, idVersion, Groupe, Entite): query=QSqlQuery() @@ -30,9 +30,9 @@ class TableGroupeRatios (TableDeBase): query.exec_(texteQuery) nb=0 val=0 # Valeur si l enregistrement n existe pas - while (query.next()) : + while (next(query)) : val=query.value(0).toFloat()[0] nb=nb+1 - if nb > 1 : print "Double valeur de Reference dans la table des mailles" + if nb > 1 : print("Double valeur de Reference dans la table des mailles") return val diff --git a/src/Tools/Verima/Base/tableGroupeTailles.py b/src/Tools/Verima/Base/tableGroupeTailles.py index 6f37bd70d..c18dae294 100644 --- a/src/Tools/Verima/Base/tableGroupeTailles.py +++ b/src/Tools/Verima/Base/tableGroupeTailles.py @@ -1,5 +1,5 @@ from qtsalome import QSqlQuery -from tableDeBase import TableDeBase +from .tableDeBase import TableDeBase class TableGroupeTailles (TableDeBase): def __init__(self): @@ -21,7 +21,7 @@ class TableGroupeTailles (TableDeBase): texteQuery+="foreign key (Groupe) references GroupesRef(nomGroupe)," texteQuery+="primary key (idMaillage,idVersion,Groupe));" - print "Creation de TableGroupeTailles : " , query.exec_(texteQuery) + print("Creation de TableGroupeTailles : " , query.exec_(texteQuery)) def getVal(self,idMaillage, idVersion, Groupe, Entite): query=QSqlQuery() @@ -31,9 +31,9 @@ class TableGroupeTailles (TableDeBase): query.exec_(texteQuery) nb=0 val=0 # Valeur si l enregistrement n existe pas - while (query.next()) : + while (next(query)) : val=query.value(0).toFloat()[0] nb=nb+1 - if nb > 1 : print "Double valeur de Reference dans la table des tailles" + if nb > 1 : print("Double valeur de Reference dans la table des tailles") return val diff --git a/src/Tools/Verima/Base/tableGroupes.py b/src/Tools/Verima/Base/tableGroupes.py index a217909a9..7a78dfa05 100644 --- a/src/Tools/Verima/Base/tableGroupes.py +++ b/src/Tools/Verima/Base/tableGroupes.py @@ -1,5 +1,5 @@ from qtsalome import QSqlQuery -from tableDeBase import TableDeBase +from .tableDeBase import TableDeBase class TableGroupes (TableDeBase): def __init__(self): @@ -18,7 +18,7 @@ class TableGroupes (TableDeBase): texteQuery+="foreign key (idVersion) references Versions(id)," texteQuery+="primary key (nomGroupe,idMaillage,idVersion,Entite));" - print "Creation de TableGroupes : ", query.exec_(texteQuery) + print("Creation de TableGroupes : ", query.exec_(texteQuery)) def getVal(self,nomGroupe,idMaillage,idVersion,typeMaille): @@ -29,10 +29,10 @@ class TableGroupes (TableDeBase): texteQuery +=' and idVersion = ' + str(idVersion) texteQuery +=' and Entite ="' + str(typeMaille) + '";' query.exec_(texteQuery) - while (query.next()) : + while (next(query)) : val=query.value(0).toInt()[0] - while (query.next()) : - print "plusieurs enregistrements dans groupe pour ", nomGroupe," ",str(idMaillage)," ",str(idVersion),"\n" + while (next(query)) : + print("plusieurs enregistrements dans groupe pour ", nomGroupe," ",str(idMaillage)," ",str(idVersion),"\n") return val @@ -41,6 +41,6 @@ class TableGroupes (TableDeBase): texteQuery ="select distinct Entite from Groupes;" query.exec_(texteQuery) maListe=[] - while (query.next()) : + while (next(query)) : maListe.append(str(query.value(0).toString())) return maListe diff --git a/src/Tools/Verima/Base/tableGroupesRef.py b/src/Tools/Verima/Base/tableGroupesRef.py index 3208be7fb..663f509d1 100644 --- a/src/Tools/Verima/Base/tableGroupesRef.py +++ b/src/Tools/Verima/Base/tableGroupesRef.py @@ -1,5 +1,5 @@ from qtsalome import QSqlQuery -from tableDeBase import TableDeBase +from .tableDeBase import TableDeBase class TableGroupesRef (TableDeBase): def __init__(self): @@ -12,14 +12,14 @@ class TableGroupesRef (TableDeBase): texteQuery ="create table GroupesRef(nomGroupe varchar(40), idMaillage int," texteQuery+="foreign key (idMaillage) references Maillages(idMaillage)," texteQuery+="primary key (nomGroupe,idMaillage));" - print "Creation de TableGroupesRef : " , query.exec_(texteQuery) + print("Creation de TableGroupesRef : " , query.exec_(texteQuery)) def getVals(self,idMaillage): query=QSqlQuery() texteQuery ='select NomGroupe from GroupesRef where idMaillage='+str(idMaillage) +";" listeGroupes=[] query.exec_(texteQuery) - while (query.next()) : + while (next(query)) : listeGroupes.append(str(query.value(0).toString())) return listeGroupes diff --git a/src/Tools/Verima/Base/tableMachines.py b/src/Tools/Verima/Base/tableMachines.py index cb743ccb5..0b149d95e 100644 --- a/src/Tools/Verima/Base/tableMachines.py +++ b/src/Tools/Verima/Base/tableMachines.py @@ -1,5 +1,5 @@ from qtsalome import QSqlQuery -from tableDeBase import TableDeBase +from .tableDeBase import TableDeBase import os class TableMachines (TableDeBase): @@ -10,7 +10,7 @@ class TableMachines (TableDeBase): def createSqlTable(self): query=QSqlQuery() - print "creation de TableMachine : ", query.exec_("create table Machines( nomMachine varchar(10) primary key, os varchar(10));") + print("creation de TableMachine : ", query.exec_("create table Machines( nomMachine varchar(10) primary key, os varchar(10));")) def creeMachine(self): nomMachine=os.uname()[1] @@ -23,7 +23,7 @@ class TableMachines (TableDeBase): texteQuery ="select nomMachine from Machines where nomMachine ='" + machine +"' ;" query.exec_(texteQuery) nb=0 - while(query.next()): + while(next(query)): nb=nb+1 nom=str(query.value(0).toString()) if nb != 1 : return 0, "" diff --git a/src/Tools/Verima/Base/tableMaillages.py b/src/Tools/Verima/Base/tableMaillages.py index 83f73725c..dccad9382 100644 --- a/src/Tools/Verima/Base/tableMaillages.py +++ b/src/Tools/Verima/Base/tableMaillages.py @@ -1,5 +1,5 @@ from qtsalome import QSqlQuery -from tableDeBase import TableDeBase +from .tableDeBase import TableDeBase class TableMaillages (TableDeBase): def __init__(self): @@ -14,17 +14,17 @@ class TableMaillages (TableDeBase): texteQuery+="nomScript varchar(40), medResultat varchar(15), idMailleur int, dimension int," texteQuery+="seuilCPU int, seuilRatio int, seuilTaille int, seuilNbMaille int, commentaire varchar(60), " texteQuery+="foreign key (idMailleur) references Mailleur(id));" - print "creation de TableMaillages : " , query.exec_(texteQuery) + print("creation de TableMaillages : " , query.exec_(texteQuery)) def getVal(self,idMaillage, nomChamp): query=QSqlQuery() valeur=None texteQuery ='select '+ nomChamp + ' from Maillages where id=' + str(idMaillage) + ";" query.exec_(texteQuery) - while (query.next()) : + while (next(query)) : valeur=query.value(0).toInt()[0] - while (query.next()) : - print "plusieurs enregistrements dans Maillages pour ",str(idMaillage) + while (next(query)) : + print("plusieurs enregistrements dans Maillages pour ",str(idMaillage)) exit() return valeur @@ -33,12 +33,12 @@ class TableMaillages (TableDeBase): maQuery=QSqlQuery() maQuery.exec_(texteQuery) nb=0 - while(maQuery.next()): nb=nb+1 + while(next(maQuery)): nb=nb+1 return nb def remplit(self): if self.dejaRemplie(): - print "table Maillage deja initialisee" + print("table Maillage deja initialisee") return # self.insereLigneAutoId(('Fiche_7566_TUNNEL', '/home/H77945/CAS_TEST/MAILLEUR/FICHE_7566_TUNNEL/Fiche_7566_TUNNEL.py', '/tmp/Fiche_7566_TUNNEL.med', 3,3,10,10,10,10, 'Maillage d un tunnel')) # self.insereLigneAutoId(('Fiche_7957_AILETTE', '/home/H77945/CAS_TEST/MAILLEUR/FICHE_7957_AILETTE/Fiche_7957_AILETTE.py', '/tmp/Fiche_7957_AILETTE.med', 1,2,10,10,10,10, 'Maillage d une attache d aillette')) @@ -48,7 +48,7 @@ class TableMaillages (TableDeBase): texteQuery="select id, nomScript,medResultat from Maillages;" maQuery.exec_(texteQuery) listeMaillages=[] - while(maQuery.next()): + while(next(maQuery)): listeMaillages.append((maQuery.value(0).toInt()[0], maQuery.value(1).toString(), maQuery.value(2).toString())) return listeMaillages @@ -59,18 +59,18 @@ class TableMaillages (TableDeBase): texteQuery="select id, nomScript,medResultat from Maillages where id = " + str(idM) +';' maQuery.exec_(texteQuery) maSize=0 - while(maQuery.next()): + while(next(maQuery)): maSize+=1 newListeMaillages.append((maQuery.value(0).toInt()[0], maQuery.value(1).toString(), maQuery.value(2).toString())) if maSize != 1 : - print "impossible de traiter le maillage : ", idM + print("impossible de traiter le maillage : ", idM) return newListeMaillages def getSeuilsPourMaillage(self,idMaillage): texteQuery="select id,nomMaillage,seuilCPU,seuilRatio,seuilTaille,seuilNbMaille from Maillages where id = "+ str(idMaillage) +" ;" maQuery=QSqlQuery() maQuery.exec_(texteQuery) - while(maQuery.next()): + while(next(maQuery)): l1 = maQuery.value(0).toInt()[0] l2 = maQuery.value(1).toString() l3 = maQuery.value(2).toInt()[0] @@ -84,7 +84,7 @@ class TableMaillages (TableDeBase): texteQuery="select id,nomMaillage from Maillages order by id;" maQuery=QSqlQuery() maQuery.exec_(texteQuery) - while(maQuery.next()): + while(next(maQuery)): maillagesIdListe.append( maQuery.value(0).toInt()[0]) maillagesNomListe.append( maQuery.value(1).toString()) return maillagesIdListe, maillagesNomListe @@ -92,9 +92,9 @@ class TableMaillages (TableDeBase): def getMailleurId(self,idMaillage): texteQuery="select idMailleur from Maillages where id = "+ str(idMaillage) +" ;" maQuery=QSqlQuery() - print texteQuery - print maQuery.exec_(texteQuery) + print(texteQuery) + print(maQuery.exec_(texteQuery)) maQuery.exec_(texteQuery) - while(maQuery.next()): + while(next(maQuery)): idMailleur = maQuery.value(0).toInt()[0] return idMailleur diff --git a/src/Tools/Verima/Base/tableMailles.py b/src/Tools/Verima/Base/tableMailles.py index caf72e128..cd279e7a5 100644 --- a/src/Tools/Verima/Base/tableMailles.py +++ b/src/Tools/Verima/Base/tableMailles.py @@ -1,5 +1,5 @@ from qtsalome import QSqlQuery -from tableDeBase import TableDeBase +from .tableDeBase import TableDeBase class TableMailles (TableDeBase): def __init__(self): @@ -17,7 +17,7 @@ class TableMailles (TableDeBase): texteQuery+="foreign key (idVersion) references Versions(id)," texteQuery+="primary key (idMaillage,idVersion,Entite));" - print "Creation de TableMailles : " , query.exec_(texteQuery) + print("Creation de TableMailles : " , query.exec_(texteQuery)) def getVal(self,idMaillage, idVersion, Entite): @@ -28,10 +28,10 @@ class TableMailles (TableDeBase): query.exec_(texteQuery) nb=0 val=0 # Valeur si l enregistrement n existe pas - while (query.next()) : + while (next(query)) : val=query.value(0).toInt()[0] nb=nb+1 - if nb > 1 : print "Double valeur de Reference dans la table des mailles" + if nb > 1 : print("Double valeur de Reference dans la table des mailles") return val @@ -40,6 +40,6 @@ class TableMailles (TableDeBase): texteQuery ="select distinct Entite from Mailles;" query.exec_(texteQuery) maListe=[] - while (query.next()) : + while (next(query)) : maListe.append(str(query.value(0).toString())) return maListe diff --git a/src/Tools/Verima/Base/tableMailleurs.py b/src/Tools/Verima/Base/tableMailleurs.py index ca76e602e..0c727c4dd 100644 --- a/src/Tools/Verima/Base/tableMailleurs.py +++ b/src/Tools/Verima/Base/tableMailleurs.py @@ -1,5 +1,5 @@ from qtsalome import QSqlQuery -from tableDeBase import TableDeBase +from .tableDeBase import TableDeBase class TableMailleurs (TableDeBase): def __init__(self): @@ -10,19 +10,19 @@ class TableMailleurs (TableDeBase): def createSqlTable(self): query=QSqlQuery() - print "Creation de TableMailleurs", query.exec_("create table Mailleurs(id integer primary key autoincrement, nomMailleur varchar(40));") + print("Creation de TableMailleurs", query.exec_("create table Mailleurs(id integer primary key autoincrement, nomMailleur varchar(40));")) def dejaRemplie(self): texteQuery="select * from Mailleurs where nomMailleur='Blsurf+Ghs3D';" maQuery=QSqlQuery() maQuery.exec_(texteQuery) nb=0 - while(maQuery.next()): nb=nb+1 + while(next(maQuery)): nb=nb+1 return nb def remplit(self): if self.dejaRemplie() : - print "Table Mailleurs deja initialisee" + print("Table Mailleurs deja initialisee") return self.insereLigneAutoId(('BLSURF',)) self.insereLigneAutoId(('NETGEN1D2D',)) @@ -34,7 +34,7 @@ class TableMailleurs (TableDeBase): # difficulte a construire le texte avec une seule valeur texteQuery='insert into Mailleurs (nomMailleur) values ("'+ str(valeurs[0])+ '");' maQuery=QSqlQuery() - if debug : print texteQuery, " " , maQuery.exec_(texteQuery) + if debug : print(texteQuery, " " , maQuery.exec_(texteQuery)) else : maQuery.exec_(texteQuery) def getTous(self): @@ -43,7 +43,7 @@ class TableMailleurs (TableDeBase): texteQuery="select * from Mailleurs;" maQuery=QSqlQuery() maQuery.exec_(texteQuery) - while(maQuery.next()): + while(next(maQuery)): l1.append( maQuery.value(0).toInt()[0]) l2.append( maQuery.value(1).toString()) return l1,l2 @@ -52,6 +52,6 @@ class TableMailleurs (TableDeBase): texteQuery="select nomMailleur from Mailleurs where id = " + str(mailleurId) + " ;" maQuery=QSqlQuery() maQuery.exec_(texteQuery) - while(maQuery.next()): + while(next(maQuery)): mailleurName=maQuery.value(0).toString() return mailleurName diff --git a/src/Tools/Verima/Base/tablePerfs.py b/src/Tools/Verima/Base/tablePerfs.py index 4955817eb..15751cfc2 100644 --- a/src/Tools/Verima/Base/tablePerfs.py +++ b/src/Tools/Verima/Base/tablePerfs.py @@ -1,5 +1,5 @@ from qtsalome import QSqlQuery -from tableDeBase import TableDeBase +from .tableDeBase import TableDeBase class TablePerfs (TableDeBase): def __init__(self): @@ -15,7 +15,7 @@ class TablePerfs (TableDeBase): texteQuery+="foreign key (Machine) references Machines(nomMachine)," texteQuery+="primary key (idMaillage, idVersion, Machine));" - print "Creation de TablePerfs : " , query.exec_(texteQuery) + print("Creation de TablePerfs : " , query.exec_(texteQuery)) def getVal(self,idMaillage,idVersion,Machine): query=QSqlQuery() @@ -24,10 +24,10 @@ class TablePerfs (TableDeBase): texteQuery +=" and Machine ='" + Machine + "';" query.exec_(texteQuery) cpu=None - while (query.next()) : + while (next(query)) : cpu=query.value(0).toInt()[0] - while (query.next()) : - print "plusieurs enregistrements dans perf pour ",str(idMaillage)," ",str(idVersion)," ",Machine + while (next(query)) : + print("plusieurs enregistrements dans perf pour ",str(idMaillage)," ",str(idVersion)," ",Machine) if cpu==None : - print "pas d enregistrement dans perf pour ",str(idMaillage)," ",str(idVersion)," ",Machine + print("pas d enregistrement dans perf pour ",str(idMaillage)," ",str(idVersion)," ",Machine) return cpu diff --git a/src/Tools/Verima/Base/tableRatios.py b/src/Tools/Verima/Base/tableRatios.py index 85397abde..1fdf274e8 100644 --- a/src/Tools/Verima/Base/tableRatios.py +++ b/src/Tools/Verima/Base/tableRatios.py @@ -1,5 +1,5 @@ from qtsalome import QSqlQuery -from tableDeBase import TableDeBase +from .tableDeBase import TableDeBase class TableRatios (TableDeBase): def __init__(self): @@ -20,7 +20,7 @@ class TableRatios (TableDeBase): texteQuery+="foreign key (idVersion) references Versions(id)," texteQuery+="primary key (idMaillage,idVersion));" - print "Creation de TableRatios : " , query.exec_(texteQuery) + print("Creation de TableRatios : " , query.exec_(texteQuery)) def getVal(self,idMaillage, idVersion, Entite): query=QSqlQuery() @@ -29,9 +29,9 @@ class TableRatios (TableDeBase): query.exec_(texteQuery) nb=0 val=0 # Valeur si l enregistrement n existe pas - while (query.next()) : + while (next(query)) : val=query.value(0).toFloat()[0] nb=nb+1 - if nb > 1 : print "Double valeur de Reference dans la table des mailles" + if nb > 1 : print("Double valeur de Reference dans la table des mailles") return val diff --git a/src/Tools/Verima/Base/tableTailles.py b/src/Tools/Verima/Base/tableTailles.py index 6e9637f16..43e39fee5 100644 --- a/src/Tools/Verima/Base/tableTailles.py +++ b/src/Tools/Verima/Base/tableTailles.py @@ -1,5 +1,5 @@ from qtsalome import QSqlQuery -from tableDeBase import TableDeBase +from .tableDeBase import TableDeBase class TableTailles (TableDeBase): def __init__(self): @@ -20,7 +20,7 @@ class TableTailles (TableDeBase): texteQuery+="foreign key (idVersion) references Versions(id)," texteQuery+="primary key (idMaillage,idVersion));" - print "Creation de TableTailles : " , query.exec_(texteQuery) + print("Creation de TableTailles : " , query.exec_(texteQuery)) def getVal(self,idMaillage, idVersion, Entite): query=QSqlQuery() @@ -29,9 +29,9 @@ class TableTailles (TableDeBase): query.exec_(texteQuery) nb=0 val=0 # Valeur si l enregistrement n existe pas - while (query.next()) : + while (next(query)) : val=query.value(0).toFloat()[0] nb=nb+1 - if nb > 1 : print "Double valeur de Reference dans la table des mailles" + if nb > 1 : print("Double valeur de Reference dans la table des mailles") return val diff --git a/src/Tools/Verima/Base/tableVersions.py b/src/Tools/Verima/Base/tableVersions.py index 9767f0394..afe900e32 100644 --- a/src/Tools/Verima/Base/tableVersions.py +++ b/src/Tools/Verima/Base/tableVersions.py @@ -1,5 +1,5 @@ from qtsalome import QSqlQuery -from tableDeBase import TableDeBase +from .tableDeBase import TableDeBase class TableVersions (TableDeBase): def __init__(self): @@ -12,7 +12,7 @@ class TableVersions (TableDeBase): query=QSqlQuery() texteQuery ="create table Versions(id integer primary key autoincrement, nomVersion varchar(10)," texteQuery+="commentaire varchar(30));" - print "Creation de TableVersions : " , query.exec_(texteQuery) + print("Creation de TableVersions : " , query.exec_(texteQuery)) def remplit(self): @@ -33,7 +33,7 @@ class TableVersions (TableDeBase): texteQuery ="select id, nomVersion from Versions where nomVersion ='" + version +"' ;" query.exec_(texteQuery) nb=0 - while(query.next()): + while(next(query)): nb=nb+1 id=query.value(0).toInt()[0] nom=query.value(1).toString() diff --git a/src/Tools/Verima/Base/versions.py b/src/Tools/Verima/Base/versions.py index b5af3482b..55cea45a1 100755 --- a/src/Tools/Verima/Base/versions.py +++ b/src/Tools/Verima/Base/versions.py @@ -17,5 +17,5 @@ def Chercheversion(salomePath): if __name__ == "__main__": - print Chercheversion("/local00/home/A96028/Appli") + print(Chercheversion("/local00/home/A96028/Appli")) diff --git a/src/Tools/Verima/CreeDocuments/jobHtml.py b/src/Tools/Verima/CreeDocuments/jobHtml.py index b307fc3d1..634827bf7 100755 --- a/src/Tools/Verima/CreeDocuments/jobHtml.py +++ b/src/Tools/Verima/CreeDocuments/jobHtml.py @@ -26,15 +26,15 @@ def compte_all(texte, subString): start = trouve + len(subString) def FormateTexte(texte,dico): - for clef in dico.keys(): + for clef in list(dico.keys()): texteARemplacer="%"+str(clef)+"%" remplacement=dico[clef] if texte.find(texteARemplacer) < 0 : - print "impossible de remplacer ",texteARemplacer, "Pas d'occurence" - print remplacement + print("impossible de remplacer ",texteARemplacer, "Pas d'occurence") + print(remplacement) continue if compte_all(texte,texteARemplacer) != 1 : - print "impossible de remplacer ",texteARemplacer, "trop d'occurences" + print("impossible de remplacer ",texteARemplacer, "trop d'occurences") continue remplacement=str(remplacement) texte=texte.replace(texteARemplacer,remplacement) diff --git a/src/Tools/Verima/Gui/maFenetreChoix.py b/src/Tools/Verima/Gui/maFenetreChoix.py index bc9e73e02..a92b14945 100644 --- a/src/Tools/Verima/Gui/maFenetreChoix.py +++ b/src/Tools/Verima/Gui/maFenetreChoix.py @@ -1,6 +1,6 @@ from desFenetreChoix_ui import Ui_Choix from qtsalome import * -from monEditor import TableEditor +from .monEditor import TableEditor # Import des panels diff --git a/src/Tools/Verima/Gui/monEditor.py b/src/Tools/Verima/Gui/monEditor.py index ecfd4fe44..13b5c9d49 100644 --- a/src/Tools/Verima/Gui/monEditor.py +++ b/src/Tools/Verima/Gui/monEditor.py @@ -37,7 +37,7 @@ class TableEditor(QDialog): self.view.pressed.connect(self.donneLigne) def donneLigne(self): - print "jjjjjjjjjjjjjjjj" + print("jjjjjjjjjjjjjjjj") def setTitle(self): fields=self.table.getFields() diff --git a/src/Tools/Verima/Stats/getCritere.py b/src/Tools/Verima/Stats/getCritere.py index 16239e170..920496506 100644 --- a/src/Tools/Verima/Stats/getCritere.py +++ b/src/Tools/Verima/Stats/getCritere.py @@ -3,8 +3,8 @@ import sys,os import salome -from getStats import getGroupesRef -from Type_Maille import dicoDimENtite +from .getStats import getGroupesRef +from .Type_Maille import dicoDimENtite def getCritere(dim,NomMesh,acritere,theStudy): import SMESH diff --git a/src/Tools/Verima/Stats/getStats.py b/src/Tools/Verima/Stats/getStats.py index 3f329c71b..a5d46d082 100644 --- a/src/Tools/Verima/Stats/getStats.py +++ b/src/Tools/Verima/Stats/getStats.py @@ -30,7 +30,7 @@ def getStatsMaillage(maillage,fichierMed): for i in range(len(mesures)): txt += str(SMESH.EntityType._item(i))+ " " +str(mesures[SMESH.EntityType._item(i)]) + "\n" - from utiles import writeFile + from .utiles import writeFile writeFile(fichier,txt) @@ -41,7 +41,7 @@ def getStatsGroupes(maillage,fichierMedResult): fichierGroupe=fichierMedResult.replace('.med','_groupesRef.res') lGroups=getGroupesRef(fichierGroupe) if len(lGroups)==0: - print "pas de Groupe de Reference " + print("pas de Groupe de Reference ") try : os.remove(fichierGroupe) return @@ -62,7 +62,7 @@ def getStatsStatSurGroupes(maillage,groupe,fichierStatGroupe): import SMESH for i in range(len(mesures)): txt += str(SMESH.EntityType._item(i))+ " " +str(mesures[SMESH.EntityType._item(i)]) + "\n" - from utiles import writeFile + from .utiles import writeFile writeFile(fichierStatGroupe,txt) diff --git a/src/Tools/Verima/Stats/job.py b/src/Tools/Verima/Stats/job.py index 23e646c59..6ee955236 100644 --- a/src/Tools/Verima/Stats/job.py +++ b/src/Tools/Verima/Stats/job.py @@ -26,7 +26,7 @@ class Job: a=os.system(commande+" -t "+script) fin=time.time() self.CPU=fin-debut - print " Temps d execution : ", self.CPU + print(" Temps d execution : ", self.CPU) #stdout, stderr = p.communicate() @@ -35,7 +35,7 @@ class Job: try: text=open(self.fichierStatResult).read() except: - print "Impossible d'ouvrir le fichier: ", str(self.fichierStatResult) + print("Impossible d'ouvrir le fichier: ", str(self.fichierStatResult)) exit(1) liste=text.split() i=0 @@ -55,7 +55,7 @@ class Job: try: text=open(fichier).read() except: - print "Impossible d'ouvrir le fichier: ", str(fichier) + print("Impossible d'ouvrir le fichier: ", str(fichier)) exit(1) liste=text.split(",") return liste @@ -67,7 +67,7 @@ class Job: try: text=open(fichier).read() except: - print "Impossible d'ouvrir le fichier: ", str(fichier) + print("Impossible d'ouvrir le fichier: ", str(fichier)) exit(1) liste=text.split(",") return liste @@ -80,7 +80,7 @@ class Job: try: text=open(fichier).read() except: - print "Impossible d'ouvrir le fichier: ", str(fichier) + print("Impossible d'ouvrir le fichier: ", str(fichier)) exit(1) liste=text.split() i=0 @@ -98,7 +98,7 @@ class Job: try: text=open(fichier).read() except: - print "Impossible d'ouvrir le fichier: ", str(fichier) + print("Impossible d'ouvrir le fichier: ", str(fichier)) exit(1) liste=text.split(",") # print "taille",liste @@ -110,7 +110,7 @@ class Job: try: text=open(fichier).read() except: - print "Impossible d'ouvrir le fichier: ", str(fichier) + print("Impossible d'ouvrir le fichier: ", str(fichier)) exit(1) liste=text.split(",") return liste diff --git a/src/Tools/Verima/Stats/ref.py b/src/Tools/Verima/Stats/ref.py index fc3a3e2cd..40b4d86ee 100644 --- a/src/Tools/Verima/Stats/ref.py +++ b/src/Tools/Verima/Stats/ref.py @@ -21,10 +21,10 @@ class Ref: seuil=self.maBase.maTableMaillages.getVal(self.idMaillage,"seuilCPU") seuilHaut=cpuAvant*(100+seuil)/100. if NbSec > seuilHaut : - print "Probleme consommation CPU : " - print " cpu reference : ", cpuAvant - print " seuil : ", seuil - print " CPU : ", NbSec + print("Probleme consommation CPU : ") + print(" cpu reference : ", cpuAvant) + print(" seuil : ", seuil) + print(" CPU : ", NbSec) return True return False @@ -37,10 +37,10 @@ class Ref: seuilHaut=valAvant*(100+seuil)/100. seuilBas=valAvant*(100-seuil)/100. if (valTrouvee < seuilBas) or (valTrouvee > seuilHaut) : - print "Probleme sur le nombre de Mailles de type : ", nomColonne - print " nb reference : ", valAvant - print " seuil : ", seuil - print " nb : ", valTrouvee + print("Probleme sur le nombre de Mailles de type : ", nomColonne) + print(" nb reference : ", valAvant) + print(" seuil : ", seuil) + print(" nb : ", valTrouvee) return True i=i+1 return False @@ -54,10 +54,10 @@ class Ref: seuilHaut=valAvant*(100+seuil)/100. seuilBas=valAvant*(100-seuil)/100. if (valTrouvee < seuilBas) or (valTrouvee > seuilHaut) : - print "Probleme sur le nombre de Mailles de type : ", nomColonne - print " nb reference : ", valAvant - print " seuil : ", seuil - print " nb : ", valTrouvee + print("Probleme sur le nombre de Mailles de type : ", nomColonne) + print(" nb reference : ", valAvant) + print(" seuil : ", seuil) + print(" nb : ", valTrouvee) return True i=i+1 return False @@ -75,10 +75,10 @@ class Ref: seuilHaut=valAvant*(100+seuil)/100. seuilBas=valAvant*(100-seuil)/100. if (valTrouvee < seuilBas) or (valTrouvee > seuilHaut) : - print "Probleme sur le nombre de Mailles de type : ", nomColonne - print " nb reference : ", valAvant - print " seuil : ", seuil - print " nb : ", valTrouvee + print("Probleme sur le nombre de Mailles de type : ", nomColonne) + print(" nb reference : ", valAvant) + print(" seuil : ", seuil) + print(" nb : ", valTrouvee) return True return False @@ -94,10 +94,10 @@ class Ref: seuilHaut=valAvant*(100+seuil)/100 seuilBas=valAvant*(100-seuil)/100 if (valTrouvee < seuilBas) or (valTrouvee > seuilHaut) : - print "Probleme sur le nombre de Mailles de type : ", nomColonne, "pour le groupe ", nomGroupe - print " nb reference : ", valAvant - print " seuil : ", seuil - print " nb : ", valTrouvee + print("Probleme sur le nombre de Mailles de type : ", nomColonne, "pour le groupe ", nomGroupe) + print(" nb reference : ", valAvant) + print(" seuil : ", seuil) + print(" nb : ", valTrouvee) return True return False diff --git a/src/Tools/Verima/Stats/utiles.py b/src/Tools/Verima/Stats/utiles.py index 08e1a8f25..e7d2156c0 100644 --- a/src/Tools/Verima/Stats/utiles.py +++ b/src/Tools/Verima/Stats/utiles.py @@ -4,7 +4,7 @@ def writeFile( fn, txt = None): if txt == None : return if fn == None : return - fn = unicode(fn) + fn = str(fn) try: f = open(fn, 'wb') f.write(txt) diff --git a/src/Tools/Verima/ajoutEnreg.py b/src/Tools/Verima/ajoutEnreg.py index 5f227debf..57d18dcc6 100755 --- a/src/Tools/Verima/ajoutEnreg.py +++ b/src/Tools/Verima/ajoutEnreg.py @@ -6,7 +6,7 @@ installDir=os.path.join(rep,'..') sys.path.insert(0,installDir) from qtsalome import * -from Base.dataBase import Base +from .Base.dataBase import Base def completeDatabase(fichier,table,enregistrement): maBase=Base(fichier) @@ -18,8 +18,8 @@ def completeDatabase(fichier,table,enregistrement): nbCols=model.columnCount() -1 if table == "TableGroupesRef" : nbCols==nbCols+1 if len(enregistrement) != nbCols : - print "mauvais nb de valeurs" - print "Attention, ne pas renter d'Id" + print("mauvais nb de valeurs") + print("Attention, ne pas renter d'Id") if table == "TableGroupesRef" : matable.insereLigne(enregistrement) else : matable.insereLigneAutoId(enregistrement) maBase.close() @@ -33,10 +33,10 @@ if __name__ == "__main__": p.add_option('-t',dest='table',help='nom de la table a completer') options, args = p.parse_args() if options.table==None : - print "table obligatoire" + print("table obligatoire") exit() if options.table not in ("TableMaillages","TableMailleurs","TableGroupesRef","TableVersions") : - print "la table doit etre : TableMaillages ou TableMailleurs ou TableGroupesRef ou TableVersions" + print("la table doit etre : TableMaillages ou TableMailleurs ou TableGroupesRef ou TableVersions") exit() enregistrement=tuple(args) completeDatabase(options.database,options.table,enregistrement) diff --git a/src/Tools/Verima/compareVersions.py b/src/Tools/Verima/compareVersions.py index 64738b3d2..9ceb0fc50 100755 --- a/src/Tools/Verima/compareVersions.py +++ b/src/Tools/Verima/compareVersions.py @@ -3,8 +3,8 @@ import sys import os -from Base.dataBase import Base -from Base.versions import Chercheversion +from .Base.dataBase import Base +from .Base.versions import Chercheversion if __name__ == "__main__": diff --git a/src/Tools/Verima/createDatabase.py b/src/Tools/Verima/createDatabase.py index ad375ed57..ce5986111 100755 --- a/src/Tools/Verima/createDatabase.py +++ b/src/Tools/Verima/createDatabase.py @@ -1,7 +1,7 @@ #!/usr/bin/env python import sys -from Base.dataBase import Base +from .Base.dataBase import Base def creeDatabase(fichier): maBase=Base(fichier) diff --git a/src/Tools/Verima/lance.py b/src/Tools/Verima/lance.py index aadb04dfe..9fd326ef8 100755 --- a/src/Tools/Verima/lance.py +++ b/src/Tools/Verima/lance.py @@ -1,7 +1,7 @@ #!/usr/bin/env python from qtsalome import * -from Gui.myMain_ui import Ui_Gestion +from .Gui.myMain_ui import Ui_Gestion import sys @@ -30,19 +30,19 @@ class MonAppli(Ui_Gestion,QWidget): pass def BCreePressed(self): - from Gui.monNomBase import DataBaseName + from .Gui.monNomBase import DataBaseName maW=DataBaseName(self) maW.exec_() - from createDatabase import creeDatabase + from .createDatabase import creeDatabase creeDatabase(self.nomBase) def BVuePressed(self): if self.nomBase == "" : - from Gui.monNomBase import DataBaseName + from .Gui.monNomBase import DataBaseName maW=DataBaseName(self) maW.exec_() - from Gui.maFenetreChoix import MaFenetreChoix - from Base.dataBase import Base + from .Gui.maFenetreChoix import MaFenetreChoix + from .Base.dataBase import Base maBase=Base(self.nomBase) maBase.initialise() window = MaFenetreChoix(maBase) diff --git a/src/Tools/Verima/passeJobs.py b/src/Tools/Verima/passeJobs.py index f88b0c6b2..74cb9a078 100755 --- a/src/Tools/Verima/passeJobs.py +++ b/src/Tools/Verima/passeJobs.py @@ -3,8 +3,8 @@ import sys import os -from Base.dataBase import Base -from Base.versions import Chercheversion +from .Base.dataBase import Base +from .Base.versions import Chercheversion if __name__ == "__main__": @@ -17,11 +17,11 @@ if __name__ == "__main__": p.add_option('-f',dest='force',default=True,help='force la passage des jobs meme si l execution a deja eu lieu sur cette machine pour cette version de salome') options, args = p.parse_args() if len(args) == 0 and options.all== False: - print "Enter -a ou un numero de job" - print 2 + print("Enter -a ou un numero de job") + print(2) exit() if options.salomePath==None : - print "chemin du runAppli obligatoire" + print("chemin du runAppli obligatoire") exit() if options.version==None : options.version=Chercheversion(options.salomePath) diff --git a/src/Tools/YamsPlug/monViewText.py b/src/Tools/YamsPlug/monViewText.py index ddc21501e..3109bfe8a 100644 --- a/src/Tools/YamsPlug/monViewText.py +++ b/src/Tools/YamsPlug/monViewText.py @@ -79,7 +79,7 @@ class MonViewText(Ui_ViewExe, QDialog): f.write(cmds) self.make_executable(nomFichier) - if verbose: print("INFO: MGSurfOpt launch script file: %s" % nomFichier) + if verbose: print(("INFO: MGSurfOpt launch script file: %s" % nomFichier)) self.monExe.start(nomFichier) self.monExe.closeWriteChannel() @@ -96,22 +96,22 @@ class MonViewText(Ui_ViewExe, QDialog): savedir=os.environ['HOME'] fn = QFileDialog.getSaveFileName(None,"Save File",savedir) if fn.isNull() : return - ulfile = os.path.abspath(unicode(fn)) + ulfile = os.path.abspath(str(fn)) try: f = open(fn, 'wb') f.write(str(self.TB_Exe.toPlainText())) f.close() - except IOError, why: + except IOError as why: QMessageBox.critical(self, 'Save File', - 'The file %1 could not be saved.
Reason: %2'%(unicode(fn), str(why))) + 'The file %1 could not be saved.
Reason: %2'%(str(fn), str(why))) def readFromStdErr(self): a=self.monExe.readAllStandardError() - self.TB_Exe.append(unicode(a.data().encode())) + self.TB_Exe.append(str(a.data().encode())) def readFromStdOut(self) : a=self.monExe.readAllStandardOutput() - aa=unicode(a.data()) + aa=str(a.data()) self.TB_Exe.append(aa) def finished(self): diff --git a/src/Tools/YamsPlug/monYamsPlugDialog.py b/src/Tools/YamsPlug/monYamsPlugDialog.py index efdaa3154..90e491797 100644 --- a/src/Tools/YamsPlug/monYamsPlugDialog.py +++ b/src/Tools/YamsPlug/monYamsPlugDialog.py @@ -223,7 +223,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): #myStudy.IsStudyLocked() myComponent = myStudy.FindComponent(name) if myComponent == None: - print "myComponent not found, create" + print("myComponent not found, create") myComponent = myBuilder.NewComponent(name) AName = myBuilder.FindOrCreateAttribute(myComponent, "AttributeName") AName.SetValue(name) @@ -238,7 +238,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(False) self.num += 1 - if verbose: print("save %s in Object Browser done: %s\n%s" % (name, myObject.GetID(), datai)) + if verbose: print(("save %s in Object Browser done: %s\n%s" % (name, myObject.GetID(), datai))) return True def PBSaveHypPressed(self): @@ -275,7 +275,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(False) self.num += 1 - if verbose: print("save %s in Object Browser done:\n%s" % (name, data)) + if verbose: print(("save %s in Object Browser done:\n%s" % (name, data))) return True def SP_toStr(self, widget): @@ -413,7 +413,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): if fd.exec_(): infile = fd.selectedFiles()[0] self.LE_MeshFile.setText(infile) - self.fichierIn=unicode(infile).encode("latin-1") + self.fichierIn=str(infile).encode("latin-1") self.MeshIn="" self.LE_MeshSmesh.setText("") @@ -422,7 +422,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): if fd.exec_(): infile = fd.selectedFiles()[0] self.LE_ParamsFile.setText(infile) - self.paramsFile=unicode(infile).encode("latin-1") + self.paramsFile=str(infile).encode("latin-1") def meshFileNameChanged(self): self.fichierIn=str(self.LE_MeshFile.text()) @@ -504,7 +504,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): except: pass - style = unicode(self.style).encode("latin-1") + style = str(self.style).encode("latin-1") # Translation of old Yams options to new MG-SurfOpt options if style == "0" : self.commande+= " --optimisation only" @@ -543,7 +543,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget): self.commande+=" --in " + self.fichierIn self.commande+=" --out " + self.fichierOut - print self.commande + print(self.commande) return True def clean(self): diff --git a/src/Tools/ZCracksPlug/Zset.py b/src/Tools/ZCracksPlug/Zset.py index 464619e2b..6ae9d9ec2 100644 --- a/src/Tools/ZCracksPlug/Zset.py +++ b/src/Tools/ZCracksPlug/Zset.py @@ -1,7 +1,7 @@ import os, tempfile, shutil -import utilityFunctions as uF -from output import message +from . import utilityFunctions as uF +from .output import message def medToGeo(medFile, geoFile, tmpdir, opt=[], verbose=0): medLoc=os.path.dirname(medFile) @@ -114,18 +114,18 @@ def insertCrack(data, names, tmpdir='./zcracks_temp', verbose=0): maxS=data['maxSize'][0] extrL=data['extractLength'][0] - grad = data['gradation'][0] if 'gradation' in data.keys() else 1.3 - quad = data['quad'] if 'quad' in data.keys() else False - cas2D = data['is2D'] if 'is2D' in data.keys() else False - refine = data['refine'] if 'refine' in data.keys() else False - nbLay = data['layers'][0] if 'layers' in data.keys() else 5 - nbIter = data['iterations'][0] if 'iterations' in data.keys() else 2 - - Gvol = data['grVol'] if 'grVol' in data.keys() else '' - Gfac = data['grFace'] if 'grFace' in data.keys() else '' - Gedg = data['grEdge'] if 'grEdge' in data.keys() else '' - Gnod = data['grNodes'] if 'grNodes' in data.keys() else '' - surfOpt = data['surfopt'] if 'surfopt' in data.keys() else '' + grad = data['gradation'][0] if 'gradation' in list(data.keys()) else 1.3 + quad = data['quad'] if 'quad' in list(data.keys()) else False + cas2D = data['is2D'] if 'is2D' in list(data.keys()) else False + refine = data['refine'] if 'refine' in list(data.keys()) else False + nbLay = data['layers'][0] if 'layers' in list(data.keys()) else 5 + nbIter = data['iterations'][0] if 'iterations' in list(data.keys()) else 2 + + Gvol = data['grVol'] if 'grVol' in list(data.keys()) else '' + Gfac = data['grFace'] if 'grFace' in list(data.keys()) else '' + Gedg = data['grEdge'] if 'grEdge' in list(data.keys()) else '' + Gnod = data['grNodes'] if 'grNodes' in list(data.keys()) else '' + surfOpt = data['surfopt'] if 'surfopt' in list(data.keys()) else '' if not os.path.isdir(tmpdir): os.mkdir(tmpdir) diff --git a/src/Tools/ZCracksPlug/__init__.py b/src/Tools/ZCracksPlug/__init__.py index 61ea883f4..e782967c9 100644 --- a/src/Tools/ZCracksPlug/__init__.py +++ b/src/Tools/ZCracksPlug/__init__.py @@ -1,6 +1,6 @@ import sys, os, shutil, pickle, tempfile -import main, genereCrack, Zset -import utilityFunctions as uF +from . import main, genereCrack, Zset +from . import utilityFunctions as uF #commande="/bin/bash -c ""source $HOME/zebulon/Z8.6.6_NEW/do_config_bash""" #os.system(commande) @@ -20,16 +20,16 @@ def IHM(): def SCRIPT(dataFile=None, data=None, dim=3, names=None): if dim!=3 and dim!=2: - print 'ERROR' + print('ERROR') return(False) if dataFile==None and data==None: - print 'One of dataFile or data is mandatory' + print('One of dataFile or data is mandatory') return(False) if data==None: data=pickle.load(open(dataFile,'r')) - print data + print(data) tmpdir=tempfile.mkdtemp() uF.removeFromSessionPath('LD_LIBRARY_PATH', 'Meshgems-2111') @@ -47,7 +47,7 @@ def SCRIPT(dataFile=None, data=None, dim=3, names=None): for f in [crackMed, crackedMed, saneGeo, crackGeo, crackedGeo]: if os.path.isfile(f): os.remove(f) - print crackMed + print(crackMed) genereCrack.main(data, crackMed) goOn=os.path.isfile(crackMed) diff --git a/src/Tools/ZCracksPlug/casTests/launchCas.py b/src/Tools/ZCracksPlug/casTests/launchCas.py index e4a4d163c..88a670581 100644 --- a/src/Tools/ZCracksPlug/casTests/launchCas.py +++ b/src/Tools/ZCracksPlug/casTests/launchCas.py @@ -1,7 +1,7 @@ from Zcracks import genereCrack, Zset from Zcracks import utilityFunctions as uF -import genereCube +from . import genereCube from math import sqrt @@ -19,7 +19,7 @@ import string #tmpdir = "/local00/home/B27118/projets/Zcracks/Zcracks/casTests/tmpdir" #if not os.path.isdir(tmpdir): os.mkdir(tmpdir) tmpdir=tempfile.mktemp(prefix='tmpZcracks') -print "tmpdir=", tmpdir +print("tmpdir=", tmpdir) meshgemsdir=os.environ('MESHGEMSHOME') if len(meshgemsdir) > 0: @@ -194,18 +194,18 @@ def LAUNCH(listCas=[]): OK=[] NOOK=[] - for s in synthese.keys(): + for s in list(synthese.keys()): if synthese[s]: OK.append(s) else: NOOK.append(s) - print 'OK:' - print OK - print ' ' - print 'NOOK:' - print NOOK - print ' ' + print('OK:') + print(OK) + print(' ') + print('NOOK:') + print(NOOK) + print(' ') return(synthese) diff --git a/src/Tools/ZCracksPlug/casTests/launchManuel.py b/src/Tools/ZCracksPlug/casTests/launchManuel.py index 1eadd07c6..e6f569562 100644 --- a/src/Tools/ZCracksPlug/casTests/launchManuel.py +++ b/src/Tools/ZCracksPlug/casTests/launchManuel.py @@ -2,7 +2,7 @@ import os, tempfile directory=tempfile.mktemp(prefix='tmpZcracks') -print "directory=", tmpdir +print("directory=", tmpdir) # Tous les cas listCas=['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21'] @@ -23,5 +23,5 @@ for cas in listCas: synthese[cas]= os.path.isfile(result) -print synthese +print(synthese) diff --git a/src/Tools/ZCracksPlug/ellipse.py b/src/Tools/ZCracksPlug/ellipse.py index 9ffeb8b66..717287880 100644 --- a/src/Tools/ZCracksPlug/ellipse.py +++ b/src/Tools/ZCracksPlug/ellipse.py @@ -22,8 +22,8 @@ import GEOM from salome.geom import geomBuilder import math import SALOMEDS -import utilityFunctions as uF -from output import message +from . import utilityFunctions as uF +from .output import message #ellipse.generate(data_demi_grand_axe, data_centre, data_normale,data_direction, data_demi_petit_axe, data_angle, rayon_entaille,extension, outFile) #if True: @@ -192,7 +192,7 @@ def generate(data_demi_grand_axe, data_centre, data_normale, Maillage.ExportMED( outFile, 0, SMESH.MED_V2_2, 1, None ,1) smesh.SetName(Maillage.GetMesh(), 'MAILLAGE_FISSURE') except: - print 'ExportToMEDX() failed. Invalid file name?' + print('ExportToMEDX() failed. Invalid file name?') ## Set names of Mesh objects diff --git a/src/Tools/ZCracksPlug/genereCrack.py b/src/Tools/ZCracksPlug/genereCrack.py index 372772b43..0f434a30e 100644 --- a/src/Tools/ZCracksPlug/genereCrack.py +++ b/src/Tools/ZCracksPlug/genereCrack.py @@ -1,7 +1,7 @@ import os, shutil -import sphere, ellipse, rectangle -import utilityFunctions as uF -from output import message +from . import sphere, ellipse, rectangle +from . import utilityFunctions as uF +from .output import message def main(data, outFile): activeCrack=data['crack']['actif'] @@ -32,7 +32,7 @@ def generateEllipse(crack, outFile): res=False demiGrandAxe=crack['Rayon'][0] - if 'Rayon 2' not in crack.keys(): crack['Rayon 2']=[] + if 'Rayon 2' not in list(crack.keys()): crack['Rayon 2']=[] if len(crack['Rayon 2'])==0: demiPetitAxe=demiGrandAxe else: @@ -54,7 +54,7 @@ def generateEllipse(crack, outFile): res=False normale=crack['Normale'] - if 'Direction' not in crack.keys(): crack['Direction']=[] + if 'Direction' not in list(crack.keys()): crack['Direction']=[] if len(crack['Direction'])==0: if normale==[1.,0.,0.]: direction=[0.,1.,0.] @@ -71,7 +71,7 @@ def generateEllipse(crack, outFile): message('E','Normale and Direction are equals',goOn=True) res=False - if 'Angle' not in crack.keys(): crack['Angle']=[] + if 'Angle' not in list(crack.keys()): crack['Angle']=[] if len(crack['Angle'])==0: angle=0.0 else: @@ -81,7 +81,7 @@ def generateEllipse(crack, outFile): res=False angle=crack['Angle'][0] - if 'Rayon entaille' not in crack.keys(): crack['Rayon entaille']=[] + if 'Rayon entaille' not in list(crack.keys()): crack['Rayon entaille']=[] if len(crack['Rayon entaille'])==0: rayon_entaille=0.0 else: @@ -91,7 +91,7 @@ def generateEllipse(crack, outFile): res=False rayon_entaille=crack['Rayon entaille'][0] - if 'Extension' not in crack.keys(): crack['Extension']=[] + if 'Extension' not in list(crack.keys()): crack['Extension']=[] if len(crack['Extension'])==0: extension=0.0 else: @@ -117,7 +117,7 @@ def generateRectangle(crack, outFile): res=False longueur=crack['Longueur'][0] - if 'Largeur' not in crack.keys(): crack['Largeur']=[] + if 'Largeur' not in list(crack.keys()): crack['Largeur']=[] if len(crack['Largeur'])==0: largeur=longueur else: @@ -145,7 +145,7 @@ def generateRectangle(crack, outFile): res=False direction=crack['Direction'] - if 'Angle' not in crack.keys(): crack['Angle']=[] + if 'Angle' not in list(crack.keys()): crack['Angle']=[] if len(crack['Angle'])==0: angle=0.0 else: @@ -155,7 +155,7 @@ def generateRectangle(crack, outFile): res=False angle=crack['Angle'][0] - if 'Rayon' not in crack.keys(): crack['Rayon']=[] + if 'Rayon' not in list(crack.keys()): crack['Rayon']=[] if len(crack['Rayon'])==0: rayon=0.0 else: @@ -165,7 +165,7 @@ def generateRectangle(crack, outFile): res=False rayon=crack['Rayon'][0] - if 'Rayon entaille' not in crack.keys(): crack['Rayon entaille']=[] + if 'Rayon entaille' not in list(crack.keys()): crack['Rayon entaille']=[] if len(crack['Rayon entaille'])==0: rayon_entaille=0.0 else: diff --git a/src/Tools/ZCracksPlug/main.py b/src/Tools/ZCracksPlug/main.py index e4b3e526d..347c7c0ad 100644 --- a/src/Tools/ZCracksPlug/main.py +++ b/src/Tools/ZCracksPlug/main.py @@ -9,11 +9,11 @@ except: from PyQt4.QtCore import * from PyQt4.QtGui import * -import utilityFunctions as uF -import genereCrack, Zset, output, zcracks_ui +from . import utilityFunctions as uF +from . import genereCrack, Zset, output, zcracks_ui -from output import message, init -from zcracks_ui import Ui_Zui +from .output import message, init +from .zcracks_ui import Ui_Zui # --------------------- @@ -27,7 +27,7 @@ def stringToFloat(string, typ=float): if str(string).replace(' ','')=='': out=[] else: - out=map(typ, str(string).split()) + out=list(map(typ, str(string).split())) return(out) def addExtension(string, extension): @@ -291,10 +291,10 @@ class ShipHolderApplication(QGroupBox): else: obj.setText(QString(self.data[self.lineEditNames[cont]])) - self.ui.CBQuad.setChecked(True if 'quad' in self.data.keys() and self.data['quad'] else False) - self.ui.CBBarsoum.setChecked(True if 'barsoum' in self.data.keys() and self.data['barsoum'] else False) - self.ui.CBIs2D.setChecked(True if 'is2D' in self.data.keys() and self.data['is2D'] else False) - self.ui.CBRefine.setChecked(True if 'refine' in self.data.keys() and self.data['refine'] else False) + self.ui.CBQuad.setChecked(True if 'quad' in list(self.data.keys()) and self.data['quad'] else False) + self.ui.CBBarsoum.setChecked(True if 'barsoum' in list(self.data.keys()) and self.data['barsoum'] else False) + self.ui.CBIs2D.setChecked(True if 'is2D' in list(self.data.keys()) and self.data['is2D'] else False) + self.ui.CBRefine.setChecked(True if 'refine' in list(self.data.keys()) and self.data['refine'] else False) @@ -370,10 +370,10 @@ class ShipHolderApplication(QGroupBox): if not test2: message('A','No mesh file to visualize') else: - print medit+' %s' %meshFile2 + print(medit+' %s' %meshFile2) system(medit+' %s' %meshFile2) else: - print medit+' %s' %meshFile1 + print(medit+' %s' %meshFile1) system(medit+' %s' %meshFile1) return() diff --git a/src/Tools/ZCracksPlug/rectangle.py b/src/Tools/ZCracksPlug/rectangle.py index 2f6933e25..d5d8108cc 100644 --- a/src/Tools/ZCracksPlug/rectangle.py +++ b/src/Tools/ZCracksPlug/rectangle.py @@ -21,8 +21,8 @@ import GEOM from salome.geom import geomBuilder import math import SALOMEDS -import utilityFunctions as uF -from output import message +from . import utilityFunctions as uF +from .output import message #import GEOM_Gen.ild #rectangle.generate(data_longueur,data_largeur,data_centre,data_normale,data_direction,data_angle,data_rayon,rayon_entaille,extension,outFile) @@ -219,7 +219,7 @@ def generate(data_longueur,data_largeur,data_centre, Maillage.ExportMED( outFile, 0, SMESH.MED_V2_2, 1, None ,1) smesh.SetName(Maillage.GetMesh(), 'MAILLAGE_FISSURE') except: - print 'ExportToMEDX() failed. Invalid file name?' + print('ExportToMEDX() failed. Invalid file name?') if salome.sg.hasDesktop(): diff --git a/src/Tools/ZCracksPlug/sphere.py b/src/Tools/ZCracksPlug/sphere.py index 79542b2c5..5de3c5cbf 100644 --- a/src/Tools/ZCracksPlug/sphere.py +++ b/src/Tools/ZCracksPlug/sphere.py @@ -21,8 +21,8 @@ import GEOM from salome.geom import geomBuilder import math import SALOMEDS -import utilityFunctions as uF -from output import message +from . import utilityFunctions as uF +from .output import message #import GEOM_Gen.ild @@ -60,7 +60,7 @@ def generate(data_rayon,data_centre,outFile): Maillage.ExportMED( outFile, 0, SMESH.MED_V2_2, 1, None ,1) smesh.SetName(Maillage.GetMesh(), 'MAILLAGE_FISSURE') except: - print 'ExportToMEDX() failed. Invalid file name?' + print('ExportToMEDX() failed. Invalid file name?') ## Set names of Mesh objects diff --git a/src/Tools/ZCracksPlug/utilityFunctions.py b/src/Tools/ZCracksPlug/utilityFunctions.py index 36db72580..3de3a7e2d 100644 --- a/src/Tools/ZCracksPlug/utilityFunctions.py +++ b/src/Tools/ZCracksPlug/utilityFunctions.py @@ -3,7 +3,7 @@ import numpy, subprocess, sys from os import remove, getpid, path, environ -from output import message +from .output import message def calcCoordVectors(normalIN, directionIN): V3TEMP=numpy.cross(normalIN,directionIN) @@ -260,8 +260,8 @@ def extendElsets(meshFile, outFile=None): while ifChanged : ifChanged=False for elemId in elemList[0]: - minColor=sys.maxint - maxColor=-sys.maxint + minColor=sys.maxsize + maxColor=-sys.maxsize for elemNodeId in mesh.GetElemNodes(elemId) : nodeColor=colorList[elemNodeId-1] if nodeColor 1: shortList.append(v[0]) if getNormals: diff --git a/src/Tools/blocFissure/gmu/fissureCoude.py b/src/Tools/blocFissure/gmu/fissureCoude.py index 224323567..c2fa0e36f 100644 --- a/src/Tools/blocFissure/gmu/fissureCoude.py +++ b/src/Tools/blocFissure/gmu/fissureCoude.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- -from geomsmesh import geompy, smesh -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog +from .geomsmesh import geompy, smesh +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog import math import GEOM @@ -14,13 +14,13 @@ import SMESH #import NETGENPlugin import logging -from fissureGenerique import fissureGenerique +from .fissureGenerique import fissureGenerique -from triedreBase import triedreBase -from genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut -from creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain -from construitFissureGenerale import construitFissureGenerale -from sortEdges import sortEdges +from .triedreBase import triedreBase +from .genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut +from .creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain +from .construitFissureGenerale import construitFissureGenerale +from .sortEdges import sortEdges O, OX, OY, OZ = triedreBase() @@ -336,7 +336,7 @@ class fissureCoude(fissureGenerique): externe = shapeFissureParams['externe'] lgInfluence = shapeFissureParams['lgInfluence'] self.elliptique = False - if shapeFissureParams.has_key('elliptique'): + if 'elliptique' in shapeFissureParams: self.elliptique = shapeFissureParams['elliptique'] diff --git a/src/Tools/blocFissure/gmu/fusionMaillageAttributionDefaut.py b/src/Tools/blocFissure/gmu/fusionMaillageAttributionDefaut.py index 703c02447..b599be6d1 100644 --- a/src/Tools/blocFissure/gmu/fusionMaillageAttributionDefaut.py +++ b/src/Tools/blocFissure/gmu/fusionMaillageAttributionDefaut.py @@ -6,16 +6,16 @@ Created on Tue Jun 24 09:14:13 2014 """ import logging -from geomsmesh import geompy -from geomsmesh import smesh -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog +from .geomsmesh import geompy +from .geomsmesh import smesh +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog import GEOM import SMESH -from listOfExtraFunctions import createNewMeshesFromCorner -from listOfExtraFunctions import createLinesFromMesh +from .listOfExtraFunctions import createNewMeshesFromCorner +from .listOfExtraFunctions import createLinesFromMesh # ----------------------------------------------------------------------------- # --- groupe de quadrangles de face transformé en face géométrique par filling diff --git a/src/Tools/blocFissure/gmu/genereElemsFissureElliptique.py b/src/Tools/blocFissure/gmu/genereElemsFissureElliptique.py index 62be40c77..6374be9fc 100644 --- a/src/Tools/blocFissure/gmu/genereElemsFissureElliptique.py +++ b/src/Tools/blocFissure/gmu/genereElemsFissureElliptique.py @@ -1,15 +1,15 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import geompy -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog - -from toreFissure import toreFissure -from ellipsoideDefaut import ellipsoideDefaut -from rotTrans import rotTrans -from genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut +from .geomsmesh import geompy +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog + +from .toreFissure import toreFissure +from .ellipsoideDefaut import ellipsoideDefaut +from .rotTrans import rotTrans +from .genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut # ----------------------------------------------------------------------------- # --- création élements géométriques fissure elliptique diff --git a/src/Tools/blocFissure/gmu/genereMeshCalculZoneDefaut.py b/src/Tools/blocFissure/gmu/genereMeshCalculZoneDefaut.py index 08e24748c..8e296f2cf 100644 --- a/src/Tools/blocFissure/gmu/genereMeshCalculZoneDefaut.py +++ b/src/Tools/blocFissure/gmu/genereMeshCalculZoneDefaut.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import smesh +from .geomsmesh import smesh from salome.smesh import smeshBuilder # ----------------------------------------------------------------------------- diff --git a/src/Tools/blocFissure/gmu/geomsmesh.py b/src/Tools/blocFissure/gmu/geomsmesh.py index 4c61d1b92..631a3e283 100644 --- a/src/Tools/blocFissure/gmu/geomsmesh.py +++ b/src/Tools/blocFissure/gmu/geomsmesh.py @@ -2,7 +2,7 @@ import logging #logging.info('start') -import initLog +from . import initLog import salome salome.salome_init() diff --git a/src/Tools/blocFissure/gmu/getCentreFondFiss.py b/src/Tools/blocFissure/gmu/getCentreFondFiss.py index 52f1f3bd9..34d3e09ca 100644 --- a/src/Tools/blocFissure/gmu/getCentreFondFiss.py +++ b/src/Tools/blocFissure/gmu/getCentreFondFiss.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import geompy -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog +from .geomsmesh import geompy +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog import bisect publie = False diff --git a/src/Tools/blocFissure/gmu/getStatsMaillageFissure.py b/src/Tools/blocFissure/gmu/getStatsMaillageFissure.py index 453b6b904..cf06fb33c 100644 --- a/src/Tools/blocFissure/gmu/getStatsMaillageFissure.py +++ b/src/Tools/blocFissure/gmu/getStatsMaillageFissure.py @@ -13,7 +13,7 @@ def getStatsMaillageFissure(maillage, referencesMaillageFissure, maillageFissure logging.debug('start') nomRep = '.' - if maillageFissureParams.has_key('nomRep'): + if 'nomRep' in maillageFissureParams: nomRep = maillageFissureParams['nomRep'] nomFicFissure = maillageFissureParams['nomFicFissure'] @@ -25,7 +25,7 @@ def getStatsMaillageFissure(maillage, referencesMaillageFissure, maillageFissure if maillage is not None: mesures = maillage.GetMeshInfo() d= {} - for key, value in mesures.iteritems(): + for key, value in mesures.items(): logging.debug( "key: %s value: %s", key, value) d[str(key)] = value logging.debug("dico mesures %s", d) diff --git a/src/Tools/blocFissure/gmu/getSubshapeIds.py b/src/Tools/blocFissure/gmu/getSubshapeIds.py index 778359646..15383c9cd 100644 --- a/src/Tools/blocFissure/gmu/getSubshapeIds.py +++ b/src/Tools/blocFissure/gmu/getSubshapeIds.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import geompy +from .geomsmesh import geompy # ----------------------------------------------------------------------------- # --- transformation d'une liste de subshapes en une liste d'Id diff --git a/src/Tools/blocFissure/gmu/identifieEdgesPeau.py b/src/Tools/blocFissure/gmu/identifieEdgesPeau.py index 70595896e..53b2cc5b9 100644 --- a/src/Tools/blocFissure/gmu/identifieEdgesPeau.py +++ b/src/Tools/blocFissure/gmu/identifieEdgesPeau.py @@ -2,12 +2,12 @@ import logging -from geomsmesh import geompy -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog +from .geomsmesh import geompy +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog -from substractSubShapes import substractSubShapes +from .substractSubShapes import substractSubShapes def identifieEdgesPeau(edgesFissExtPipe,verticesPipePeau, facePeau, facesPeauSorted, edgesPeauFondIn, fillingFaceExterne, aretesVivesC, aretesVivesCoupees): diff --git a/src/Tools/blocFissure/gmu/identifieElementsDebouchants.py b/src/Tools/blocFissure/gmu/identifieElementsDebouchants.py index fb03f94b7..4eb25795a 100644 --- a/src/Tools/blocFissure/gmu/identifieElementsDebouchants.py +++ b/src/Tools/blocFissure/gmu/identifieElementsDebouchants.py @@ -3,15 +3,15 @@ import logging import math -from geomsmesh import geompy -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog +from .geomsmesh import geompy +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog import traceback -from fissError import fissError +from .fissError import fissError -from produitMixte import produitMixte -from whichSide import whichSide +from .produitMixte import produitMixte +from .whichSide import whichSide def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond, edgesFondIn, edgesFondFiss, wireFondFiss, diff --git a/src/Tools/blocFissure/gmu/identifieElementsFissure.py b/src/Tools/blocFissure/gmu/identifieElementsFissure.py index fcad8c519..8add85194 100644 --- a/src/Tools/blocFissure/gmu/identifieElementsFissure.py +++ b/src/Tools/blocFissure/gmu/identifieElementsFissure.py @@ -2,13 +2,13 @@ import logging -from geomsmesh import geompy -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog +from .geomsmesh import geompy +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog -from extractionOrientee import extractionOrientee -from extractionOrienteeMulti import extractionOrienteeMulti +from .extractionOrientee import extractionOrientee +from .extractionOrienteeMulti import extractionOrienteeMulti def identifieElementsFissure(ifil, facesDefaut, partitionPeauFissFond, edgesPipeFiss, edgesFondFiss, aretesVivesC, diff --git a/src/Tools/blocFissure/gmu/identifieElementsGeometriquesPeau.py b/src/Tools/blocFissure/gmu/identifieElementsGeometriquesPeau.py index c60682c51..2fdd9251a 100644 --- a/src/Tools/blocFissure/gmu/identifieElementsGeometriquesPeau.py +++ b/src/Tools/blocFissure/gmu/identifieElementsGeometriquesPeau.py @@ -2,11 +2,11 @@ import logging -from identifieElementsFissure import identifieElementsFissure -from identifieElementsDebouchants import identifieElementsDebouchants -from trouveEdgesFissPeau import trouveEdgesFissPeau -from identifieFacesPeau import identifieFacesPeau -from identifieEdgesPeau import identifieEdgesPeau +from .identifieElementsFissure import identifieElementsFissure +from .identifieElementsDebouchants import identifieElementsDebouchants +from .trouveEdgesFissPeau import trouveEdgesFissPeau +from .identifieFacesPeau import identifieFacesPeau +from .identifieEdgesPeau import identifieEdgesPeau def identifieElementsGeometriquesPeau(ifil, partitionPeauFissFond, edgesPipeFiss, edgesFondFiss, wireFondFiss, aretesVivesC, diff --git a/src/Tools/blocFissure/gmu/identifieFacesEdgesFissureExterne.py b/src/Tools/blocFissure/gmu/identifieFacesEdgesFissureExterne.py index 12efab46c..170ad723b 100644 --- a/src/Tools/blocFissure/gmu/identifieFacesEdgesFissureExterne.py +++ b/src/Tools/blocFissure/gmu/identifieFacesEdgesFissureExterne.py @@ -2,10 +2,10 @@ import logging -from geomsmesh import geompy -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog +from .geomsmesh import geompy +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog def identifieFacesEdgesFissureExterne(fsFissuExt, edFisExtPe, edFisExtPi, edgesPipeFiss): """ diff --git a/src/Tools/blocFissure/gmu/identifieFacesPeau.py b/src/Tools/blocFissure/gmu/identifieFacesPeau.py index a8917ad78..ab009b7c8 100644 --- a/src/Tools/blocFissure/gmu/identifieFacesPeau.py +++ b/src/Tools/blocFissure/gmu/identifieFacesPeau.py @@ -2,13 +2,13 @@ import logging -from geomsmesh import geompy -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog +from .geomsmesh import geompy +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog -from sortFaces import sortFaces -from extractionOrientee import extractionOrientee +from .sortFaces import sortFaces +from .extractionOrientee import extractionOrientee def identifieFacesPeau(ifil, verticesPipePeau, facesOnside, wireFondFiss, verticesEdgesFondIn, pipexts, cercles, diff --git a/src/Tools/blocFissure/gmu/initEtude.py b/src/Tools/blocFissure/gmu/initEtude.py index 1e73886b6..c59b54d3a 100644 --- a/src/Tools/blocFissure/gmu/initEtude.py +++ b/src/Tools/blocFissure/gmu/initEtude.py @@ -7,4 +7,4 @@ def initEtude(): """ creation nouvelle etude salome """ - import geomsmesh + from . import geomsmesh diff --git a/src/Tools/blocFissure/gmu/insereFissureElliptique.py b/src/Tools/blocFissure/gmu/insereFissureElliptique.py index de8fbeb17..07ba99910 100644 --- a/src/Tools/blocFissure/gmu/insereFissureElliptique.py +++ b/src/Tools/blocFissure/gmu/insereFissureElliptique.py @@ -2,26 +2,26 @@ import logging import salome -from geomsmesh import geompy -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog -from geomsmesh import smesh +from .geomsmesh import geompy +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog +from .geomsmesh import smesh import SMESH import math -from partitionBlocDefaut import partitionBlocDefaut -from facesVolumesToriques import facesVolumesToriques -from facesCirculaires import facesCirculaires -from propagateTore import propagateTore -from sortGeneratrices import sortGeneratrices -from facesFissure import facesFissure -from facesToreInBloc import facesToreInBloc -from shapeSurFissure import shapeSurFissure -from meshBlocPart import meshBlocPart -from enleveDefaut import enleveDefaut -from regroupeSainEtDefaut import RegroupeSainEtDefaut -from putName import putName +from .partitionBlocDefaut import partitionBlocDefaut +from .facesVolumesToriques import facesVolumesToriques +from .facesCirculaires import facesCirculaires +from .propagateTore import propagateTore +from .sortGeneratrices import sortGeneratrices +from .facesFissure import facesFissure +from .facesToreInBloc import facesToreInBloc +from .shapeSurFissure import shapeSurFissure +from .meshBlocPart import meshBlocPart +from .enleveDefaut import enleveDefaut +from .regroupeSainEtDefaut import RegroupeSainEtDefaut +from .putName import putName # ----------------------------------------------------------------------------- # --- procedure complete fissure elliptique diff --git a/src/Tools/blocFissure/gmu/insereFissureGenerale.py b/src/Tools/blocFissure/gmu/insereFissureGenerale.py index a8619bdda..68195f8a4 100644 --- a/src/Tools/blocFissure/gmu/insereFissureGenerale.py +++ b/src/Tools/blocFissure/gmu/insereFissureGenerale.py @@ -2,40 +2,40 @@ import logging import salome -from geomsmesh import geompy -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog +from .geomsmesh import geompy +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog import GEOM -from geomsmesh import smesh +from .geomsmesh import smesh from salome.smesh import smeshBuilder import SMESH import math import bisect -from extractionOrientee import extractionOrientee -from extractionOrienteeMulti import extractionOrienteeMulti -from sortFaces import sortFaces -from sortEdges import sortEdges -from eliminateDoubles import eliminateDoubles -from substractSubShapes import substractSubShapes -from produitMixte import produitMixte -from findWireEndVertices import findWireEndVertices -from findWireIntermediateVertices import findWireIntermediateVertices -from orderEdgesFromWire import orderEdgesFromWire -from getSubshapeIds import getSubshapeIds -from putName import putName -from distance2 import distance2 -from enleveDefaut import enleveDefaut -from shapeSurFissure import shapeSurFissure -from regroupeSainEtDefaut import RegroupeSainEtDefaut -from triedreBase import triedreBase -from checkDecoupePartition import checkDecoupePartition -from whichSide import whichSide -from whichSideMulti import whichSideMulti -from whichSideVertex import whichSideVertex -from projettePointSurCourbe import projettePointSurCourbe -from prolongeWire import prolongeWire +from .extractionOrientee import extractionOrientee +from .extractionOrienteeMulti import extractionOrienteeMulti +from .sortFaces import sortFaces +from .sortEdges import sortEdges +from .eliminateDoubles import eliminateDoubles +from .substractSubShapes import substractSubShapes +from .produitMixte import produitMixte +from .findWireEndVertices import findWireEndVertices +from .findWireIntermediateVertices import findWireIntermediateVertices +from .orderEdgesFromWire import orderEdgesFromWire +from .getSubshapeIds import getSubshapeIds +from .putName import putName +from .distance2 import distance2 +from .enleveDefaut import enleveDefaut +from .shapeSurFissure import shapeSurFissure +from .regroupeSainEtDefaut import RegroupeSainEtDefaut +from .triedreBase import triedreBase +from .checkDecoupePartition import checkDecoupePartition +from .whichSide import whichSide +from .whichSideMulti import whichSideMulti +from .whichSideVertex import whichSideVertex +from .projettePointSurCourbe import projettePointSurCourbe +from .prolongeWire import prolongeWire #from getCentreFondFiss import getCentreFondFiss # ----------------------------------------------------------------------------- @@ -53,7 +53,7 @@ def insereFissureGenerale(maillagesSains, fondFiss = shapesFissure[4] # groupe d'edges de fond de fissure rayonPipe = shapeFissureParams['rayonPipe'] - if shapeFissureParams.has_key('lenSegPipe'): + if 'lenSegPipe' in shapeFissureParams: lenSegPipe = shapeFissureParams['lenSegPipe'] else: lenSegPipe = rayonPipe @@ -70,13 +70,13 @@ def insereFissureGenerale(maillagesSains, pointIn_y = 0.0 pointIn_z = 0.0 isPointInterne = False - if shapeFissureParams.has_key('pointIn_x'): + if 'pointIn_x' in shapeFissureParams: pointIn_x = shapeFissureParams['pointIn_x'] isPointInterne = True - if shapeFissureParams.has_key('pointIn_y'): + if 'pointIn_y' in shapeFissureParams: pointIn_y = shapeFissureParams['pointIn_y'] isPointInterne = True - if shapeFissureParams.has_key('pointIn_z'): + if 'pointIn_z' in shapeFissureParams: pointIn_z = shapeFissureParams['pointIn_z'] isPointInterne = True if isPointInterne: diff --git a/src/Tools/blocFissure/gmu/insereFissureLongue.py b/src/Tools/blocFissure/gmu/insereFissureLongue.py index 347fb401c..a0671a188 100644 --- a/src/Tools/blocFissure/gmu/insereFissureLongue.py +++ b/src/Tools/blocFissure/gmu/insereFissureLongue.py @@ -2,29 +2,29 @@ import logging import salome -from geomsmesh import geompy -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog -from geomsmesh import smesh +from .geomsmesh import geompy +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog +from .geomsmesh import smesh from salome.smesh import smeshBuilder import SMESH import math -from extractionOrientee import extractionOrientee -from sortFaces import sortFaces -from sortEdges import sortEdges -from eliminateDoubles import eliminateDoubles -from substractSubShapes import substractSubShapes -from produitMixte import produitMixte -from findWireEndVertices import findWireEndVertices -from getSubshapeIds import getSubshapeIds -from putName import putName -from distance2 import distance2 -from enleveDefaut import enleveDefaut -from shapeSurFissure import shapeSurFissure -from regroupeSainEtDefaut import RegroupeSainEtDefaut -from triedreBase import triedreBase +from .extractionOrientee import extractionOrientee +from .sortFaces import sortFaces +from .sortEdges import sortEdges +from .eliminateDoubles import eliminateDoubles +from .substractSubShapes import substractSubShapes +from .produitMixte import produitMixte +from .findWireEndVertices import findWireEndVertices +from .getSubshapeIds import getSubshapeIds +from .putName import putName +from .distance2 import distance2 +from .enleveDefaut import enleveDefaut +from .shapeSurFissure import shapeSurFissure +from .regroupeSainEtDefaut import RegroupeSainEtDefaut +from .triedreBase import triedreBase # ----------------------------------------------------------------------------- # --- procedure complete fissure longue diff --git a/src/Tools/blocFissure/gmu/listOfExtraFunctions.py b/src/Tools/blocFissure/gmu/listOfExtraFunctions.py index fbdd5cf97..803e37a6c 100644 --- a/src/Tools/blocFissure/gmu/listOfExtraFunctions.py +++ b/src/Tools/blocFissure/gmu/listOfExtraFunctions.py @@ -7,7 +7,7 @@ Created on Mon Jun 23 14:49:36 2014 import logging import SMESH -from geomsmesh import smesh +from .geomsmesh import smesh def lookForCorner(maillageAScanner): diff --git a/src/Tools/blocFissure/gmu/mailleAretesEtJonction.py b/src/Tools/blocFissure/gmu/mailleAretesEtJonction.py index e8f9d8197..6c2493740 100644 --- a/src/Tools/blocFissure/gmu/mailleAretesEtJonction.py +++ b/src/Tools/blocFissure/gmu/mailleAretesEtJonction.py @@ -2,11 +2,11 @@ import logging -from geomsmesh import geompy -from geomsmesh import smesh +from .geomsmesh import geompy +from .geomsmesh import smesh import SMESH -from putName import putName +from .putName import putName def mailleAretesEtJonction(internalBoundary, aretesVivesCoupees, lgAretesVives): """ diff --git a/src/Tools/blocFissure/gmu/mailleFacesFissure.py b/src/Tools/blocFissure/gmu/mailleFacesFissure.py index 90bd87012..99101ecaf 100644 --- a/src/Tools/blocFissure/gmu/mailleFacesFissure.py +++ b/src/Tools/blocFissure/gmu/mailleFacesFissure.py @@ -2,12 +2,12 @@ import logging -from geomsmesh import geompy -from geomsmesh import smesh +from .geomsmesh import geompy +from .geomsmesh import smesh from salome.smesh import smeshBuilder import SMESH -from putName import putName +from .putName import putName def mailleFacesFissure(faceFissureExterne, edgesPipeFissureExterneC, edgesPeauFissureExterneC, meshPipeGroups, areteFaceFissure, rayonPipe, nbsegRad): diff --git a/src/Tools/blocFissure/gmu/mailleFacesPeau.py b/src/Tools/blocFissure/gmu/mailleFacesPeau.py index 41a72e9ab..8f9abab99 100644 --- a/src/Tools/blocFissure/gmu/mailleFacesPeau.py +++ b/src/Tools/blocFissure/gmu/mailleFacesPeau.py @@ -2,15 +2,15 @@ import logging -from geomsmesh import geompy -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog -from geomsmesh import smesh +from .geomsmesh import geompy +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog +from .geomsmesh import smesh from salome.smesh import smeshBuilder import SMESH -from putName import putName +from .putName import putName def mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut, facesPeaux, edCircPeau, ptCircPeau, gpedgeBord, gpedgeVifs, edFissPeau, diff --git a/src/Tools/blocFissure/gmu/meshBlocPart.py b/src/Tools/blocFissure/gmu/meshBlocPart.py index c868ed139..4b1337952 100644 --- a/src/Tools/blocFissure/gmu/meshBlocPart.py +++ b/src/Tools/blocFissure/gmu/meshBlocPart.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import geompy -from geomsmesh import smesh +from .geomsmesh import geompy +from .geomsmesh import smesh from salome.smesh import smeshBuilder import SMESH from salome.StdMeshers import StdMeshersBuilder -from putName import putName +from .putName import putName # ----------------------------------------------------------------------------- # --- maillage du bloc partitionne diff --git a/src/Tools/blocFissure/gmu/orderEdgesFromWire.py b/src/Tools/blocFissure/gmu/orderEdgesFromWire.py index 0a092e26c..36d95f2fd 100644 --- a/src/Tools/blocFissure/gmu/orderEdgesFromWire.py +++ b/src/Tools/blocFissure/gmu/orderEdgesFromWire.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import geompy +from .geomsmesh import geompy # ----------------------------------------------------------------------------- # --- trouver les vertices intermediaires d'un wire @@ -29,16 +29,16 @@ def orderEdgesFromWire(aWire): idverts[(i,1)] = verts[0] idsubs = {} - for kv, sub in idverts.iteritems(): + for kv, sub in idverts.items(): subid = geompy.GetSubShapeID(aWire, sub) - if subid in idsubs.keys(): + if subid in list(idsubs.keys()): idsubs[subid].append(kv) else: idsubs[subid] = [kv] debut = -1 fin = -1 - for k, kvs in idsubs.iteritems(): + for k, kvs in idsubs.items(): if len(kvs) == 1: # une extremité kv = kvs[0] if kv[1] == 0: @@ -48,13 +48,13 @@ def orderEdgesFromWire(aWire): logging.debug("nombre d'edges: %s, indice edge début: %s, fin: %s",len(edges), debut, fin) if debut < 0: logging.critical("les edges du wire ne sont pas orientées dans le même sens: pas de début trouvé") - return edges, range(len(edges)) + return edges, list(range(len(edges))) orderedList = [debut] while len(orderedList) < len(edges): bout = orderedList[-1] vertex = idverts[(bout,1)] - for k, v in idverts.iteritems(): + for k, v in idverts.items(): if k[0] not in orderedList: if geompy.MinDistance(vertex, v) < 1.e-4: if k[1] == 0: @@ -62,10 +62,10 @@ def orderEdgesFromWire(aWire): break else: logging.critical("les edges du wire ne sont pas orientées dans le même sens: une edge à l'envers") - return edges, range(len(edges)) + return edges, list(range(len(edges))) logging.debug("liste des edges ordonnées selon le sens de parcours: %s", orderedList) - accessList = range(len(orderedList)) + accessList = list(range(len(orderedList))) for i,k in enumerate(orderedList): accessList[k] = i logging.info("position ordonnée des edges selon le sens de parcours: %s", accessList) diff --git a/src/Tools/blocFissure/gmu/partitionBlocDefaut.py b/src/Tools/blocFissure/gmu/partitionBlocDefaut.py index be3a3481d..7a34e935f 100644 --- a/src/Tools/blocFissure/gmu/partitionBlocDefaut.py +++ b/src/Tools/blocFissure/gmu/partitionBlocDefaut.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import geompy -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog +from .geomsmesh import geompy +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog # ----------------------------------------------------------------------------- # --- partition du bloc defaut par generatrice, tore et plan fissure diff --git a/src/Tools/blocFissure/gmu/partitionVolumeSain.py b/src/Tools/blocFissure/gmu/partitionVolumeSain.py index e7ce51a11..f3a50635d 100644 --- a/src/Tools/blocFissure/gmu/partitionVolumeSain.py +++ b/src/Tools/blocFissure/gmu/partitionVolumeSain.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import geompy -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog +from .geomsmesh import geompy +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog # ----------------------------------------------------------------------------- # --- partition volume sain et bloc, face du bloc recevant la fissure diff --git a/src/Tools/blocFissure/gmu/partitionneFissureParPipe.py b/src/Tools/blocFissure/gmu/partitionneFissureParPipe.py index 32ae8b3f0..bf5a4c109 100644 --- a/src/Tools/blocFissure/gmu/partitionneFissureParPipe.py +++ b/src/Tools/blocFissure/gmu/partitionneFissureParPipe.py @@ -2,14 +2,14 @@ import math import logging -from geomsmesh import geompy -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog -from findWireEndVertices import findWireEndVertices -from prolongeWire import prolongeWire +from .geomsmesh import geompy +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog +from .findWireEndVertices import findWireEndVertices +from .prolongeWire import prolongeWire import traceback -from fissError import fissError +from .fissError import fissError def partitionneFissureParPipe(shapesFissure, elementsDefaut, rayonPipe): """ diff --git a/src/Tools/blocFissure/gmu/peauInterne.py b/src/Tools/blocFissure/gmu/peauInterne.py index 6e6915966..4e4004e40 100644 --- a/src/Tools/blocFissure/gmu/peauInterne.py +++ b/src/Tools/blocFissure/gmu/peauInterne.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import smesh +from .geomsmesh import smesh import SMESH import traceback -from fissError import fissError +from .fissError import fissError -from listOfExtraFunctions import lookForCorner -from fusionMaillageAttributionDefaut import fusionMaillageDefaut +from .listOfExtraFunctions import lookForCorner +from .fusionMaillageAttributionDefaut import fusionMaillageDefaut # ----------------------------------------------------------------------------- # --- peau interne du defaut dans le maillage sain @@ -46,7 +46,7 @@ def peauInterne(fichierMaillage, shapeDefaut, nomZones): # --- Le groupe ZoneDefaut ne doit contenir que des Hexaèdres" info=maillageSain.GetMeshInfo(zoneDefaut) - keys = info.keys(); keys.sort() + keys = list(info.keys()); keys.sort() nbelem=0 nbhexa=0 for i in keys: diff --git a/src/Tools/blocFissure/gmu/produitMixte.py b/src/Tools/blocFissure/gmu/produitMixte.py index 509a75889..96c7cce7f 100644 --- a/src/Tools/blocFissure/gmu/produitMixte.py +++ b/src/Tools/blocFissure/gmu/produitMixte.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import geompy +from .geomsmesh import geompy # ----------------------------------------------------------------------------- # --- calcul de produit mixte pour orientation diff --git a/src/Tools/blocFissure/gmu/projettePointSurCourbe.py b/src/Tools/blocFissure/gmu/projettePointSurCourbe.py index fa43d3926..47c83612f 100644 --- a/src/Tools/blocFissure/gmu/projettePointSurCourbe.py +++ b/src/Tools/blocFissure/gmu/projettePointSurCourbe.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from geomsmesh import geompy +from .geomsmesh import geompy import logging import math diff --git a/src/Tools/blocFissure/gmu/prolongeVertices.py b/src/Tools/blocFissure/gmu/prolongeVertices.py index e6e6f038a..63e465f1b 100644 --- a/src/Tools/blocFissure/gmu/prolongeVertices.py +++ b/src/Tools/blocFissure/gmu/prolongeVertices.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import geompy +from .geomsmesh import geompy # ----------------------------------------------------------------------------- # --- prolongation des segments extremité des polylines, pour la découpe diff --git a/src/Tools/blocFissure/gmu/prolongeWire.py b/src/Tools/blocFissure/gmu/prolongeWire.py index 52b3991b4..75cbb518a 100644 --- a/src/Tools/blocFissure/gmu/prolongeWire.py +++ b/src/Tools/blocFissure/gmu/prolongeWire.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import geompy -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog -from orderEdgesFromWire import orderEdgesFromWire +from .geomsmesh import geompy +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog +from .orderEdgesFromWire import orderEdgesFromWire # ----------------------------------------------------------------------------- # --- prolongation d'un wire par deux segments tangents @@ -22,7 +22,7 @@ def prolongeWire(aWire, extrem, norms, long): uneSeuleEdge = True edgesBout = [] for i, v1 in enumerate(extrem): - exts = [geompy.MakeTranslationVectorDistance(v1, norms[i], l) for l in (-long, long)] + exts = [geompy.MakeTranslationVectorDistance(v1, norms[i], l) for l in (-int, int)] dists = [(geompy.MinDistance(v, aWire), i , v) for i, v in enumerate(exts)] dists.sort() v2 = dists[-1][-1] diff --git a/src/Tools/blocFissure/gmu/propagateTore.py b/src/Tools/blocFissure/gmu/propagateTore.py index 23200e1f7..ab96494a9 100644 --- a/src/Tools/blocFissure/gmu/propagateTore.py +++ b/src/Tools/blocFissure/gmu/propagateTore.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import geompy -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog +from .geomsmesh import geompy +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog # ----------------------------------------------------------------------------- # --- recherche et classement des edges du tore par propagate diff --git a/src/Tools/blocFissure/gmu/putName.py b/src/Tools/blocFissure/gmu/putName.py index b8d4cbfa3..35b8888cc 100644 --- a/src/Tools/blocFissure/gmu/putName.py +++ b/src/Tools/blocFissure/gmu/putName.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from geomsmesh import smesh +from .geomsmesh import smesh # ----------------------------------------------------------------------------- # --- nommage des objets mesh (algorithme, hypothèse, subMesh) diff --git a/src/Tools/blocFissure/gmu/quadranglesToShape.py b/src/Tools/blocFissure/gmu/quadranglesToShape.py index b9facb652..1ffd6ba7e 100644 --- a/src/Tools/blocFissure/gmu/quadranglesToShape.py +++ b/src/Tools/blocFissure/gmu/quadranglesToShape.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import geompy -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog +from .geomsmesh import geompy +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog import GEOM import math import numpy as np @@ -29,7 +29,7 @@ def quadranglesToShape(meshQuad, shapeFissureParams, centreFondFiss): logging.info("start") isVecteurDefaut = False - if shapeFissureParams.has_key('vecteurDefaut'): + if 'vecteurDefaut' in shapeFissureParams: isVecteurDefaut = True vecteurDefaut = shapeFissureParams['vecteurDefaut'] @@ -153,7 +153,7 @@ def quadranglesToShape(meshQuad, shapeFissureParams, centreFondFiss): h = e/(np.sqrt(f*g)) # cosinus ruptureX = h < cosmin # True si angle > reference logging.debug("matrice de rupture X: \n%s",ruptureX) - rupX = filter(lambda x: np.prod(ruptureX[:,x]), range(len(nodeline)-2)) + rupX = [x for x in range(len(nodeline)-2) if np.prod(ruptureX[:,x])] logging.debug("colonnes de rupture: %s",rupX) # recherche d'angles supérieurs a un seuil sur une colonne : angle entre deux vecteurs successifs vecy = mat[ 1:, :, :] - mat[:-1, :, :] # vecteurs selon direction "y" @@ -165,7 +165,7 @@ def quadranglesToShape(meshQuad, shapeFissureParams, centreFondFiss): h = e/(np.sqrt(f*g)) # cosinus ruptureY = h < cosmin # True si angle > reference logging.debug("matrice de rupture Y: \n%s",ruptureY) - rupY = filter(lambda x: np.prod(ruptureY[x, :]), range(len(nodelines)-2)) + rupY = [x for x in range(len(nodelines)-2) if np.prod(ruptureY[x, :])] logging.debug("lignes de rupture: %s",rupY) if (len(rupX)*len(rupY)) > 0: logging.critical("""Cas non traité: présence d'angles vifs dans 2 directions, @@ -270,13 +270,13 @@ def quadranglesToShape(meshQuad, shapeFissureParams, centreFondFiss): pointIn_y = 0.0 pointIn_z = 0.0 pointExplicite = False - if shapeFissureParams.has_key('pointIn_x'): + if 'pointIn_x' in shapeFissureParams: pointExplicite = True pointIn_x = shapeFissureParams['pointIn_x'] - if shapeFissureParams.has_key('pointIn_y'): + if 'pointIn_y' in shapeFissureParams: pointExplicite = True pointIn_y = shapeFissureParams['pointIn_y'] - if shapeFissureParams.has_key('pointIn_z'): + if 'pointIn_z' in shapeFissureParams: pointExplicite = True pointIn_z = shapeFissureParams['pointIn_z'] if pointExplicite: @@ -284,7 +284,7 @@ def quadranglesToShape(meshQuad, shapeFissureParams, centreFondFiss): logging.debug("orientation filling par point intérieur %s", (pointIn_x, pointIn_y, pointIn_z)) vecteurDefaut = geompy.MakeVector(cdg, vertex) - if shapeFissureParams.has_key('convexe'): + if 'convexe' in shapeFissureParams: isConvexe = shapeFissureParams['convexe'] logging.debug("orientation filling par indication de convexité %s", isConvexe) cdg = geompy.MakeCDG(filling) diff --git a/src/Tools/blocFissure/gmu/quadranglesToShapeNoCorner.py b/src/Tools/blocFissure/gmu/quadranglesToShapeNoCorner.py index d3c52ab59..0ef3227e0 100644 --- a/src/Tools/blocFissure/gmu/quadranglesToShapeNoCorner.py +++ b/src/Tools/blocFissure/gmu/quadranglesToShapeNoCorner.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import geompy -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog +from .geomsmesh import geompy +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog import GEOM import math import numpy as np @@ -29,7 +29,7 @@ def quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss): logging.info("start") isVecteurDefaut = False - if shapeFissureParams.has_key('vecteurDefaut'): + if 'vecteurDefaut' in shapeFissureParams: isVecteurDefaut = True vecteurDefaut = shapeFissureParams['vecteurDefaut'] @@ -156,7 +156,7 @@ def quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss): h = e/(np.sqrt(f*g)) # cosinus ruptureX = h < cosmin # True si angle > reference logging.debug("matrice de rupture X: \n%s",ruptureX) - rupX = filter(lambda x: np.prod(ruptureX[:,x]), range(len(nodeline)-2)) + rupX = [x for x in range(len(nodeline)-2) if np.prod(ruptureX[:,x])] logging.debug("colonnes de rupture: %s",rupX) # recherche d'angles supérieurs a un seuil sur une colonne : angle entre deux vecteurs successifs vecy = mat[ 1:, :, :] - mat[:-1, :, :] # vecteurs selon direction "y" @@ -168,7 +168,7 @@ def quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss): h = e/(np.sqrt(f*g)) # cosinus ruptureY = h < cosmin # True si angle > reference logging.debug("matrice de rupture Y: \n%s",ruptureY) - rupY = filter(lambda x: np.prod(ruptureY[x, :]), range(len(nodelines)-2)) + rupY = [x for x in range(len(nodelines)-2) if np.prod(ruptureY[x, :])] logging.debug("lignes de rupture: %s",rupY) if (len(rupX)*len(rupY)) > 0: logging.critical("""Cas non traité: présence d'angles vifs dans 2 directions, @@ -273,13 +273,13 @@ def quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss): pointIn_y = 0.0 pointIn_z = 0.0 pointExplicite = False - if shapeFissureParams.has_key('pointIn_x'): + if 'pointIn_x' in shapeFissureParams: pointExplicite = True pointIn_x = shapeFissureParams['pointIn_x'] - if shapeFissureParams.has_key('pointIn_y'): + if 'pointIn_y' in shapeFissureParams: pointExplicite = True pointIn_y = shapeFissureParams['pointIn_y'] - if shapeFissureParams.has_key('pointIn_z'): + if 'pointIn_z' in shapeFissureParams: pointExplicite = True pointIn_z = shapeFissureParams['pointIn_z'] if pointExplicite: @@ -287,7 +287,7 @@ def quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss): logging.debug("orientation filling par point intérieur %s", (pointIn_x, pointIn_y, pointIn_z)) vecteurDefaut = geompy.MakeVector(cdg, vertex) - if shapeFissureParams.has_key('convexe'): + if 'convexe' in shapeFissureParams: isConvexe = shapeFissureParams['convexe'] logging.debug("orientation filling par indication de convexité %s", isConvexe) cdg = geompy.MakeCDG(filling) diff --git a/src/Tools/blocFissure/gmu/quadranglesToShapeWithCorner.py b/src/Tools/blocFissure/gmu/quadranglesToShapeWithCorner.py index 66963300f..bc77c59f0 100644 --- a/src/Tools/blocFissure/gmu/quadranglesToShapeWithCorner.py +++ b/src/Tools/blocFissure/gmu/quadranglesToShapeWithCorner.py @@ -6,14 +6,14 @@ Created on Tue Jun 24 09:14:13 2014 """ import logging -from geomsmesh import geompy -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog +from .geomsmesh import geompy +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog import GEOM -from listOfExtraFunctions import createNewMeshesFromCorner -from listOfExtraFunctions import createLinesFromMesh +from .listOfExtraFunctions import createNewMeshesFromCorner +from .listOfExtraFunctions import createLinesFromMesh # ----------------------------------------------------------------------------- # --- groupe de quadrangles de face transformé en face géométrique par filling diff --git a/src/Tools/blocFissure/gmu/regroupeSainEtDefaut.py b/src/Tools/blocFissure/gmu/regroupeSainEtDefaut.py index 7acbe4c77..6238a4096 100644 --- a/src/Tools/blocFissure/gmu/regroupeSainEtDefaut.py +++ b/src/Tools/blocFissure/gmu/regroupeSainEtDefaut.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import smesh +from .geomsmesh import smesh import SMESH -from geomsmesh import geompy +from .geomsmesh import geompy # ----------------------------------------------------------------------------- # --- maillage complet et fissure diff --git a/src/Tools/blocFissure/gmu/restreintFaceFissure.py b/src/Tools/blocFissure/gmu/restreintFaceFissure.py index b300ae19f..cdda80f85 100644 --- a/src/Tools/blocFissure/gmu/restreintFaceFissure.py +++ b/src/Tools/blocFissure/gmu/restreintFaceFissure.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import geompy -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog -from sortFaces import sortFaces +from .geomsmesh import geompy +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog +from .sortFaces import sortFaces import traceback -from fissError import fissError +from .fissError import fissError def restreintFaceFissure(shapeDefaut, facesDefaut, pointInterne): """ diff --git a/src/Tools/blocFissure/gmu/rotTrans.py b/src/Tools/blocFissure/gmu/rotTrans.py index 05e3dcbe1..fc2d2a98e 100644 --- a/src/Tools/blocFissure/gmu/rotTrans.py +++ b/src/Tools/blocFissure/gmu/rotTrans.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import geompy -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog +from .geomsmesh import geompy +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog import math -from triedreBase import triedreBase +from .triedreBase import triedreBase O, OX, OY, OZ = triedreBase() # ----------------------------------------------------------------------------- diff --git a/src/Tools/blocFissure/gmu/shapeSurFissure.py b/src/Tools/blocFissure/gmu/shapeSurFissure.py index f9e36ac19..0c54646b0 100644 --- a/src/Tools/blocFissure/gmu/shapeSurFissure.py +++ b/src/Tools/blocFissure/gmu/shapeSurFissure.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import geompy -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog +from .geomsmesh import geompy +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog # ----------------------------------------------------------------------------- # --- construction d'une shape de dectection des éléments à modifier suite à la la duplication des noeuds de la face fissure (d'un coté de la face) diff --git a/src/Tools/blocFissure/gmu/shapesSurFissure.py b/src/Tools/blocFissure/gmu/shapesSurFissure.py index a8a98a1a1..9c975c41b 100644 --- a/src/Tools/blocFissure/gmu/shapesSurFissure.py +++ b/src/Tools/blocFissure/gmu/shapesSurFissure.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import geompy +from .geomsmesh import geompy # ----------------------------------------------------------------------------- # --- identification des shapes modifiées par la duplication des noeuds de la face fissure (d'un coté de la face) diff --git a/src/Tools/blocFissure/gmu/sortEdges.py b/src/Tools/blocFissure/gmu/sortEdges.py index 6d633f7d8..576338bd5 100644 --- a/src/Tools/blocFissure/gmu/sortEdges.py +++ b/src/Tools/blocFissure/gmu/sortEdges.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import geompy +from .geomsmesh import geompy # ----------------------------------------------------------------------------- # --- tri par longueur d'edges diff --git a/src/Tools/blocFissure/gmu/sortFaces.py b/src/Tools/blocFissure/gmu/sortFaces.py index 0fe962e6d..f45cd6105 100644 --- a/src/Tools/blocFissure/gmu/sortFaces.py +++ b/src/Tools/blocFissure/gmu/sortFaces.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import geompy +from .geomsmesh import geompy # ----------------------------------------------------------------------------- # --- tri par surface de faces diff --git a/src/Tools/blocFissure/gmu/sortGeneratrices.py b/src/Tools/blocFissure/gmu/sortGeneratrices.py index f61dc2838..a72f83c64 100644 --- a/src/Tools/blocFissure/gmu/sortGeneratrices.py +++ b/src/Tools/blocFissure/gmu/sortGeneratrices.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import geompy -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog +from .geomsmesh import geompy +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog # ----------------------------------------------------------------------------- # --- tri par longueur des 3 generatrices diff --git a/src/Tools/blocFissure/gmu/sortSolids.py b/src/Tools/blocFissure/gmu/sortSolids.py index c51bca539..4905ccaeb 100644 --- a/src/Tools/blocFissure/gmu/sortSolids.py +++ b/src/Tools/blocFissure/gmu/sortSolids.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import geompy +from .geomsmesh import geompy # ----------------------------------------------------------------------------- # --- tri par volume de solides diff --git a/src/Tools/blocFissure/gmu/substractSubShapes.py b/src/Tools/blocFissure/gmu/substractSubShapes.py index 3f819d7f4..7abb8b564 100644 --- a/src/Tools/blocFissure/gmu/substractSubShapes.py +++ b/src/Tools/blocFissure/gmu/substractSubShapes.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import geompy +from .geomsmesh import geompy # ----------------------------------------------------------------------------- # --- substract a list of subShapes from another @@ -17,7 +17,7 @@ def substractSubShapes(obj, subs, toRemove): idToremove[geompy.GetSubShapeID(obj, s)] = s for s in subs: idsub = geompy.GetSubShapeID(obj, s) - if idsub not in idToremove.keys(): + if idsub not in list(idToremove.keys()): subList.append(s) logging.debug("subList=%s", subList) return subList diff --git a/src/Tools/blocFissure/gmu/toreFissure.py b/src/Tools/blocFissure/gmu/toreFissure.py index 12464f65d..742bd0edd 100644 --- a/src/Tools/blocFissure/gmu/toreFissure.py +++ b/src/Tools/blocFissure/gmu/toreFissure.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import geompy -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog +from .geomsmesh import geompy +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog import math -from triedreBase import triedreBase +from .triedreBase import triedreBase O, OX, OY, OZ = triedreBase() diff --git a/src/Tools/blocFissure/gmu/triedreBase.py b/src/Tools/blocFissure/gmu/triedreBase.py index 8113cd077..3188601c8 100644 --- a/src/Tools/blocFissure/gmu/triedreBase.py +++ b/src/Tools/blocFissure/gmu/triedreBase.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import geompy -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog +from .geomsmesh import geompy +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog # --- origine et vecteurs de base diff --git a/src/Tools/blocFissure/gmu/trouveEdgesFissPeau.py b/src/Tools/blocFissure/gmu/trouveEdgesFissPeau.py index 49205e688..6b6524650 100644 --- a/src/Tools/blocFissure/gmu/trouveEdgesFissPeau.py +++ b/src/Tools/blocFissure/gmu/trouveEdgesFissPeau.py @@ -2,10 +2,10 @@ import logging -from geomsmesh import geompy -from geomsmesh import geomPublish -from geomsmesh import geomPublishInFather -import initLog +from .geomsmesh import geompy +from .geomsmesh import geomPublish +from .geomsmesh import geomPublishInFather +from . import initLog def trouveEdgesFissPeau(facesInside, facesOnside, edgesPipeIn, edgesFondIn, partitionPeauFissFond, edgesFissExtPeau): """ diff --git a/src/Tools/blocFissure/gmu/whichSide.py b/src/Tools/blocFissure/gmu/whichSide.py index d31fad2dd..ab36a27c3 100644 --- a/src/Tools/blocFissure/gmu/whichSide.py +++ b/src/Tools/blocFissure/gmu/whichSide.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import geompy +from .geomsmesh import geompy # ----------------------------------------------------------------------------- # --- calcul de la position d'une shape par rapport à une face (dessus, dessous, sur la surface même) diff --git a/src/Tools/blocFissure/gmu/whichSideMulti.py b/src/Tools/blocFissure/gmu/whichSideMulti.py index 248e6cf2c..f33ecfcdd 100644 --- a/src/Tools/blocFissure/gmu/whichSideMulti.py +++ b/src/Tools/blocFissure/gmu/whichSideMulti.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import geompy +from .geomsmesh import geompy # ----------------------------------------------------------------------------- # --- calcul de la position d'une shape par rapport à une face (dessus, dessous, sur la surface même) diff --git a/src/Tools/blocFissure/gmu/whichSideVertex.py b/src/Tools/blocFissure/gmu/whichSideVertex.py index 13a29c4fa..713aae5dd 100644 --- a/src/Tools/blocFissure/gmu/whichSideVertex.py +++ b/src/Tools/blocFissure/gmu/whichSideVertex.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import logging -from geomsmesh import geompy +from .geomsmesh import geompy # ----------------------------------------------------------------------------- # --- calcul de la position d'une shape par rapport à une face (dessus, dessous, sur la surface même) diff --git a/src/Tools/blocFissure/ihm/fissureCoude_ihm.py b/src/Tools/blocFissure/ihm/fissureCoude_ihm.py index 1167c55fa..54a50407a 100644 --- a/src/Tools/blocFissure/ihm/fissureCoude_ihm.py +++ b/src/Tools/blocFissure/ihm/fissureCoude_ihm.py @@ -55,7 +55,7 @@ class fissureCoude_ihm(fissureCoude): pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z) externe : True : fissure face externe, False : fissure face interne """ - print "setParamShapeFissure", self.nomCas + print("setParamShapeFissure", self.nomCas) self.shapeFissureParams = dict(profondeur = self.dico['profondeur'], rayonPipe = self.dico['rayonTore'], lenSegPipe = self.dico['lenSegPipe'], diff --git a/src/Tools/blocFissure/ihm/fissureCoude_plugin.py b/src/Tools/blocFissure/ihm/fissureCoude_plugin.py index 30936d50c..622f82ee6 100644 --- a/src/Tools/blocFissure/ihm/fissureCoude_plugin.py +++ b/src/Tools/blocFissure/ihm/fissureCoude_plugin.py @@ -249,12 +249,12 @@ def fissureCoudeDlg(context): else: self.ui.sb_nbSecteur.setPalette(self.blackPalette) - print "incomplet: ", incomplet + print("incomplet: ", incomplet) return incomplet def fileDefault(self): filedef = os.path.expanduser("~/.config/salome/dialogFissureCoude.dic") - print filedef + print(filedef) return filedef def writeDefault(self, dico): @@ -269,7 +269,7 @@ def fissureCoudeDlg(context): f = open(filedef, 'r') txt = f.read() dico = eval(txt) - print dico + print(dico) self.initDialog(dico) def resetVal(self): @@ -277,7 +277,7 @@ def fissureCoudeDlg(context): self.initDialog(self.defaut) def sauver(self): - print "sauver" + print("sauver") fileDiag = QFileDialog(self) fileDiag.setFileMode(QFileDialog.AnyFile) fileDiag.setNameFilter("Parametres *.dic (*.dic)") @@ -291,7 +291,7 @@ def fissureCoudeDlg(context): f.close() def recharger(self): - print "recharger" + print("recharger") fileDiag = QFileDialog(self) fileDiag.setFileMode(QFileDialog.ExistingFile) fileDiag.setNameFilter("Parametres *.dic (*.dic)") @@ -299,12 +299,12 @@ def fissureCoudeDlg(context): if fileDiag.exec_() : fileNames = fileDiag.selectedFiles() filedef = fileNames[0] - print filedef + print(filedef) if os.path.exists(filedef): f = open(filedef, 'r') txt = f.read() dico = eval(txt) - print dico + print(dico) self.initDialog(dico) def creeDico(self): @@ -338,7 +338,7 @@ def fissureCoudeDlg(context): aretesFaceFissure = self.ui.dsb_aretesFaceFissure.value(), influence = self.ui.dsb_influence.value(), ) - print dico + print(dico) return dico def checkValues(self): @@ -356,26 +356,26 @@ def fissureCoudeDlg(context): NOK = self.testval(dico) if not(NOK): dico['lenSegPipe'] = (dico['longueur'] + math.pi*dico['profondeur'])/dico['nbTranches'] - print 'lenSegPipe', dico['lenSegPipe'] + print('lenSegPipe', dico['lenSegPipe']) areteMinAngle = (dico['rCintr'] -dico['dext']/2.0)*(dico['angle']*math.pi/180.0)/dico['nbAxeCoude'] - print'areteMinAngle', areteMinAngle + print('areteMinAngle', areteMinAngle) areteMinCirco = dico['dext']*math.pi/(2*dico['nbCirconf']) - print'areteMinCirco', areteMinCirco + print('areteMinCirco', areteMinCirco) areteMinEpais = dico['epais']/dico['nbEpaisseur'] - print'areteMinEpais', areteMinEpais + print('areteMinEpais', areteMinEpais) if dico['influence'] == 0: dico['influence'] = max(areteMinAngle, areteMinCirco, areteMinEpais) - print 'influence', dico['influence'] + print('influence', dico['influence']) if dico['aretesFaceFissure'] == 0: dico['aretesFaceFissure'] = (areteMinAngle + areteMinCirco)/2.0 - print 'aretesFaceFissure', dico['aretesFaceFissure'] + print('aretesFaceFissure', dico['aretesFaceFissure']) if dico['rbPosiAngul'] == False: rmoy = (dico['dext'] - dico['epais'])/2.0 eta = 1 if dico['rbFissExt'] == False: eta = -1 dico['posiAngul'] = (180.0/math.pi)*dico['absCurv']/(dico['rCintr']+(rmoy+eta*dico['epais']/2.0)*math.cos(math.pi*dico['azimut']/180.)) - print 'posiAngul' , dico['posiAngul'] + print('posiAngul' , dico['posiAngul']) self.writeDefault(dico) self.ui.lb_calcul.show() @@ -398,9 +398,9 @@ def fissureCoudeDlg(context): result = window.result() if result: # dialog accepted - print "dialog accepted, check" + print("dialog accepted, check") retry = window.checkValues() else: - print "dialog rejected, exit" + print("dialog rejected, exit") pass diff --git a/src/Tools/blocFissure/ihm/fissureGenerale_plugin.py b/src/Tools/blocFissure/ihm/fissureGenerale_plugin.py index 48d962653..832c06c37 100644 --- a/src/Tools/blocFissure/ihm/fissureGenerale_plugin.py +++ b/src/Tools/blocFissure/ihm/fissureGenerale_plugin.py @@ -47,7 +47,7 @@ def fissureGeneraleDlg(context): class fissureGeneraleDialog(QtWidgets.QDialog): def __init__(self): - print "__init__" + print("__init__") QtWidgets.QDialog.__init__(self) # Set up the user interface from Designer. self.ui = Ui_Dialog() @@ -106,7 +106,7 @@ def fissureGeneraleDlg(context): self.ui.sb_couronnes.setValue(dico['nbSegRad']) self.ui.sb_secteurs.setValue(dico['nbSegCercle']) self.ui.dsb_areteFaceFissure.setValue(dico['areteFaceFissure']) - if dico.has_key('aretesVives'): + if 'aretesVives' in dico: self.ui.dsb_aretesVives.setValue(dico['aretesVives']) else: self.ui.dsb_aretesVives.setValue(0) @@ -133,12 +133,12 @@ def fissureGeneraleDlg(context): l = dico['edgeFissIds'] for i in l: if not isinstance(i, int): - print"not isinstance(i, int)" + print("not isinstance(i, int)") incomplet = True edgeFissIdsOK=False break except: - print "except eval" + print("except eval") incomplet = True edgeFissIdsOK=False if edgeFissIdsOK: @@ -171,12 +171,12 @@ def fissureGeneraleDlg(context): else: self.ui.dsb_areteFaceFissure.setPalette(self.blackPalette) - print "incomplet: ", incomplet + print("incomplet: ", incomplet) return incomplet def fileDefault(self): filedef = os.path.expanduser("~/.config/salome/dialogFissureGenerale.dic") - print filedef + print(filedef) return filedef def writeDefault(self, dico): @@ -203,7 +203,7 @@ def fissureGeneraleDlg(context): f = open(filedef, 'r') txt = f.read() dico = eval(txt) - print dico + print(dico) self.initDialog(dico) def resetVal(self): @@ -212,9 +212,9 @@ def fissureGeneraleDlg(context): def setLogVerbosity(self, logfile): from blocFissure.gmu import initLog # le mode de log s'initialise une seule fois - print "setLogVerbosity" + print("setLogVerbosity") index = self.ui.cb_log.currentIndex() - print index + print(index) if index == 0: initLog.setRelease(logfile) elif index == 1: @@ -224,14 +224,14 @@ def fissureGeneraleDlg(context): def sauver(self): - print "sauver" + print("sauver") fileDiag = QFileDialog(self) fileDiag.setFileMode(QFileDialog.AnyFile) fileDiag.setNameFilter("Parametres *.dic (*.dic)") fileDiag.setViewMode(QFileDialog.List) if fileDiag.exec_() : fileNames = fileDiag.selectedFiles() - print fileNames + print(fileNames) filedef = fileNames[0] if filedef[-4:] not in ['.dic']: filedef += '.dic' @@ -241,7 +241,7 @@ def fissureGeneraleDlg(context): f.close() def recharger(self): - print "recharger" + print("recharger") fileDiag = QFileDialog(self) fileDiag.setFileMode(QFileDialog.ExistingFile) fileDiag.setNameFilter("Parametres *.dic (*.dic)") @@ -249,12 +249,12 @@ def fissureGeneraleDlg(context): if fileDiag.exec_() : fileNames = fileDiag.selectedFiles() filedef = fileNames[0] - print filedef + print(filedef) if os.path.exists(filedef): f = open(filedef, 'r') txt = f.read() dico = eval(txt) - print dico + print(dico) self.initDialog(dico) def selectMaillage(self): @@ -265,7 +265,7 @@ def fissureGeneraleDlg(context): if fileDiag.exec_() : fileNames = fileDiag.selectedFiles() filedef = fileNames[0] - print filedef + print(filedef) self.ui.le_maillage.setText(filedef) def selectFacefiss(self): @@ -276,7 +276,7 @@ def fissureGeneraleDlg(context): if fileDiag.exec_() : fileNames = fileDiag.selectedFiles() filedef = fileNames[0] - print filedef + print(filedef) self.ui.le_facefiss.setText(filedef) def selectReptrav(self): @@ -287,7 +287,7 @@ def fissureGeneraleDlg(context): if fileDiag.exec_() : fileNames = fileDiag.selectedFiles() reptrav = str(fileNames[0]) - print "reptrav ", reptrav + print("reptrav ", reptrav) self.ui.le_reptrav.setText(os.path.abspath(reptrav)) @@ -303,7 +303,7 @@ def fissureGeneraleDlg(context): if fileDiag.exec_() : fileNames = fileDiag.selectedFiles() tempnom = os.path.split(str(fileNames[0]))[1] - print "nomres ", tempnom + print("nomres ", tempnom) self.ui.le_nomres.setText(tempnom) else: self.ui.le_nomres.setText(nomres) @@ -325,14 +325,14 @@ def fissureGeneraleDlg(context): nomres = str(self.ui.le_nomres.text()), verbosite = self.ui.cb_log.currentIndex() ) - print dico + print(dico) return dico def checkValues(self): return self.NOK def execute(self): - print "execute" + print("execute") dico = self.creeDico() NOK = self.testval(dico) if not(NOK): @@ -347,14 +347,14 @@ def fissureGeneraleDlg(context): try: execInstance = casStandard(dico) except fissError as erreur: - print '-'*60 - print type(erreur) - print '-'*60 - print erreur.msg - print '-'*60 + print('-'*60) + print(type(erreur)) + print('-'*60) + print(erreur.msg) + print('-'*60) for ligne in erreur.pile: - print repr(ligne) - print '-'*60 + print(repr(ligne)) + print('-'*60) texte = erreur.msg # texte += +"
" +'-'*60 +"
" # for ligne in erreur.pile: @@ -373,7 +373,7 @@ def fissureGeneraleDlg(context): # ---------------------------------------------------------------------------- - print "main" + print("main") window = fissureGeneraleDialog() retry = True while(retry): @@ -382,9 +382,9 @@ def fissureGeneraleDlg(context): result = window.result() if result: # dialog accepted - print "dialog accepted, check" + print("dialog accepted, check") retry = window.checkValues() else: - print "dialog rejected, exit" + print("dialog rejected, exit") pass diff --git a/src/Tools/padder/spadderpy/__init__.py b/src/Tools/padder/spadderpy/__init__.py index 0031b907d..effd68f7d 100644 --- a/src/Tools/padder/spadderpy/__init__.py +++ b/src/Tools/padder/spadderpy/__init__.py @@ -98,11 +98,11 @@ def loadSpadderCatalog(): import SALOME_ModuleCatalog catalog = obj._narrow(SALOME_ModuleCatalog.ModuleCatalog) if not catalog: - raise RuntimeError, "Can't accesss module catalog" + raise RuntimeError("Can't accesss module catalog") filename = getSpadderCatalogFilename() catalog.ImportXmlCatalogFile(filename) from salome.kernel import services - print "The list of SALOME components is now:" - print services.getComponentList() + print("The list of SALOME components is now:") + print(services.getComponentList()) diff --git a/src/Tools/padder/spadderpy/configreader.py b/src/Tools/padder/spadderpy/configreader.py index 9580a51e4..7593ccf50 100644 --- a/src/Tools/padder/spadderpy/configreader.py +++ b/src/Tools/padder/spadderpy/configreader.py @@ -22,7 +22,7 @@ # import sys, os -import ConfigParser +import configparser from MESHJOB import ConfigParameter from salome.kernel.uiexception import AdminException, UiException @@ -42,7 +42,7 @@ class ConfigReader: self.__configFilename = None try: smeshpath=os.environ["SMESH_ROOT_DIR"] - except KeyError, ex: + except KeyError as ex: raise AdminException("You should define the variable SMESH_ROOT_DIR") pluginspath = os.path.join(smeshpath,CONFIG_RELPATH) @@ -53,11 +53,11 @@ class ConfigReader: msg = "The configuration file %s can't be found in the SMESH plugins path %s" raise AdminException(msg%(CONFIG_FILENAME,pluginspath)) - print "The configuration file is : %s"%self.__configFilename - self.__configparser = ConfigParser.RawConfigParser() + print("The configuration file is : %s"%self.__configFilename) + self.__configparser = configparser.RawConfigParser() try: self.__configparser.read(self.__configFilename) - except ConfigParser.ParsingError, ex: + except configparser.ParsingError as ex: raise AdminException(ex.message) def getLocalConfig(self): @@ -87,10 +87,10 @@ class ConfigReader: return defaultType def printConfig(config): - print "PADDER CONFIGURATION:" - print "\tconfig.resname = %s"%config.resname - print "\tconfig.binpath = %s"%config.binpath - print "\tconfig.envpath = %s"%config.envpath + print("PADDER CONFIGURATION:") + print("\tconfig.resname = %s"%config.resname) + print("\tconfig.binpath = %s"%config.binpath) + print("\tconfig.envpath = %s"%config.envpath) def getPadderTestDir(config): """ @@ -112,10 +112,10 @@ def TEST_getDefaultConfig(): try: configReader = ConfigReader() defaultConfig = configReader.getDefaultConfig() - print defaultConfig.resname - print defaultConfig.binpath - print defaultConfig.envpath - except Exception, ex: + print(defaultConfig.resname) + print(defaultConfig.binpath) + print(defaultConfig.envpath) + except Exception as ex: sys.stderr.write('ERROR: %s\n' % str(ex)) return False @@ -127,8 +127,8 @@ def TEST_getDefaultConfig_withError(): try: configReader = ConfigReader() defaultConfig = configReader.getDefaultConfig() - except UiException, err: - print 'ERROR: %s' % str(err) + except UiException as err: + print('ERROR: %s' % str(err)) return True return False diff --git a/src/Tools/padder/spadderpy/gui/inputdialog.py b/src/Tools/padder/spadderpy/gui/inputdialog.py index 138b237ac..47abc561a 100644 --- a/src/Tools/padder/spadderpy/gui/inputdialog.py +++ b/src/Tools/padder/spadderpy/gui/inputdialog.py @@ -33,7 +33,7 @@ from omniORB import CORBA from qtsalome import QIcon, QStandardItemModel, QStandardItem, QMessageBox, pyqtSignal from inputframe_ui import Ui_InputFrame -from inputdata import InputData +from .inputdata import InputData DEBUG_MODE=True GROUPNAME_MAXLENGTH=8 @@ -231,7 +231,7 @@ class InputDialog(GenericDialog): """ # if the entry already exists, we remove it to replace by a # new one - if self.__dictInputData.has_key(meshName): + if meshName in self.__dictInputData: self.__delInputFromMap(meshName) inputData = InputData() @@ -246,10 +246,10 @@ class InputDialog(GenericDialog): else: self.__nbSteelbarMesh += 1 - print inputData - print "meshType = ",inputData.meshType - print "nb concrete mesh ",self.__nbConcreteMesh - print "nb steelbar mesh ",self.__nbSteelbarMesh + print(inputData) + print("meshType = ",inputData.meshType) + print("nb concrete mesh ",self.__nbConcreteMesh) + print("nb steelbar mesh ",self.__nbSteelbarMesh) def onDeleteInput(self): @@ -278,9 +278,9 @@ class InputDialog(GenericDialog): else: self.__nbSteelbarMesh -= 1 - print inputData - print "nb concrete mesh ",self.__nbConcreteMesh - print "nb steelbar mesh ",self.__nbSteelbarMesh + print(inputData) + print("nb concrete mesh ",self.__nbConcreteMesh) + print("nb steelbar mesh ",self.__nbSteelbarMesh) def setData(self, listInputData=[]): @@ -309,7 +309,7 @@ class InputDialog(GenericDialog): """ # Note that the values() function returns a copy of the list # of values. - return self.__dictInputData.values() + return list(self.__dictInputData.values()) def checkData(self): """ @@ -343,7 +343,7 @@ def TEST_InputDialog(): dlg=InputDialog() dlg.displayAndWait() if dlg.wasOk(): - print "OK has been pressed" + print("OK has been pressed") def TEST_InputDialog_setData(): import sys @@ -353,7 +353,7 @@ def TEST_InputDialog_setData(): dlg=InputDialog() - from inputdata import InputData + from .inputdata import InputData inputData = InputData() inputData.meshName = "myMesh" inputData.meshObject = None @@ -366,9 +366,9 @@ def TEST_InputDialog_setData(): dlg.displayAndWait() if dlg.wasOk(): - print "OK has been pressed" + print("OK has been pressed") outputListInputData = dlg.getData2() - print outputListInputData + print(outputListInputData) if __name__ == "__main__": diff --git a/src/Tools/padder/spadderpy/gui/plugindialog.py b/src/Tools/padder/spadderpy/gui/plugindialog.py index 1d7f246ab..f576bf317 100644 --- a/src/Tools/padder/spadderpy/gui/plugindialog.py +++ b/src/Tools/padder/spadderpy/gui/plugindialog.py @@ -23,8 +23,8 @@ from qtsalome import QDialog, QIcon, Qt from plugindialog_ui import Ui_PluginDialog -from inputdialog import InputDialog -from inputdata import InputData +from .inputdialog import InputDialog +from .inputdata import InputData # __GBO__: uncomment this line and comment the previous one to use the # demo input dialog instead of the real one. #from demoinputdialog import InputDialog @@ -178,7 +178,7 @@ class PluginDialog(QDialog): servant. Note that the component is loaded on first demand, and then the reference is recycled. """ - if self.__dict__.has_key("__jobManager") and self.__jobManager is not None: + if "__jobManager" in self.__dict__ and self.__jobManager is not None: return self.__jobManager # WARN: we first have to update the SALOME components catalog diff --git a/src/Tools/padder/spadderpy/plugin/spadderPlugin.py b/src/Tools/padder/spadderpy/plugin/spadderPlugin.py index e9f8fa12e..99ee5bc96 100644 --- a/src/Tools/padder/spadderpy/plugin/spadderPlugin.py +++ b/src/Tools/padder/spadderpy/plugin/spadderPlugin.py @@ -25,7 +25,7 @@ def runSpadderPlugin(context): from salome.kernel.uiexception import UiException try: dialog=plugindialog.getDialog() - except UiException, err: + except UiException as err: from qtsalome import QMessageBox QMessageBox.critical(None,"An error occurs during PADDER configuration", err.getUIMessage()) diff --git a/src/Tools/padder/unittests/usecase_meshJobManager.py b/src/Tools/padder/unittests/usecase_meshJobManager.py index 131e7c315..393840239 100644 --- a/src/Tools/padder/unittests/usecase_meshJobManager.py +++ b/src/Tools/padder/unittests/usecase_meshJobManager.py @@ -172,14 +172,14 @@ meshJobParameterList.append(param) jobid = component.initialize(meshJobFileList, meshJobParameterList, configId) if jobid<0: msg = component.getLastErrorMessage() - print "ERR: %s"%msg + print("ERR: %s"%msg) sys.exit(1) created = False nbiter = 0 while not created: state = component.getState(jobid) - print "MeshJobManager ["+str(nbiter)+"] : state = "+str(state) + print("MeshJobManager ["+str(nbiter)+"] : state = "+str(state)) if state == "CREATED": created = True time.sleep(0.5) @@ -196,10 +196,10 @@ while not created: ok=component.start(jobid) if not ok: msg = component.getLastErrorMessage() - print "ERR: %s"%msg + print("ERR: %s"%msg) sys.exit(1) -print "job started: %s"%ok +print("job started: %s"%ok) # # This part illustrates how you can follow the execution of the job. @@ -212,20 +212,20 @@ ended = False nbiter = 0 while not ended: state = component.getState(jobid) - print "MeshJobManager ["+str(nbiter)+"] : state = "+str(state) + print("MeshJobManager ["+str(nbiter)+"] : state = "+str(state)) if state not in run_states: ended=True time.sleep(0.5) nbiter+=1 if state not in end_states: - print "ERR: jobid = "+str(jobid)+" ended abnormally with state="+str(state) + print("ERR: jobid = "+str(jobid)+" ended abnormally with state="+str(state)) msg = component.getLastErrorMessage() - print "ERR: %s"%msg + print("ERR: %s"%msg) else: - print "OK: jobid = "+str(jobid)+" ended with state="+str(state) + print("OK: jobid = "+str(jobid)+" ended with state="+str(state)) meshJobResults = component.finalize(jobid) - print meshJobResults + print(meshJobResults) if meshJobResults.status is not True: - print "ERR: the results are not OK: %s"%component.getLastErrorMessage() - print "ERR: see log files in %s"%meshJobResults.results_dirname + print("ERR: the results are not OK: %s"%component.getLastErrorMessage()) + print("ERR: see log files in %s"%meshJobResults.results_dirname) diff --git a/src/Tools/padder/unittests/usecase_spadderPluginTester.py b/src/Tools/padder/unittests/usecase_spadderPluginTester.py index 65566eb4e..39167defc 100644 --- a/src/Tools/padder/unittests/usecase_spadderPluginTester.py +++ b/src/Tools/padder/unittests/usecase_spadderPluginTester.py @@ -34,19 +34,19 @@ from salome.smesh import spadder spadder.loadSpadderCatalog() # Basic test -print "Basic tests" +print("Basic tests") c=salome.lcc.FindOrLoadComponent("FactoryServer","SPADDERPluginTester") z=c.demo(2.,3.) # Test of usage of KERNEL services from the test component -print "Test of usage of KERNEL services from the test component" +print("Test of usage of KERNEL services from the test component") c.testkernel() # Test of usage of SMESH engine from the test component # WARN: the SMESH engine must be loaded first -print "Test of usage of SMESH engine from the test component" +print("Test of usage of SMESH engine from the test component") import SMESH salome.lcc.FindOrLoadComponent("FactoryServer","SMESH") c.testsmesh(salome.myStudyId) -print "Test completed : OK" +print("Test completed : OK") -- 2.39.2