Salome HOME
[PY3] 2to3 results
authorNicolas Geimer <nicolas.geimer@edf.fr>
Mon, 20 Mar 2017 12:27:30 +0000 (13:27 +0100)
committerNicolas Geimer <nicolas.geimer@edf.fr>
Mon, 20 Mar 2017 12:41:53 +0000 (13:41 +0100)
297 files changed:
bin/smesh_setenv.py
doc/salome/examples/cartesian_algo.py
doc/salome/examples/creating_meshes_ex01.py
doc/salome/examples/creating_meshes_ex03.py
doc/salome/examples/creating_meshes_ex04.py
doc/salome/examples/creating_meshes_ex05.py
doc/salome/examples/defining_hypotheses_ex06.py
doc/salome/examples/filters_belong2group.py
doc/salome/examples/filters_ex01.py
doc/salome/examples/filters_ex02.py
doc/salome/examples/filters_ex03.py
doc/salome/examples/filters_ex04.py
doc/salome/examples/filters_ex05.py
doc/salome/examples/filters_ex06.py
doc/salome/examples/filters_ex07.py
doc/salome/examples/filters_ex08.py
doc/salome/examples/filters_ex09.py
doc/salome/examples/filters_ex10.py
doc/salome/examples/filters_ex11.py
doc/salome/examples/filters_ex12.py
doc/salome/examples/filters_ex13.py
doc/salome/examples/filters_ex14.py
doc/salome/examples/filters_ex15.py
doc/salome/examples/filters_ex16.py
doc/salome/examples/filters_ex17.py
doc/salome/examples/filters_ex18.py
doc/salome/examples/filters_ex19.py
doc/salome/examples/filters_ex20.py
doc/salome/examples/filters_ex21.py
doc/salome/examples/filters_ex22.py
doc/salome/examples/filters_ex23.py
doc/salome/examples/filters_ex24.py
doc/salome/examples/filters_ex25.py
doc/salome/examples/filters_ex26.py
doc/salome/examples/filters_ex27.py
doc/salome/examples/filters_ex28.py
doc/salome/examples/filters_ex29.py
doc/salome/examples/filters_ex30.py
doc/salome/examples/filters_ex31.py
doc/salome/examples/filters_ex32.py
doc/salome/examples/filters_ex33.py
doc/salome/examples/filters_ex34.py
doc/salome/examples/filters_ex35.py
doc/salome/examples/filters_ex37.py
doc/salome/examples/filters_ex38.py
doc/salome/examples/filters_ex39.py
doc/salome/examples/filters_node_nb_conn.py
doc/salome/examples/grouping_elements_ex01.py
doc/salome/examples/grouping_elements_ex03.py
doc/salome/examples/grouping_elements_ex04.py
doc/salome/examples/grouping_elements_ex05.py
doc/salome/examples/grouping_elements_ex06.py
doc/salome/examples/grouping_elements_ex07.py
doc/salome/examples/grouping_elements_ex08.py
doc/salome/examples/measurements_ex03.py
doc/salome/examples/modifying_meshes_ex01.py
doc/salome/examples/modifying_meshes_ex02.py
doc/salome/examples/modifying_meshes_ex03.py
doc/salome/examples/modifying_meshes_ex04.py
doc/salome/examples/modifying_meshes_ex05.py
doc/salome/examples/modifying_meshes_ex06.py
doc/salome/examples/modifying_meshes_ex07.py
doc/salome/examples/modifying_meshes_ex08.py
doc/salome/examples/modifying_meshes_ex11.py
doc/salome/examples/modifying_meshes_ex12.py
doc/salome/examples/modifying_meshes_ex13.py
doc/salome/examples/modifying_meshes_ex15.py
doc/salome/examples/modifying_meshes_ex16.py
doc/salome/examples/modifying_meshes_ex17.py
doc/salome/examples/modifying_meshes_ex18.py
doc/salome/examples/modifying_meshes_ex21.py
doc/salome/examples/modifying_meshes_ex23.py
doc/salome/examples/modifying_meshes_ex25.py
doc/salome/examples/quality_controls_ex01.py
doc/salome/examples/quality_controls_ex02.py
doc/salome/examples/quality_controls_ex03.py
doc/salome/examples/quality_controls_ex04.py
doc/salome/examples/quality_controls_ex05.py
doc/salome/examples/quality_controls_ex06.py
doc/salome/examples/quality_controls_ex11.py
doc/salome/examples/quality_controls_ex12.py
doc/salome/examples/quality_controls_ex13.py
doc/salome/examples/quality_controls_ex14.py
doc/salome/examples/quality_controls_ex15.py
doc/salome/examples/quality_controls_ex16.py
doc/salome/examples/quality_controls_ex17.py
doc/salome/examples/quality_controls_ex18.py
doc/salome/examples/quality_controls_ex19.py
doc/salome/examples/quality_controls_ex20.py
doc/salome/examples/quality_controls_ex21.py
doc/salome/examples/quality_controls_ex22.py
doc/salome/examples/transforming_meshes_ex06.py
doc/salome/examples/transforming_meshes_ex09.py
doc/salome/examples/transforming_meshes_ex10.py
doc/salome/examples/transforming_meshes_ex11.py
doc/salome/examples/transforming_meshes_ex13.py
doc/salome/examples/viewing_meshes_ex01.py
doc/salome/gui/SMESH/collect_mesh_methods.py
src/SMESH_PY/smeshstudytools.py
src/SMESH_SWIG/PAL_MESH_041_mesh.py
src/SMESH_SWIG/SMESH_AdvancedEditor.py
src/SMESH_SWIG/SMESH_BelongToGeom.py
src/SMESH_SWIG/SMESH_GroupFromGeom.py
src/SMESH_SWIG/SMESH_GroupFromGeom2.py
src/SMESH_SWIG/SMESH_GroupLyingOnGeom.py
src/SMESH_SWIG/SMESH_Nut.py
src/SMESH_SWIG/SMESH_Partition1_tetra.py
src/SMESH_SWIG/SMESH_box2_tetra.py
src/SMESH_SWIG/SMESH_box3_tetra.py
src/SMESH_SWIG/SMESH_box_tetra.py
src/SMESH_SWIG/SMESH_controls.py
src/SMESH_SWIG/SMESH_demo_hexa2_upd.py
src/SMESH_SWIG/SMESH_fixation_hexa.py
src/SMESH_SWIG/SMESH_fixation_netgen.py
src/SMESH_SWIG/SMESH_fixation_tetra.py
src/SMESH_SWIG/SMESH_flight_skin.py
src/SMESH_SWIG/SMESH_freebord.py
src/SMESH_SWIG/SMESH_hexaedre.py
src/SMESH_SWIG/SMESH_mechanic.py
src/SMESH_SWIG/SMESH_mechanic_editor.py
src/SMESH_SWIG/SMESH_mechanic_netgen.py
src/SMESH_SWIG/SMESH_mechanic_tetra.py
src/SMESH_SWIG/SMESH_reg.py
src/SMESH_SWIG/SMESH_shared_modules.py
src/SMESH_SWIG/SMESH_test.py
src/SMESH_SWIG/SMESH_test0.py
src/SMESH_SWIG/SMESH_test1.py
src/SMESH_SWIG/SMESH_test1_AndDisplay.py
src/SMESH_SWIG/SMESH_test2.py
src/SMESH_SWIG/SMESH_test4.py
src/SMESH_SWIG/SMESH_test5.py
src/SMESH_SWIG/StdMeshersBuilder.py
src/SMESH_SWIG/batchmode_mefisto.py
src/SMESH_SWIG/batchmode_smesh.py
src/SMESH_SWIG/ex00_all.py
src/SMESH_SWIG/ex29_refine.py
src/SMESH_SWIG/ex30_tepal.py
src/SMESH_SWIG/ex31_dimGroup.py
src/SMESH_SWIG/smesh.py
src/SMESH_SWIG/smeshBuilder.py
src/SMESH_SWIG/smesh_algorithm.py
src/SMESH_SWIG/smesh_selection.py
src/Tools/MGCleanerPlug/MGCleanerMonPlugDialog.py
src/Tools/MGCleanerPlug/MGCleanerMonViewText.py
src/Tools/MacMesh/Example/PressureValve.py.in
src/Tools/MacMesh/MacMesh/Alarms.py
src/Tools/MacMesh/MacMesh/CentralUnrefine.py
src/Tools/MacMesh/MacMesh/CompositeBox.py
src/Tools/MacMesh/MacMesh/CompositeBoxF.py
src/Tools/MacMesh/MacMesh/CutnGroup.py
src/Tools/MacMesh/MacMesh/Cylinder.py
src/Tools/MacMesh/MacMesh/GenFunctions.py
src/Tools/MacMesh/MacMesh/MacObject.py
src/Tools/MacMesh/MacMesh/PublishGroups.py
src/Tools/MacMesh/MacMesh/SharpAngle.py
src/Tools/MeshCut/meshcut_plugin.py
src/Tools/Verima/Base/dataBase.py
src/Tools/Verima/Base/exportToCSV.py
src/Tools/Verima/Base/importFromCSV.py
src/Tools/Verima/Base/tableDeBase.py
src/Tools/Verima/Base/tableGroupeRatios.py
src/Tools/Verima/Base/tableGroupeTailles.py
src/Tools/Verima/Base/tableGroupes.py
src/Tools/Verima/Base/tableGroupesRef.py
src/Tools/Verima/Base/tableMachines.py
src/Tools/Verima/Base/tableMaillages.py
src/Tools/Verima/Base/tableMailles.py
src/Tools/Verima/Base/tableMailleurs.py
src/Tools/Verima/Base/tablePerfs.py
src/Tools/Verima/Base/tableRatios.py
src/Tools/Verima/Base/tableTailles.py
src/Tools/Verima/Base/tableVersions.py
src/Tools/Verima/Base/versions.py
src/Tools/Verima/CreeDocuments/jobHtml.py
src/Tools/Verima/Gui/maFenetreChoix.py
src/Tools/Verima/Gui/monEditor.py
src/Tools/Verima/Stats/getCritere.py
src/Tools/Verima/Stats/getStats.py
src/Tools/Verima/Stats/job.py
src/Tools/Verima/Stats/ref.py
src/Tools/Verima/Stats/utiles.py
src/Tools/Verima/ajoutEnreg.py
src/Tools/Verima/compareVersions.py
src/Tools/Verima/createDatabase.py
src/Tools/Verima/lance.py
src/Tools/Verima/passeJobs.py
src/Tools/YamsPlug/monViewText.py
src/Tools/YamsPlug/monYamsPlugDialog.py
src/Tools/ZCracksPlug/Zset.py
src/Tools/ZCracksPlug/__init__.py
src/Tools/ZCracksPlug/casTests/launchCas.py
src/Tools/ZCracksPlug/casTests/launchManuel.py
src/Tools/ZCracksPlug/ellipse.py
src/Tools/ZCracksPlug/genereCrack.py
src/Tools/ZCracksPlug/main.py
src/Tools/ZCracksPlug/rectangle.py
src/Tools/ZCracksPlug/sphere.py
src/Tools/ZCracksPlug/utilityFunctions.py
src/Tools/ZCracksPlug/zcracks_plugin.py
src/Tools/ZCracksPlug/zcracks_ui.py
src/Tools/blocFissure/CasTests/cubeAngle2.py
src/Tools/blocFissure/CasTests/cylindre_2.py
src/Tools/blocFissure/CasTests/ellipse_2.py
src/Tools/blocFissure/CasTests/eprouvetteDroite_2.py
src/Tools/blocFissure/CasTests/execution_Cas.py
src/Tools/blocFissure/CasTests/fissure_Coude_4.py
src/Tools/blocFissure/gmu/__init__.py
src/Tools/blocFissure/gmu/ajustePointsEdgePipeFissure.py
src/Tools/blocFissure/gmu/blocDefaut.py
src/Tools/blocFissure/gmu/calculePointsAxiauxPipe.py
src/Tools/blocFissure/gmu/casStandard.py
src/Tools/blocFissure/gmu/checkDecoupePartition.py
src/Tools/blocFissure/gmu/commonSubShapes.py
src/Tools/blocFissure/gmu/compoundFromList.py
src/Tools/blocFissure/gmu/construitEdgesRadialesDebouchantes.py
src/Tools/blocFissure/gmu/construitFissureGenerale.py
src/Tools/blocFissure/gmu/construitMaillagePipe.py
src/Tools/blocFissure/gmu/construitPartitionsPeauFissure.py
src/Tools/blocFissure/gmu/creePointsPipePeau.py
src/Tools/blocFissure/gmu/creeZoneDefautDansObjetSain.py
src/Tools/blocFissure/gmu/creeZoneDefautFilling.py
src/Tools/blocFissure/gmu/creeZoneDefautGeom.py
src/Tools/blocFissure/gmu/creeZoneDefautMaillage.py
src/Tools/blocFissure/gmu/eliminateDoubles.py
src/Tools/blocFissure/gmu/elimineExtremitesPipe.py
src/Tools/blocFissure/gmu/ellipsoideDefaut.py
src/Tools/blocFissure/gmu/extractionOrientee.py
src/Tools/blocFissure/gmu/extractionOrienteeMulti.py
src/Tools/blocFissure/gmu/facesCirculaires.py
src/Tools/blocFissure/gmu/facesFissure.py
src/Tools/blocFissure/gmu/facesToreInBloc.py
src/Tools/blocFissure/gmu/facesVolumesToriques.py
src/Tools/blocFissure/gmu/findWireEndVertices.py
src/Tools/blocFissure/gmu/findWireIntermediateVertices.py
src/Tools/blocFissure/gmu/fissureCoude.py
src/Tools/blocFissure/gmu/fusionMaillageAttributionDefaut.py
src/Tools/blocFissure/gmu/genereElemsFissureElliptique.py
src/Tools/blocFissure/gmu/genereMeshCalculZoneDefaut.py
src/Tools/blocFissure/gmu/geomsmesh.py
src/Tools/blocFissure/gmu/getCentreFondFiss.py
src/Tools/blocFissure/gmu/getStatsMaillageFissure.py
src/Tools/blocFissure/gmu/getSubshapeIds.py
src/Tools/blocFissure/gmu/identifieEdgesPeau.py
src/Tools/blocFissure/gmu/identifieElementsDebouchants.py
src/Tools/blocFissure/gmu/identifieElementsFissure.py
src/Tools/blocFissure/gmu/identifieElementsGeometriquesPeau.py
src/Tools/blocFissure/gmu/identifieFacesEdgesFissureExterne.py
src/Tools/blocFissure/gmu/identifieFacesPeau.py
src/Tools/blocFissure/gmu/initEtude.py
src/Tools/blocFissure/gmu/insereFissureElliptique.py
src/Tools/blocFissure/gmu/insereFissureGenerale.py
src/Tools/blocFissure/gmu/insereFissureLongue.py
src/Tools/blocFissure/gmu/listOfExtraFunctions.py
src/Tools/blocFissure/gmu/mailleAretesEtJonction.py
src/Tools/blocFissure/gmu/mailleFacesFissure.py
src/Tools/blocFissure/gmu/mailleFacesPeau.py
src/Tools/blocFissure/gmu/meshBlocPart.py
src/Tools/blocFissure/gmu/orderEdgesFromWire.py
src/Tools/blocFissure/gmu/partitionBlocDefaut.py
src/Tools/blocFissure/gmu/partitionVolumeSain.py
src/Tools/blocFissure/gmu/partitionneFissureParPipe.py
src/Tools/blocFissure/gmu/peauInterne.py
src/Tools/blocFissure/gmu/produitMixte.py
src/Tools/blocFissure/gmu/projettePointSurCourbe.py
src/Tools/blocFissure/gmu/prolongeVertices.py
src/Tools/blocFissure/gmu/prolongeWire.py
src/Tools/blocFissure/gmu/propagateTore.py
src/Tools/blocFissure/gmu/putName.py
src/Tools/blocFissure/gmu/quadranglesToShape.py
src/Tools/blocFissure/gmu/quadranglesToShapeNoCorner.py
src/Tools/blocFissure/gmu/quadranglesToShapeWithCorner.py
src/Tools/blocFissure/gmu/regroupeSainEtDefaut.py
src/Tools/blocFissure/gmu/restreintFaceFissure.py
src/Tools/blocFissure/gmu/rotTrans.py
src/Tools/blocFissure/gmu/shapeSurFissure.py
src/Tools/blocFissure/gmu/shapesSurFissure.py
src/Tools/blocFissure/gmu/sortEdges.py
src/Tools/blocFissure/gmu/sortFaces.py
src/Tools/blocFissure/gmu/sortGeneratrices.py
src/Tools/blocFissure/gmu/sortSolids.py
src/Tools/blocFissure/gmu/substractSubShapes.py
src/Tools/blocFissure/gmu/toreFissure.py
src/Tools/blocFissure/gmu/triedreBase.py
src/Tools/blocFissure/gmu/trouveEdgesFissPeau.py
src/Tools/blocFissure/gmu/whichSide.py
src/Tools/blocFissure/gmu/whichSideMulti.py
src/Tools/blocFissure/gmu/whichSideVertex.py
src/Tools/blocFissure/ihm/fissureCoude_ihm.py
src/Tools/blocFissure/ihm/fissureCoude_plugin.py
src/Tools/blocFissure/ihm/fissureGenerale_plugin.py
src/Tools/padder/spadderpy/__init__.py
src/Tools/padder/spadderpy/configreader.py
src/Tools/padder/spadderpy/gui/inputdialog.py
src/Tools/padder/spadderpy/gui/plugindialog.py
src/Tools/padder/spadderpy/plugin/spadderPlugin.py
src/Tools/padder/unittests/usecase_meshJobManager.py
src/Tools/padder/unittests/usecase_spadderPluginTester.py

index ad3d2df9bf77274ca39af93f9743435d6b9f2dcd..443ac557192043d73eedcd7ffe91da4a82f88dd2 100644 (file)
@@ -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 )
index e5651cb670a2a96a2e9c8492e8220d647ddd0582..179b9bb3f5f1c15fc047786d09ab542965098fe4 100644 (file)
@@ -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())
index f328d0582e19ccf5bbd6199beef539fa537d20f0..1d0d94f7690c36e5f9b5ca3bc78767a83de7cf05 100644 (file)
@@ -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
index 8687b8971a1c2cc486896492388372733252dbce..fbc0eca24934d3f51d1e0b7aaaa3f043e9e71b4a 100644 (file)
@@ -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())
index 82408d5a3e5da222e9cc6863f046ed4f703f2a5d..b0db4bdb7038d3d8a79a8cc4b5a5d38cb8b4d166 100644 (file)
@@ -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
index ae1d073b4260139f5deb0c7502f018dae48cbbcd..fbafc4b11062769522732d5db260a83deb1f73ec 100644 (file)
@@ -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 )
index 495067aa6e5a909bcc3345337522a713459691ec..6fd5e021029f6c82d697e8df3e38daad872cd043 100644 (file)
@@ -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")
index f500d1b145c87abdab6c4b7e4018654acb1f50f3..b3b5b61b7c8c8b9e16502c0e6745c94683a8e1d8 100644 (file)
@@ -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() ))
 
index 812e9428878883a49f86ffef2189c7bc7c2d6cc5..02f3588c8dd795fa70c50864c2ce7b153e2f1594 100644 (file)
@@ -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 ))
index 5709ef4b04440312c1f579fff1360308b1f15947..6a392ce41e7f6e887057835317c1a8a972d928e6 100644 (file)
@@ -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))
index 9d5467e6fe638ca80ef2ec3843048a9abea8f68d..e01b60df506121b30f309a5b354ef049751a5dca 100644 (file)
@@ -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))
index fef619c80bf39ebf350934addd4679b7628907d9..2b274837a1541d71ce2e59cf28eb3d8bd3ad1c40 100644 (file)
@@ -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))
index c1c185275c448da0dee9e05ef935f9cfc185f619..c470db6bccb0a1c439bf540b07a078b016526dc1 100644 (file)
@@ -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))
index 610a9a9e84da63bfc4dcd1c128205590b78aa9de..94666f70c1a57a416c59135928063f58e56c6b99 100644 (file)
@@ -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))
index 3afee5e1a705b941b5591b6146c5af90b5f8823b..7d781dc226a27f817c00a990a1f647560a8f371a 100644 (file)
@@ -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))
index d87f974536acd273cad7b9dc82ce6db7efc4e8ce..479de961e7c061f56bf537826163930a12ef8da7 100644 (file)
@@ -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))
index 032d55ddda5f6b4f2c239f727c00908adeed016d..8f00c7f8dd623a00cdf533a68cabf50f7f1677e3 100644 (file)
@@ -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))
index bf6f7419bb9de4a1c4f6821cb538c2bbed1b38af..0cba34f163099f933104747a29747aa8805f92fa 100644 (file)
@@ -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))
index 5f1bf4c68a5cf726479bf1d10386737801156d52..47b62e2825a9c737857174101aee73ec45edff85 100644 (file)
@@ -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))
index a1f20dcf35681b3d2ebbc2ce0d84d003c522e6fa..5dfd81ad453fca706b0f672c78fa0abcf276ee0e 100644 (file)
@@ -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))
index 8d8077083042963ac8c2101c21e268149d518b18..ae64b565a63f30770db16ce2e88dddbb9249f987 100644 (file)
@@ -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)
index a9021f98ce67f9411552866d5e293dbd87b154c2..2e68ae8f2db64e6109a62d93a3e75258cfa2d8dd 100644 (file)
@@ -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))
index 3f1344704c45bca4265c399fdee9b95a760e2a2f..70c8cae5cd1b6daf1ca380994fb481dabb848b59 100644 (file)
@@ -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)
index bdca2d86a14d5a41df283d52ddf616c4c40cb351..e549a14f0874921c88d8fa44b56e102343f6a32a 100644 (file)
@@ -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 )))
index 9dc01b49c49bb495b2ac56f4e16314b1ea7a4069..7398b5ac77b13975eefe3a0ed661d501abf38b10 100644 (file)
@@ -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 )))
index 32950cc50302504776e80f81f7fb4cdd94962ff2..ea436f4781262dd26a57e5d0ae08386f3994b9e1 100644 (file)
@@ -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))
index 3ac78794fa9e4081850a812d723d47df3b7c3fc6..cb1c545a353e130478a74aad6c905fcaf65d1d16 100644 (file)
@@ -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))
index 1bdc00b535cbde8a19932855f5fc11477538d563..c55b56b23ef8f72c143c521b1957f99cd90702de 100644 (file)
@@ -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))
index 79c88434bbae5291907d5a0f0eded07ad39a63a8..81d408701847302801c6cd2eb78561abf71fd0d9 100644 (file)
@@ -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))
index 0271110fe854e92b401eacae2ad62ebacc3f8ab9..cb7971bd6962fb9b26b80bc8f4288b361ba45607 100644 (file)
@@ -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))
index 49569dfe8f977acc1cca0bee627e416c188230e0..8c995090b9fa2845f92a01bb8672e8ad0916c477 100644 (file)
@@ -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))
index bab47e2a7f5da58fce099f495d322428196db7cc..f5f07b024dab2c2142708c5fb64d6fd5516e0b89 100644 (file)
@@ -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)
index 06862c75fa356cb087ba7fc062970e9ed49eca5a..f3083f7fbef88413bf47fb68839e56ecbc7f2736 100644 (file)
@@ -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)
index d544466e45db66cd39471c60b8909c3e6fd320ba..ea7cff8acf59dcc6d98988ba79565c224d4ca66e 100644 (file)
@@ -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))
index 4c38bd92f2857a1934a714a4742cb5849c576be2..e05ecbeff14b1c0ac2a405c2cea301fa2e2e8d81 100644 (file)
@@ -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))
index 12da64cc707a2c4c056c68a4aa07264f18ad4952..f0382ac65e26b5007b3b0f2a473259a19fb8ec77 100644 (file)
@@ -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))
index b4a454ad72eb0ed3a2a8983031e2da958e4c9fa3..e6b817a4c27d9e8c226d120e4aa68bd058e5f617 100644 (file)
@@ -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))
index 9d161a763715dbfde81625189d0d9ecaa277303b..856010b9d9168932a445d5a7abeeb79ff16ca790 100644 (file)
@@ -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))
index ea9b99e0e7b12604353614d4c4184f6a3c6c36e0..209bb9f77f124b2c5232125e2bf00f721c43da04 100644 (file)
@@ -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))
index 5ce64d6255a0383acb29dd6c2d3ae5bfd9a11975..5630f7812b5db20804ec3fffabf4a94f031d766d 100644 (file)
@@ -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))
index 7ffb5548f7fcaeeb09f887137cedddf6ee98b9f2..4e54e55a749ca2687de3c07b3abf7c6592204b28 100644 (file)
@@ -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))
index 980509dbe6d62f4d688f75ef4e71b6a58c1773be..7234f16ac8b1de362576e00212e441cb2d4f9fa6 100644 (file)
@@ -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))
index 99c5ef546ec69a5458701f51543e5e250f335adc..fea0902b9acaae5b2670cf2d0bbb2cf4998cb2a9 100644 (file)
@@ -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))
index 85dcb33cd119a48f7602fec12a13d3bd0fc22abf..06d69d715a2b5b0cb0d81ad75db595556ba526f5 100644 (file)
@@ -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))
index e597608d344283470684886da05b9b2ba4e715ba..2193c6615b6a717911263c75bd36e6abc83cc5db 100644 (file)
@@ -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))
index ebbb0b936591ae9f5ed76af956d91d70a3ea47d5..7f956785f8ca8de060645509994d1c268eecb725 100644 (file)
@@ -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()))
 
index c7f73f13dc10af689360b4e7ad8effc6b0ed3dca..dc7ce0ea14c4e4d19d8f2b52c8d93f300536ee9a 100644 (file)
@@ -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))
index 0bb1b9a2f9321571a12c41620dbfe5995773017d..bb97b024a1f18b63f3223fba52ab1bdc01a61c0e 100644 (file)
@@ -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
index bd85e09e05f55d79c3648a2f95121eb61eaf5ade..928b495633db31170d14184d3e7580ad83406252 100644 (file)
@@ -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)
index 9beb77e364512bac452ac2f5b2520bc1114ad37c..a7b26c4e5b69165d509352296c1fc3cdfb078b9b 100644 (file)
@@ -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)
index 047691b863aba6b0a22d4baa88c72b181fe0c5ae..23e1abf87a3a1a8267e1d6ad875b5035b61b9966 100644 (file)
@@ -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)
index bf9e3708ba26be7f6c38a80be7779aa4e28ba5cc..a5b2c3ffb25fcc3111559a2cb7db116400721198 100644 (file)
@@ -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)
index 1a79c5fe27a2ee2c714e771b000d16deed61439d..eb288de24db4c4fb551ef5354ae587fb7dc19a6c 100644 (file)
@@ -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)
index 459a50dc24a8556aec8db00120e699013495dfe8..9447f98ec043d45e00781f2045efab4633de1b12 100644 (file)
@@ -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
index 5a44cdaca9f25e5d0f8278a7a2d00462a315d7fa..f788c56db58bda438bffc57da2dcd94bd9f816ed 100644 (file)
@@ -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")
index 0ef07aa7af0eae18dea177cb23309eeff9bb3345..e58950bb30ae068c7fdc7e4bcfe081611cd56ee0 100644 (file)
@@ -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)
index 7948ed3dc1e74dae7bd4048aec0da124e53266bf..b54a90988346b0d32b278056905203353806e519 100644 (file)
@@ -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)
index 0c6bc61dd1a24aa4381e53cd51cf5d5677c82ed5..2416baf4d9e716dea130191f569f8f665e792563 100644 (file)
@@ -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 ))
index 5aad0f551cd0d0c66e5728799775ef7b3aa2b37f..ad8d151b0de7505b45be7d7e33eccdf51ae8374e 100644 (file)
@@ -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)
index bd1e1438bf39ef51de5ae3438cd7817b935d9c90..c48042a6fab9cd22551bb6fee2a3928abafaae18 100644 (file)
@@ -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)
index b05c880890328d5d6a7db4b23ceed07c37dac838..ff568e0f18b1b401e3eb727821c1006973a6fc40 100644 (file)
@@ -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)
index 5dfa8da031f04e78a903d23e70e81369fdc9a157..93fa2d1cc95fa67079e5f570bb5881ad421ea89a 100644 (file)
@@ -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)
index 4cfa89ee4f8fd727b0cb5a9f30fd68873e6e22e1..1cf27c5dfce97f23369807701add34db508b4e69 100644 (file)
@@ -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)
index 6ba78c3313f8f9f58806f81b1802aa7a0472f1e1..28b544bc0ed681898a247eb529f8d3b5488f764f 100644 (file)
@@ -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.")
index 5437b3815b841b4edd7f7a900eb2824bef421533..8ef8356f07291193d200fb050c38c234c1ea0313 100644 (file)
@@ -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.")
index 4189b852b885631d699ebd07d23ae037da3e6fcf..3c2e4e0bf9ca6825ac92d44fa03eac9ff9a668a1 100644 (file)
@@ -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.")
index 5985c0844f45656b2d2b3ccdb465dc8f8b7ad5b0..efd5cfbf9b051a20e33693316dbbb31c44f7189a 100644 (file)
@@ -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] ))
index 0786445eb2c95326c580aeb2d59c52be6e763f70..8b958f95bc55790d64c25564f3a48301214b07f1 100644 (file)
@@ -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)
index ebeb247a81a017a094f2d6b29343712cefd5424b..7cd708158f5c89f619e2ac1c1fcf4490fbf2f9e7 100644 (file)
@@ -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)
index 458b0fe2557e817c5bda56198f7ba1d38eb960c6..b44dde891fe2abc6408d8bb2a10b23f41234db61 100644 (file)
@@ -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)
index 650d998e5e8014792c80e71f53add61d01bffefb..e9afc8e485a08eb6c6e69a1a6697b07d41b9b252 100644 (file)
@@ -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)
index 3db2c3e1246c38de83e02b6806bbe5b0a5c9745e..350cc3482b605296be2053dd7a1138e97bb2e118 100644 (file)
@@ -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
index 4072560c45ac47dc73ba96647945f8779320ecea..8f0b06796cf1b381a774b3e20377258028f70980 100644 (file)
@@ -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())  
index 6990aa66b43b7790bd417dd3f8222e577508aaf1..a64a1f07343296a9b2c659a8d5f7f08183f57f05 100644 (file)
@@ -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")
index c2fc56f86496d9019bba127d76a8956c74932049..8b6be1c73015e1c7e4427ef23e001d20f6011ad5 100644 (file)
@@ -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")
index 7c5a804f5067b992e20c39a3f6c0c159dbd9b0c5..089341109f1e8d8dcd9cc4681e1306e405372107 100644 (file)
@@ -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)
index 373ddbe024fc6f28397b0b3ccdc55852c770eb22..786f0d24f5591f968415b43fe69124384a2309c7 100644 (file)
@@ -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])
index cbd2178391639e24954293f4a1508252f8938321..7d60b91ac21bc0184b83b109cad072d4a922878b 100644 (file)
@@ -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)
index 1bd007bf632849eb81c673ca44b65ec2226a01df..0de0911e19c41272a3e3681664c5469f38c76235 100644 (file)
@@ -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)
index b0b5e3f24dd89dd4ed2985988446afd66845456a..d108ef6d24bc24b5774b149ac0b33d271bebd246 100644 (file)
@@ -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)
index ba6fb9d7deccba5a1096a3cec211ed01772154c8..8e81e5130aada8f4b5da561b00402a15cc593266 100644 (file)
@@ -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)
index 3b52dbc126b03608ce3fb8c5fed2c13a3de45c8e..f623081e5faa4c6eb8e5431dfb151366c42dc3ba 100644 (file)
@@ -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)
index b66d9413a80a067030efd2574ba911187dc7656b..7ed0afcfe7c9a40eb51c02ff006f83e8782023a3 100644 (file)
@@ -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)
index 0aeedbfa8b65923e50a3b24d8095c8b9c135f9d3..7c2029a1e84c84397e3f774ec0cad9ec82081d0a 100644 (file)
@@ -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)
index e80e91f48c9f0e25f8be9fa8068b7d52a9731644..e0e59b3cd7660d9490b5df8745cfc27dd2192764 100644 (file)
@@ -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)
 
index 8f7f39c488929e89c2d06213bdde4d1eed27cc8b..89c6bfb1e8a26f7acf4053a736f6524e5c5a9da2 100644 (file)
@@ -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)
 
index ad6dff1850cfef7d881d7dcc2d525d64e7ebc7f4..514653527915cc2fa9e0c33c76c8e9eef65cbf25 100644 (file)
@@ -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)
index 814cb5ba527fe71282cec130fb914ceff36a0ab2..5713800c82d20a358cbc8cc079616cd2ce0f0590 100644 (file)
@@ -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)
index 3a7c44f940fac163e130ba4857999d916f2c6908..e18332407de5a998982d23b5e3d26fbb877e499b 100644 (file)
@@ -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)
 
index 1f27eef3af06bf07fd1b7a98ff609bb5173e09f3..0e80e50691faf04040ab1d4d61895dc970d6b3ab 100644 (file)
@@ -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)
 
index e43e5c1b8e3ea764670dd2ec85a4d4e436a04c44..aff8d25d3304b470157e8d21c4d5de4b003fe28d 100644 (file)
@@ -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)
index 47c25b1ea79e934b19e175a617a465d5fb15dd95..bd1a36f613da7a1f467dfafc00f203e48a0ef360 100644 (file)
@@ -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)
index 9264a5c4c508aa81410e9db22f167098ddb7a7b4..ac2707cccfdcfa15ad79466eb55e4d458fb07fee 100644 (file)
@@ -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())
 
index e0120b4810f5dc87b5a03dfc88aac0dc32bf8cfa..7f6656135d81f32258f4c265491d253fd6e8e624 100644 (file)
@@ -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)
index 0abe520131492f6585d342c2a73a2577f244ee3c..d827909adf88b947ec4a69c1c176cf8ae852e785 100644 (file)
@@ -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
index 37a3f5eed20b01b3dbb18da1b46a60dc3fc56a83..dfa412358b68796cbd739d0f039d6b046eda15da 100644 (file)
@@ -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)
 
index 85bc69fbca2457e2af92fdcab8574347b7e09818..f61a59af474956cb94d61cc76dffa229a56d08b7 100644 (file)
@@ -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
index 7aa83b0849f15c5ed13eee0345671303feb711ed..5c89fc9b0634ba68b7c8c0fdcc68d1717279574f 100755 (executable)
@@ -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
     
index 3d407f85bacfcf9014f805b768a522f8ff1d27d1..1b82fa5deec0f658993e846e06e8d57c98717b2c 100644 (file)
@@ -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)
 
index 67f0ba76d2db48cbbee9b419a5462aed508c04e3..5cb4dfed0379a1022021b749d3ada1abf6f52431 100755 (executable)
@@ -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)
 
index 7d2ee5a0955f0e9463d71e24fab1bbbd51c78d93..3732428312915fe4033af85abb88d851389b526c 100644 (file)
@@ -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
index cc25ccda9d7af3dbb5f8bcf8a12f679f4f4ffe8b..16b67e7deb1fc3e49592612b0837c7369e5fe193 100644 (file)
@@ -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
index b0e936b19b7afb223153382a5f2b0a052740889a..7da0c130d178aac1ab3cb32da936fe2acea9cb68 100644 (file)
@@ -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
 
index 498235198a9ff4316916f83cbed5612832941daa..b02c47cd86a1bde9917d6a31161cedaf4cdde474 100755 (executable)
@@ -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 <LocalLength> hypothesis: 100 -> 50"
+print("Modify <LocalLength> 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)
index 4d7f05901b0b64d63379d94587c98facc5429fc7..47bb94fbdb441c55edabb7cdee9ac2c981ae648c 100644 (file)
@@ -37,7 +37,7 @@ def BuildGroupLyingOn(theMesh, theElemType, theName, theShape):
     aGroup.Add(anIds)
 
 #Example
-from SMESH_test1 import *
+from .SMESH_test1 import *
 
 mesh.Compute()
 
index 3e27b57ce9bf61c20ce2c6b4cd44cf97a7a10fa3..32330467488ad838552751907e79e7749f17d05d 100755 (executable)
@@ -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)
index aee34bb7eb4744debae0ed718d9daa961e1be84d..0b6b9824588969a18058a2c1afc77df161d8a919 100644 (file)
@@ -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)
index 6bba8e16502c03fe95aca0aa16d4b33d338fe5f5..f8b123616ddc969a1ef714a4900265b389ac4915 100644 (file)
@@ -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)
index 6121df448b78d776151cffe1e7fc85196bc1c091..55e0475838d5cea49e49f1c69f1358cc2d595442 100644 (file)
@@ -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)
index 4938de61eae577f5ed11bd78fac4e2916cef352e..d2e6c8e711c8cb76b06d7d6a5722a04a7ad3e444 100644 (file)
@@ -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)
index dfefee94cb1c4d6fcf07265435d56b37b82aa169..a2b36a21293a7ee683964c99579db3e33f8f9986 100644 (file)
@@ -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 ]
 
index ef6ea57c1dc63563aac531a19e54d223e15b7327..604f21714e0e13987d2bfc855693366541a8788e 100755 (executable)
@@ -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)
index 7d9245c3b5f908379f52129fed7dcb0f284fbde5..cb5e77e0f20ec600285e96f83a59e95895a9b439 100644 (file)
@@ -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)
index ed2c999f4f64480be14a3da4721f4e426ee7b8ac..6731d63f5f492569204e76ca378bb7bb5c325b4d 100644 (file)
@@ -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)
index 4f578dd0168d1048621624226c4d03d9de4d45bd..3e8732a53684bda196848db3c9d6c686ad5c557c 100644 (file)
@@ -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)
index 44ca46630e65ef8143cc7c3fbcb535a871c86c7d..144a9fab95bb31ecd56fa11b28c14972768306f8 100644 (file)
@@ -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)
index 7bd4f3a83dcb675d29a79b5e6e96c4bbffe7c93c..6422701aba11325187418a16c8ff18a8fdf8ea59 100644 (file)
@@ -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)
index a2dd15b9361e916a348f19a3d21b5274fcb94259..0373a57f46ede524f3e795ad4862f3a9b2590e5a 100755 (executable)
@@ -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)
index b0445358183578336d58a4b047433b1f82fd6796..f74a37208925ebe8d798b8e69415c7d9f65207df 100644 (file)
@@ -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)
index bb340bc9530e72ffa26c1cbe75f5b1150ef7cdcd..7398542300993a02fe000ec5bd787c0490bed44c 100644 (file)
@@ -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
index 326348b7cc43f1dcf643c4a46be3c0c0576284e3..388d42e3c3e9d0d350d571610032ba73f46f42f2 100644 (file)
@@ -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)
index 18925dac7983059753770d4ddd1d08ce7e49f172..284da9268696b4eed9b919db0d0a44613c2d84fc 100644 (file)
@@ -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)
index 1ce3e6cbaa2b3b8fb5a0a4d82c96e99d594b95cf..2c5aa2465697d6f7cb197de63ffb7a86f5750ef2 100644 (file)
@@ -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)
index e664de617ef56327998ad85e304ce68ac9d00ce0..89e49ce886e8eaaeaede8df31e4da339c68f504d 100644 (file)
@@ -31,7 +31,7 @@
 
 from launchConfigureParser import verbose
 
-if verbose(): print "============== import SMESH ======================="
+if verbose(): print("============== import SMESH =======================")
 
 import SMESH
 
index 463b77382148999bc161b5671d60e8ac46438b9a..0de27458593a11eefc082313469706b68c97ce49 100644 (file)
@@ -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)
index 23339f35ffb226671884e268b7ff734945790f40..bc70c54d951bf3c714ff9d132ddc11bdf09a7238 100644 (file)
@@ -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)
index ffc08c680a0d7d3568709659562b05fa9b4cd13a..d9c6f179fb2aea12b62d0e093fa5e46b66474976 100644 (file)
@@ -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")
 
 
index 0c510a12925ecee5c85618737c8b3eeba0061895..6212075af3d7a083c6c0955580e70a9cad608124 100644 (file)
@@ -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()
index c7dc5b14a6802f6817b52b8a2734683d24256ab8..67793b8b7ffc2d314836c846d5e1ec9c308f73f3 100644 (file)
 #  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)
index 6467319a6c6213164c96481e4913b4a6433556b4..d1d6ce701afabe3a58e02c009fab9fd97fd3f9ef 100755 (executable)
@@ -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)])
index 0464598cc49f9a684bbde93bec25af1de100e62a..2b8dcaaa42e0bd7bd00853f6869a4ac2d11bd49d 100644 (file)
@@ -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
 
index 4fef40fab884171b624d58acd2f477d1db1fa34e..73af7d5aeae7c833662a95b7489d477388e28ce9 100644 (file)
@@ -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 ):
index baf57efa9359d01fa841607b9ec973e11159561d..6989529fb1f0cc7b92af0684782d257fe3492db1 100644 (file)
@@ -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
index a78f922ca014765026acb4c554f5e572375946c0..28a25a251b46941cdcd2fc7e81742533f3bcf4ef 100644 (file)
@@ -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:
index 817552834b55111c1666d9fdb7b1f18225985ede..c1256b304a741638142f5f79e966dc3153945235 100644 (file)
 # 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
index 938d0eac100553a1fd32ff368f33b7ba5c5329d3..1848af2fc43e7f31c20a948d9ac4fafb610e2fec 100644 (file)
@@ -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)
 
index cd8e7bdc1233df24ddd90937b37230d8e5dc1ec7..699df1640b90dd1c3ed1e73386b05511ef7ec603 100644 (file)
@@ -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
 # ---------------------
index 1643ae99ae4da6ef44913bd5ab5bf3611790305e..b1777f5119ba225a80a72c30608438a7f54db194 100755 (executable)
@@ -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 )
 
index d2ae49598cd6d0d2646acbc24dc741b6eb0d869d..cf4e911be2eaf5d6ae6e67dfffc85476e01e370f 100644 (file)
@@ -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!
 
 ===============================================================================
-"""
+""")
index d36fb09ba9f55139232dfb7bd9bb738c44cdef4b..62b98a8168b2cd9a4c012899aae7052072409dce 100644 (file)
@@ -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 )
index 3690f76d8f57ace4a10910a25f3ed29a06b83dd7..8d0946de12b043839edf5fca4d9348caa1ed5bf2 100644 (file)
@@ -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
 
index 8821880894511da5ab0d3a967a956b111e9f89b0..5cc7c942297f3b328972a6a488db05ba53efc6dd 100644 (file)
@@ -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())
index e7a1d5ddd3d178f0ab283397ed94b348ae928c00..2f2e5c1ee4962f4f442aa952e1f00bce26e62a6b 100644 (file)
@@ -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):
index 01c53069d800ac41fd37ef4e0ba6393f8e8ed5de..99e322d3111813d8c56f8c520653485f48c585e1 100644 (file)
@@ -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 <b>%1</b> could not be saved.<br>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):
index 612f4f76955493718008a8835d14fb2a01f6b8aa..abacc092e65a21b72230610186ce4fc1fd7922a5 100755 (executable)
@@ -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)
 
index 1aedce1e12c9a89e292aa32cbd5ad03ae9d0cb9e..e0d7de6aca458c67489d55e602b2fa600631aeb6 100644 (file)
@@ -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
index 5be20c0bd23a43727c6de72991cf3885735266a7..de90ea4456dbac74fd850811355025009045246b 100644 (file)
@@ -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 *
index c929ede2bbef2923975af920b81872ed443245e5..b75ece724fc6e4446f07328e59522c8a043ed426 100644 (file)
@@ -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 :
index b4c90e4bcc5b446437ba5e65d0397db0878e6c4b..dc1be5336867db9c85478a30dfdf5ec9d0209809 100644 (file)
@@ -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])<min(Int1[1],Int2[1]): return [max(Int1[0],Int2[0]), min(Int1[1],Int2[1])]
     else :
-        print "Can not find interval intersection, returning [0,0]..."
+        print("Can not find interval intersection, returning [0,0]...")
         return [0,0]
 
 def IntLen (Interval) :
@@ -211,7 +211,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 :
index 6c548653fcc1f9f350a86e1b323010ea57202ab4..da3d7f97264ec06ecec9765e8b86f95da8a7847e 100644 (file)
@@ -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)):
index 7042e212f62657ab5259e1135e6bb81e3eb7ee09..2ddb72c24fa1395d6825cd0964d198783e60c1a3 100644 (file)
@@ -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]
index 9b3a33c8b5dd9c2e0a8eb8a84f3364f51a89debf..1c476ec81a26c166c52993847cb936535bc742b6 100644 (file)
@@ -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])
 
index 8c24d560e4622e15834d4882454c5d874e0be742..f2665083dca65df9ee917f8a8450ec95562b7388 100644 (file)
@@ -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])
index 79304b972ffefea60ec207fe4a602a7ac1666f35..52dcf728abfff3bb433f6f7294e746ea8144b4dd 100644 (file)
@@ -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'])
index 6a544037b54a092e1e40d3360bdf0351417e7838..1eed87f19bc88fe9b617a9a472d0fbfd1fcc77c0 100644 (file)
@@ -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'],
index c5abe768acb477e58d2a1bd835d11b71f7347623..a233673b8b6ce5e3b500adc6c7eb2c0ef55f01c9 100644 (file)
@@ -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())]
index 8940e06f14131ff5479d3760d3402e59188c3a5d..11dcee37e5b48b54ce2aa848ba83d85a7985a3e4 100644 (file)
@@ -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)
index 783e7ac7481c2ce301bac63870577df18aa78957..7737c526795f98504714cabdabcc49cca38a36ca 100755 (executable)
@@ -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
index a394ab16b897fd01162834a0acd1c8c36f7cb96b..5c98544aac790398e3a1191acb76fa808d6602b9 100755 (executable)
@@ -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)
index bd5c92c9fd915d96aee25dac66e89a2a13b4a1a1..7bba47cb72e94cd5f8b8aefc3a541d8e56e32eec 100644 (file)
@@ -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(";"))
index 707fff8ae439be54749e95ead7b2dce82b19adb0..c435f28ffabc026649f98b64b9106a898535678a 100644 (file)
@@ -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
 
index 6f37bd70d51475081b8836f9dac75a080979e50a..c18dae294dacd6a78cd776e814c2627b7b74501f 100644 (file)
@@ -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
 
index a217909a944d33ad1fac8e8a9d0df2bdd63a6a27..7a78dfa05249c0186706b4ebd93d94edd8c7a4a1 100644 (file)
@@ -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
index 3208be7fb537177c7fe575f4fc95a142c059da71..663f509d114d4ddff644a4a98bb42e0d31c6c847 100644 (file)
@@ -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
 
index cb743ccb545cab7cf08df699f7e893b6f40b6c69..0b149d95e8bf3ff37422b9a945eb244f38b3eefa 100644 (file)
@@ -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,  ""
index 83f73725c32c04d1409e9de0afd46575f92d148f..dccad9382acaad59114c3b7d0ffb791dbe61dd21 100644 (file)
@@ -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
index caf72e128b4a75ec410ca3515b513d7e8ac3ae9c..cd279e7a5109337dc475f55020b0a057059fef60 100644 (file)
@@ -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
index ca76e602efe7108479212f443ff640981ffe8fde..0c727c4ddee52be2066944742bdc873f30182e41 100644 (file)
@@ -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
index 4955817eb888b29ba23949016cc648b210794931..15751cfc2c97f45a25d376d494e5e4dc0827497d 100644 (file)
@@ -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
index 85397abde3ecb28e04526233baf86e9b1536de87..1fdf274e8c0243187bae51f558bc501b36ed8c98 100644 (file)
@@ -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
 
index 6e9637f160aaab916a22c76d21daab42f6054d82..43e39fee5b428c8b7e48e53a171af3582293bb30 100644 (file)
@@ -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
 
index 9767f039437f6358235317a22cfdaa2b441c143e..afe900e3201318533fc701b8b3469e1b7a5f18be 100644 (file)
@@ -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()
index b5af3482b2d85fe1911106f35768c317a7af1987..55cea45a17caa78853edd9c4ce075c24a2e4a07e 100755 (executable)
@@ -17,5 +17,5 @@ def Chercheversion(salomePath):
 
 
 if __name__ == "__main__":
-      print Chercheversion("/local00/home/A96028/Appli")
+      print(Chercheversion("/local00/home/A96028/Appli"))
 
index b307fc3d1e4599acf8d635a52dd5d917a3f801a1..634827bf7a7d799e1d3d0cd56d08e5183d176e46 100755 (executable)
@@ -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)
index bc9e73e0232d86bfd41fffe667cdc5442556f8f4..a92b149451598cf06eec37bc654e6eff5956ae1b 100644 (file)
@@ -1,6 +1,6 @@
 from desFenetreChoix_ui import Ui_Choix
 from qtsalome import *
-from monEditor import TableEditor
+from .monEditor import TableEditor
 
 # Import des panels
 
index ecfd4fe4449d8cf2fbc27cdce08c5acdf77cfb12..13b5c9d4953fb90212d69347a7732bf18d30f065 100644 (file)
@@ -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()
index 16239e1701a0e4b17e7ee34ac7da37441a79efcf..920496506a21dbdf455875dbffbf295cd0cdbabe 100644 (file)
@@ -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
index 3f329c71bb103cd364b03ee30b1159c26bab5797..a5d46d082fc5de775954dbc9613fa80249faaa9f 100644 (file)
@@ -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)
 
 
index 23e646c594e6ccc667fe50525730571cae24db46..6ee955236810656dc678ae7a8196d2b84b4e2018 100644 (file)
@@ -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
index fc3a3e2cda4ffce5fb134c815b5ec3a688622045..40b4d86eef1a6519c29bd98dd99300a261e3c221 100644 (file)
@@ -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
 
index 08e1a8f259ff614fe20f677f89b08044a24f9a1d..e7d2156c0fd1097fc3a1717634f4d8566bb1b648 100644 (file)
@@ -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)
index 5f227debf30506358083198bb998d3914a859dbe..57d18dcc60a1afe41d840a8613ad1a2301a39ca2 100755 (executable)
@@ -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)
index 64738b3d2f7dca4a39396ac679f2a63fe0b0c6be..9ceb0fc501e4ba3eddbaf4e2e2048a82e798a26c 100755 (executable)
@@ -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__":
index ad375ed5728bb303d074b9a9d75b4920595c0845..ce59861114434b66488d4b4ac66c65c5d3ad23c0 100755 (executable)
@@ -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)
index aadb04dfec5b442462057e33f6bf5506f30fad01..9fd326ef83881c2c4162d78a123275aa2c1e6401 100755 (executable)
@@ -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)
index f88b0c6b2eaa0d1e0f34111dcd5035062193b2a8..74cb9a078eeeec7d33e736d82498d2b4c1e1e8dc 100755 (executable)
@@ -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)
index ddc21501e8f6e5c74ed1a3aad7c031b9c9b4a02b..3109bfe8aad4c8ac3de005f910636ea4d3712bfb 100644 (file)
@@ -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 <b>%1</b> could not be saved.<br>Reason: %2'%(unicode(fn), str(why)))
+                 'The file <b>%1</b> could not be saved.<br>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):
index efdaa315438bd6a50f7fa7b029933f9ef6cd985f..90e4917971f0affb707c86f068f83f7d7abce4ec 100644 (file)
@@ -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):
index 464619e2b93e5214bd6a7822836a3d66c23fbafe..6ae9d9ec2a62bacc6cbcf43048639976d92a6282 100644 (file)
@@ -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)
index 61ea883f46427fe143991b1030c0b7f224ea977a..e782967c990057fe2e8adcd7ff3deaa41f53201d 100644 (file)
@@ -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)
 
index e4a4d163c0d58c1904a4ea1c2fc8005392dc569c..88a6705812547d8bc1555c188d3b5c34d9aaaf8f 100644 (file)
@@ -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)
 
index 1eadd07c6145483a824e0f95dcab2d5d8d2a1f2b..e6f569562b2105dfa642d1ad1c26517a3d6d4361 100644 (file)
@@ -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)
 
index 9ffeb8b66ca66bce4ba02b8bd9ad369d93d37d93..717287880c26e3ddb748c1dd5a08d065063691c1 100644 (file)
@@ -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
index 372772b4311ba2f91f62aa4f3e97928c838976c5..0f434a30e44b49c7de6266eb1adc59144a284d73 100644 (file)
@@ -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:
index e4b3e526dfdb5e20f075e7a1414d1005abf6f59b..347c7c0ada26148e9af2b378287c1fffd2b943a0 100644 (file)
@@ -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()
 
index 2f6933e257ea07551509568f1bd73465cb20f80f..d5d8108cc1b95e336e0e163959755408b1d5fa82 100644 (file)
@@ -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():
index 79542b2c5b6b7cf16669f3440fae8e92feb7cbac..5de3c5cbffa9c5d05c36c55e71c0db4e7b09427a 100644 (file)
@@ -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
index 36db725808755552d288701ac6b4ab9a165c1322..3de3a7e2db51d72e2732e6a4577a2c3804597b03 100644 (file)
@@ -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<minColor : minColor=nodeColor
@@ -326,7 +326,7 @@ def cleanGroups(mesh):
 
 def getMaxAspectRatio(tmpdir):
   logFile=path.join(tmpdir,'MESHING_OUTPUT')
-  print logFile
+  print(logFile)
   if not path.isfile(logFile): return(-1)
 
   import re
index 60a09a8e753688202add673946f2ae4a71466abc..41351cd47490bc7b80ebbfc9d192654ec82dfebc 100644 (file)
@@ -27,5 +27,5 @@ def ZcracksLct(context):
     if command is not "":
       try:
         subprocess.check_call(command, executable = '/bin/bash', shell = True, bufsize=-1)
-      except Exception, e:
-        print "Error: ",e
+      except Exception as e:
+        print("Error: ",e)
index 449e30b4261f0895b5186130d3b7792e9859c64c..6a6d710251b1aa56c15a6b6b228348351cd0b6d8 100644 (file)
@@ -735,4 +735,4 @@ class Ui_Zui(object):
         self.valIterations.setToolTip(_translate("Zui", "integer (ex: 2)", None))
         self.valIterations.setText(_translate("Zui", "2", None))
 
-import images_rc
+from . import images_rc
index b7d31c405124c5b885b3afe9bd901c8becae5d93..32fd450a38dc6f03830ab6a881a751f6fb45240b 100644 (file)
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 
-from cubeAngle import cubeAngle
+from .cubeAngle import cubeAngle
 
 class cubeAngle2(cubeAngle):
   """
index 8d83ec10370a831217ce857d831f3c5505f4cae2..f5909f29b71cac684fa9a185ceba56b97369d7ae 100644 (file)
@@ -10,7 +10,7 @@ import SALOMEDS
 import SMESH
 import logging
 
-from cylindre import cylindre
+from .cylindre import cylindre
 
 from blocFissure.gmu.triedreBase import triedreBase
 from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
index 35c8598d95b86b039c87df13a490f6656ae7ad03..cf1c8dec829d883878aa86595270d413ca58ea2b 100644 (file)
@@ -13,7 +13,7 @@ import SMESH
 #import NETGENPlugin
 import logging
 
-from ellipse_1 import ellipse_1
+from .ellipse_1 import ellipse_1
 
 from blocFissure.gmu.triedreBase import triedreBase
 from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
index 8f78081904d86a30e3f68a7015ce7b0e7fd26b29..d07d8fca2758b00d9a1eb3ada40473457ff88392 100644 (file)
@@ -13,7 +13,7 @@ import SMESH
 #import NETGENPlugin
 import logging
 
-from eprouvetteDroite import eprouvetteDroite
+from .eprouvetteDroite import eprouvetteDroite
 
 from blocFissure.gmu.triedreBase import triedreBase
 from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
index 8d8524f739cbe398d1dba052417ada5abe4ac43d..ccd70cb30f853545abc1e0b35ae18a329f914d78 100644 (file)
@@ -144,4 +144,4 @@ for i in range(len(problemes)):
       problemes[i].executeProbleme()
     except:
       traceback.print_exc()
-    print "---------------------------------------------------------------------"
+    print("---------------------------------------------------------------------")
index 55a8b090dffb7663ff1d4f72c2692bf4ab872099..3a3c8f81df5b8b57ba501d2c6bc671fdd6ddd894 100644 (file)
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 
-from fissure_Coude  import fissure_Coude
+from .fissure_Coude  import fissure_Coude
 
 class fissure_Coude_4(fissure_Coude):
   """
@@ -46,7 +46,7 @@ class fissure_Coude_4(fissure_Coude):
     orientation : 0° : longitudinale, 90° : circonférentielle, autre : uniquement fissures elliptiques
     externe     : True : fissure face externe, False : fissure face interne
     """
-    print "setParamShapeFissure", self.nomCas
+    print("setParamShapeFissure", self.nomCas)
     self.shapeFissureParams = dict(nomRep        = '.',
                                    nomFicSain    = self.nomCas,
                                    nomFicFissure = 'fissure_' + self.nomCas,
index 5f144fb6f019f95f4e08fb6c333894c0fe3f60fb..f365cead240d4fc3db91b06c0362f0a312876741 100644 (file)
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 
 import os
-import initLog
+from . import initLog
 
 # --- calcul path blocFissure
 
index acce0d0e7942b206b6bf0c500b79759c6ecc1c25..de2dd7da362d519323c3325e2b35d8ad3cf9591d 100644 (file)
@@ -2,9 +2,9 @@
 
 import logging
 
-from geomsmesh import geompy
-from findWireIntermediateVertices import findWireIntermediateVertices
-from projettePointSurCourbe import projettePointSurCourbe
+from .geomsmesh import geompy
+from .findWireIntermediateVertices import findWireIntermediateVertices
+from .projettePointSurCourbe import projettePointSurCourbe
 
 def ajustePointsEdgePipeFissure(edgesPipeFissureExterneC, wirePipeFissureExterne, gptsdisks, idisklim):
   """
index 0e68757775320e1cf0e509c923b1d9e47a62131c..088622dacf4206953d6487486aade9a68d15b82b 100644 (file)
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 
 import logging
-from geomsmesh import geompy
+from .geomsmesh import geompy
 
 # -----------------------------------------------------------------------------
 # --- bloc defaut
index 8a21e72ea077fdb7935e76301869fb714f5405e2..c3f4d5ff29f1fc6e1f07f268c76e4ea24165af64 100644 (file)
@@ -3,8 +3,8 @@
 import logging
 import math
 
-from geomsmesh import geompy
-from geomsmesh import smesh
+from .geomsmesh import geompy
+from .geomsmesh import smesh
   
 def calculePointsAxiauxPipe(edgesFondFiss, edgesIdByOrientation, facesDefaut, 
                             centreFondFiss, wireFondFiss, wirePipeFiss,
index e52b700130229425cdaf76b9f882d846e9425e97..262919590b64881cd480aa1c07f2f39c0b212637 100644 (file)
@@ -1,10 +1,10 @@
 # -*- coding: utf-8 -*-
 
 import os
-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
@@ -15,13 +15,13 @@ import SMESH
 #import NETGENPlugin
 import logging
 
-from fissureGenerique import fissureGenerique
+from .fissureGenerique import fissureGenerique
 
-from initEtude import initEtude
-from triedreBase import triedreBase
-from genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
-from creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from construitFissureGenerale import construitFissureGenerale
+from .initEtude import initEtude
+from .triedreBase import triedreBase
+from .genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
+from .creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
+from .construitFissureGenerale import construitFissureGenerale
 
 O, OX, OY, OZ = triedreBase()
 
@@ -39,13 +39,13 @@ class casStandard(fissureGenerique):
     initEtude()
     self.references = references
     self.dicoParams = dicoParams
-    if self.dicoParams.has_key('nomCas'):
+    if 'nomCas' in self.dicoParams:
       self.nomCas = self.dicoParams['nomCas']
-    elif self.dicoParams.has_key('nomres'):
+    elif 'nomres' in self.dicoParams:
       self.nomCas = os.path.splitext(os.path.split(self.dicoParams['nomres'])[1])[0]
     else:
       self.nomCas = 'casStandard'
-    if self.dicoParams.has_key('reptrav'):
+    if 'reptrav' in self.dicoParams:
       self.reptrav = self.dicoParams['reptrav']
     else:
       self.reptrav = '.'  
@@ -54,15 +54,15 @@ class casStandard(fissureGenerique):
       self.nomCas = self.nomProbleme +"_%d"%(self.numeroCas)
     else:
       self.nomProbleme = self.nomCas
-    if self.dicoParams.has_key('lenSegPipe'):
+    if 'lenSegPipe' in self.dicoParams:
       self.lenSegPipe = self.dicoParams['lenSegPipe']
     else:
       self.lenSegPipe =self.dicoParams['rayonPipe']
-    if self.dicoParams.has_key('step'):
+    if 'step' in self.dicoParams:
       step = self.dicoParams['step']
     else:
       step = -1 # exécuter toutes les Ã©tapes
-    if not self.dicoParams.has_key('aretesVives'):
+    if 'aretesVives' not in self.dicoParams:
       self.dicoParams['aretesVives'] = 0
     if self.numeroCas == 0: # valeur par défaut : exécution immédiate, sinon execution différée dans le cas d'une liste de problèmes
       self.executeProbleme(step)
@@ -86,7 +86,7 @@ class casStandard(fissureGenerique):
     pointIn_x   : optionnel : coordonnée x d'un point dans le solide sain (pour orienter la face - idem avec y,z)
     """
     logging.info("setParamShapeFissure %s", self.nomCas)
-    if self.dicoParams.has_key('pointInterieur'):
+    if 'pointInterieur' in self.dicoParams:
       self.shapeFissureParams = dict(lgInfluence = self.dicoParams['lgInfluence'],
                                      rayonPipe   = self.dicoParams['rayonPipe'],
                                      lenSegPipe  = self.lenSegPipe,
index e1fcf2be1f41771db868a9a469ba0f01e55d324b..ff4abeab06a63d09d786fff05030e10b32d842e8 100644 (file)
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 
 import logging
-from geomsmesh import geompy
+from .geomsmesh import geompy
 
 # -----------------------------------------------------------------------------
 # --- teste si l'opération de partition a produit une modification
@@ -24,7 +24,7 @@ def checkDecoupePartition(shapes, part):
     info = geompy.ShapeInfo(shape)
     logging.debug("shape info %s", info)
     for k in ['VERTEX', 'EDGE', 'FACE', 'SOLID']:
-      if k in orig.keys():
+      if k in list(orig.keys()):
         orig[k] += info[k]
       else:
         orig[k] = info[k]
index 1777ae89c22e29fe39e57ddeb58a1bd043d126f7..12ce354ead279520221fa70af7cd2b13c981d84e 100644 (file)
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 
 import logging
-from geomsmesh import geompy
+from .geomsmesh import geompy
 
 # -----------------------------------------------------------------------------
 # --- subShapes communes Ã  deux listes
@@ -17,7 +17,7 @@ def commonSubShapes(obj, sub1, sub2):
     idsub1[geompy.GetSubShapeID(obj, s)] = s
   for s in sub2:
     idsub = geompy.GetSubShapeID(obj, s)
-    if idsub in idsub1.keys():
+    if idsub in list(idsub1.keys()):
       subList.append(s)
   logging.debug("subList=%s", subList)
   return subList
index 85b3212810753dc77f9a65b56e263d9a6f065933..ac89a0e7d6f0274c3b499bff63a52770c7493155 100644 (file)
@@ -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
 
 def compoundFromList(elements, nom=None):
   """
index 0dcd41f39fa9c9e33d552bcc53ad329a9a72528d..538b92cea4b3881bfe4464b8d530c00727dbc26c 100644 (file)
@@ -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
 import GEOM
-from sortEdges import sortEdges
+from .sortEdges import sortEdges
 
 def construitEdgesRadialesDebouchantes(idisklim, idiskout, gptsdisks, raydisks,
                                        facesPipePeau, edgeRadFacePipePeau, nbsegCercle):
index 8db3cabb04406bcfcda26a20cdefb5dc0535eafd..77cff0f72fb365bb25a88bbb6876c82cbb8ac08e 100644 (file)
@@ -2,12 +2,12 @@
 
 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
@@ -23,36 +23,36 @@ import traceback
 # from produitMixte import produitMixte
 # from findWireEndVertices import findWireEndVertices
 #from findWireIntermediateVertices import findWireIntermediateVertices
-from orderEdgesFromWire import orderEdgesFromWire
+from .orderEdgesFromWire import orderEdgesFromWire
 # from getSubshapeIds import getSubshapeIds
-from putName import putName
+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 .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 restreintFaceFissure import restreintFaceFissure
-from partitionneFissureParPipe import partitionneFissureParPipe
-from construitPartitionsPeauFissure import construitPartitionsPeauFissure
-from compoundFromList import compoundFromList
-from identifieElementsGeometriquesPeau import identifieElementsGeometriquesPeau
-from identifieFacesEdgesFissureExterne import identifieFacesEdgesFissureExterne
-from calculePointsAxiauxPipe import calculePointsAxiauxPipe
-from elimineExtremitesPipe import elimineExtremitesPipe
-from construitEdgesRadialesDebouchantes import construitEdgesRadialesDebouchantes
-from creePointsPipePeau import creePointsPipePeau
-from ajustePointsEdgePipeFissure import ajustePointsEdgePipeFissure
-from construitMaillagePipe import construitMaillagePipe
-from mailleAretesEtJonction import mailleAretesEtJonction
-from mailleFacesFissure import mailleFacesFissure
-from mailleFacesPeau import mailleFacesPeau
-from fissError import fissError
+from .restreintFaceFissure import restreintFaceFissure
+from .partitionneFissureParPipe import partitionneFissureParPipe
+from .construitPartitionsPeauFissure import construitPartitionsPeauFissure
+from .compoundFromList import compoundFromList
+from .identifieElementsGeometriquesPeau import identifieElementsGeometriquesPeau
+from .identifieFacesEdgesFissureExterne import identifieFacesEdgesFissureExterne
+from .calculePointsAxiauxPipe import calculePointsAxiauxPipe
+from .elimineExtremitesPipe import elimineExtremitesPipe
+from .construitEdgesRadialesDebouchantes import construitEdgesRadialesDebouchantes
+from .creePointsPipePeau import creePointsPipePeau
+from .ajustePointsEdgePipeFissure import ajustePointsEdgePipeFissure
+from .construitMaillagePipe import construitMaillagePipe
+from .mailleAretesEtJonction import mailleAretesEtJonction
+from .mailleFacesFissure import mailleFacesFissure
+from .mailleFacesPeau import mailleFacesPeau
+from .fissError import fissError
 
 # -----------------------------------------------------------------------------
 # --- procédure complète fissure générale
@@ -69,7 +69,7 @@ def construitFissureGenerale(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
@@ -82,20 +82,20 @@ def construitFissureGenerale(maillagesSains,
   nbsegCercle       = maillageFissureParams['nbsegCercle']   # nombre de secteur dans un cercle du pipe
   areteFaceFissure  = maillageFissureParams['areteFaceFissure']
   lgAretesVives     = 0
-  if maillageFissureParams.has_key('aretesVives'):
+  if 'aretesVives' in maillageFissureParams:
     lgAretesVives   = maillageFissureParams['aretesVives']
 
   pointIn_x = 0.0
   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:
index e08ba47c343c2046005a8347966984560b5e2fd8..84be0203d9902b7053de6197bfca172baf1bbd06 100644 (file)
@@ -2,8 +2,8 @@
 
 import logging
 
-from geomsmesh import geompy
-from geomsmesh import smesh
+from .geomsmesh import geompy
+from .geomsmesh import smesh
 import SMESH
 
 def construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad):
index 20ba23bf511e5028dcdd62ebf1176a64b07b28a6..d3c46dffdb30fe9741ed7c9788ff100e00446247 100644 (file)
@@ -1,11 +1,11 @@
 # -*- coding: utf-8 -*-
 
 import logging
-from geomsmesh import geompy
-from geomsmesh import geomPublish
-from geomsmesh import geomPublishInFather
-import initLog
-from checkDecoupePartition import checkDecoupePartition
+from .geomsmesh import geompy
+from .geomsmesh import geomPublish
+from .geomsmesh import geomPublishInFather
+from . import initLog
+from .checkDecoupePartition import checkDecoupePartition
 
   # -----------------------------------------------------------------------------
   # --- peau et face de fissure
index 0f3bb71a3109dd481b36e833bc39d1ac63c13ce8..5bf5e91fc0531664e1bbde521bd7b9b3e1e1f2c8 100644 (file)
@@ -2,11 +2,11 @@
 
 import logging
 
-from geomsmesh import geompy
-from geomsmesh import geomPublish
-from geomsmesh import geomPublishInFather
-import initLog
-from projettePointSurCourbe import projettePointSurCourbe
+from .geomsmesh import geompy
+from .geomsmesh import geomPublish
+from .geomsmesh import geomPublishInFather
+from . import initLog
+from .projettePointSurCourbe import projettePointSurCourbe
 
 def creePointsPipePeau(listEdges, idFacesDebouchantes, idFillingFromBout,
                        ptEdgeFond, ptFisExtPi, edCircPeau, gptsdisks, idisklim, nbsegRad):
index d4270fceade65e7ed994c0ec8c142385fdace2a8..1684dd47cfe353b87b2bc3009501761f55f9ac1a 100644 (file)
@@ -1,16 +1,16 @@
 # -*- coding: utf-8 -*-
 
 import logging
-from geomsmesh import smesh
+from .geomsmesh import smesh
 import SMESH
 import SALOMEDS
 
-from creeZoneDefautMaillage import creeZoneDefautMaillage
-from peauInterne import peauInterne
-from quadranglesToShapeNoCorner import quadranglesToShapeNoCorner
-from creeZoneDefautFilling import creeZoneDefautFilling
-from creeZoneDefautGeom import creeZoneDefautGeom
-from getCentreFondFiss import getCentreFondFiss
+from .creeZoneDefautMaillage import creeZoneDefautMaillage
+from .peauInterne import peauInterne
+from .quadranglesToShapeNoCorner import quadranglesToShapeNoCorner
+from .creeZoneDefautFilling import creeZoneDefautFilling
+from .creeZoneDefautGeom import creeZoneDefautGeom
+from .getCentreFondFiss import getCentreFondFiss
 
 # -----------------------------------------------------------------------------
 # ---
@@ -32,10 +32,10 @@ def creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure,
   coordsNoeudsFissure = shapesFissure[3]
 
   isElliptique = False
-  if shapeFissureParams.has_key('elliptique'):
+  if 'elliptique' in shapeFissureParams:
     isElliptique      = shapeFissureParams['elliptique']
   if isElliptique:
-    if shapeFissureParams.has_key('demiGrandAxe'):
+    if 'demiGrandAxe' in shapeFissureParams:
       demiGrandAxe    = shapeFissureParams['demiGrandAxe']
     else:
       demiGrandAxe    = shapeFissureParams['longueur']
@@ -88,7 +88,7 @@ def creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure,
     for face in facesDefaut:
       bordsPartages.append([None,None]) # TODO : traitement des arêtes vives ?
     fillconts = facesDefaut
-    idFilToCont = range(len(facesDefaut))
+    idFilToCont = list(range(len(facesDefaut)))
 
   return [facesDefaut, centresDefaut, normalsDefaut, extrusionsDefaut, dmoyen, bordsPartages, fillconts, idFilToCont,
           maillageSain, internalBoundary, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges,
index c83f2aa0256d68d28709b30e009c08f6923c5d30..bb87fbe975e54806c2e32871f1b2d885c6be7b57 100644 (file)
@@ -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
 
 # -----------------------------------------------------------------------------
 # --- crée zone géométrique défaut a partir d'un filling
index 4c622ebeab9de2b966dbdad91a74c76867c9098b..2418128e2b766f5e6baa8953d7b29b94af034b11 100644 (file)
@@ -1,11 +1,11 @@
 # -*- coding: utf-8 -*-
 
 import logging
-from geomsmesh import geompy
-from geomsmesh import geomPublish
-from geomsmesh import geomPublishInFather
-import initLog
-from prolongeVertices import prolongeVertices
+from .geomsmesh import geompy
+from .geomsmesh import geomPublish
+from .geomsmesh import geomPublishInFather
+from . import initLog
+from .prolongeVertices import prolongeVertices
 
 # -----------------------------------------------------------------------------
 # --- zone de defaut, constructions geometrique avec CAO d'origine
index 5225d9834096cd34b8de5d0204c8aad01e623918..fa6edc8498e37f297c21a2065aa09f813078cdf7 100644 (file)
@@ -1,11 +1,11 @@
 # -*- coding: utf-8 -*-
 
 import logging
-from geomsmesh import geompy
+from .geomsmesh import geompy
 import math
-from distance2 import distance2
+from .distance2 import distance2
 import traceback
-from fissError import fissError
+from .fissError import fissError
 
 # -----------------------------------------------------------------------------
 # --- zone de defaut extraite du maillage
index b9e2e6c1d5dbd790d40b25ca70eb202510434df2..5b29ce9837ffedd341efb395bbff29feae0714e5 100644 (file)
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 
 import logging
-from geomsmesh import geompy
+from .geomsmesh import geompy
 
 # -----------------------------------------------------------------------------
 # --- Ã©liminer les doublons d'une liste de subshapes
@@ -13,12 +13,12 @@ def eliminateDoubles(obj, subshapes):
   idsubs = {}
   for sub in subshapes:
     subid = geompy.GetSubShapeID(obj, sub)
-    if subid in idsubs.keys():
+    if subid in list(idsubs.keys()):
       idsubs[subid].append(sub)
     else:
       idsubs[subid] = [sub]
   shortList = []
-  for k, v in idsubs.iteritems():
+  for k, v in idsubs.items():
     shortList.append(v[0])
   logging.debug("shortList=%s", shortList)
   return shortList
index edfb5ed602532530f48b02246b6a696848255325..36ab658be20a29b1e1748e38af9136fa6987f806 100644 (file)
@@ -2,8 +2,8 @@
 
 import logging
 
-from geomsmesh import geompy
-from whichSideVertex import whichSideVertex
+from .geomsmesh import geompy
+from .whichSideVertex import whichSideVertex
 
 def elimineExtremitesPipe(ptEdgeFond, facesDefaut, centres, gptsdisks, nbsegCercle):
   """
index 3940d57ca992942c5281ecce3db0e2bcf1913cc4..09ffa807bdf73d5cb0034576ce37ef068d5a4751 100644 (file)
@@ -2,8 +2,8 @@
 
 import logging
 import math
-from geomsmesh import geompy
-from triedreBase import triedreBase
+from .geomsmesh import geompy
+from .triedreBase import triedreBase
 O, OX, OY, OZ = triedreBase()
 
 # -----------------------------------------------------------------------------
index ec95646de137c8a55be5bf026155ff012b05c30a..e73eca91f90bd021583515a076a4e9fb72b19375 100644 (file)
@@ -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
 
-from whichSide import whichSide
+from .whichSide import whichSide
 
 # -----------------------------------------------------------------------------
 # --- renvoie l'extraction des shapes d'un objet selon leur position par rapport Ã  la face.
index 0c6457ad302b469e9c7dcb004221d51e6ce192a9..239fe9d2e48abeefccd24b80115f9c7098012838 100644 (file)
@@ -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
 
-from whichSideMulti import whichSideMulti
+from .whichSideMulti import whichSideMulti
 
 # -----------------------------------------------------------------------------
 # --- renvoie l'extraction des shapes d'un objet selon leur position par rapport Ã  la face.
index 71df8eeb03e5e35a82384174815f73fdf8de1429..a624947368052994e212089f76b77cf35e75b567 100644 (file)
@@ -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
 
 # -----------------------------------------------------------------------------
 # --- TORE
index f1b8dbe4000877f8ece6cd7734768bfeea4d8f95..3e51289c140c99a9598dee2600524f63a3207920 100644 (file)
@@ -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
 
 # -----------------------------------------------------------------------------
 # --- faces fissure dans et hors tore, et edges face hors tore
index 529216958d245295f38a624949576f03d6870bb8..b48eb8e7f2adbafa9a3fa2c87124aeac36059f02 100644 (file)
@@ -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
 
 # -----------------------------------------------------------------------------
 # --- identification des faces tore et fissure dans le solide hors tore du bloc partitionné
index 6d3434ba1d54360f5425f5e3570df47797157fd5..9826ab9a9206a85cd91dbe589cf8ad02576b85ad 100644 (file)
@@ -1,12 +1,12 @@
 # -*- coding: utf-8 -*-
 
 import logging
-from geomsmesh import geompy
-from geomsmesh import geomPublish
-from geomsmesh import geomPublishInFather
-import initLog
-from extractionOrientee import extractionOrientee
-from getSubshapeIds import getSubshapeIds
+from .geomsmesh import geompy
+from .geomsmesh import geomPublish
+from .geomsmesh import geomPublishInFather
+from . import initLog
+from .extractionOrientee import extractionOrientee
+from .getSubshapeIds import getSubshapeIds
 
 # -----------------------------------------------------------------------------
 # --- TORE
index 22f4ff014f105200a3ebfc6b4b55cdcd64c4a124..be9b34736253b6ec52593cc60ac0a8328fc978ec 100644 (file)
@@ -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
 
 # -----------------------------------------------------------------------------
 # --- trouver les vertices extremites d'un wire
@@ -42,7 +42,7 @@ def findWireEndVertices(aWire, getNormals=False):
         normals += [n1, n0]
   for i, sub in enumerate(vertices):
     subid = geompy.GetSubShapeID(aWire, sub)
-    if subid in idsubs.keys():
+    if subid in list(idsubs.keys()):
       idsubs[subid].append(sub)
     else:
       idsubs[subid] = [sub]
@@ -53,7 +53,7 @@ def findWireEndVertices(aWire, getNormals=False):
         name='norm%d'%i
         geomPublishInFather(initLog.debug, aWire, normals[i], name)
   logging.debug("idsubs: %s", idsubs)
-  for k, v in idsubs.iteritems():
+  for k, v in idsubs.items():
     if len(v) == 1:
       shortList.append(v[0])
       if getNormals:
index 63c884458002affa026af13e244052e2b6414c0a..42e5ec9fe238973769b5ffac9457f62613db1d9c 100644 (file)
@@ -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
 
 # -----------------------------------------------------------------------------
 # --- trouver les vertices intermediaires d'un wire
@@ -39,7 +39,7 @@ def findWireIntermediateVertices(aWire, getNormals=False):
         normals += [n1, n0]
   for i, sub in enumerate(vertices):
     subid = geompy.GetSubShapeID(aWire, sub)
-    if subid in idsubs.keys():
+    if subid in list(idsubs.keys()):
       idsubs[subid].append(sub)
     else:
       idsubs[subid] = [sub]
@@ -49,7 +49,7 @@ def findWireIntermediateVertices(aWire, getNormals=False):
         idnorm[subid] = normals[i]
         name='norm%d'%i
         geomPublishInFather(initLog.debug, aWire, normals[i], name)
-  for k, v in idsubs.iteritems():
+  for k, v in idsubs.items():
     if len(v) > 1:
       shortList.append(v[0])
       if getNormals:
index 22432356795be3b685b24b92b10135e0ca3947b8..c2fa0e36ffa86d2eca89e00335bdb6a51e01e141 100644 (file)
@@ -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']
 
 
index 703c02447f51e116ff9adc0b5e389a711b00d759..b599be6d15348ade02e46db3eb414a273b01464a 100644 (file)
@@ -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
index 62be40c7755176b49577422b1d34102470b0887b..6374be9fc9daa63ee1ba4c1b6ce8117f9742c659 100644 (file)
@@ -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
index 08e24748c7da511aee18c714b80c500b7d8cab1e..8e296f2cf4e0c5d4c21cb6022a4aa045395fb0d3 100644 (file)
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 
 import logging
-from geomsmesh import smesh
+from .geomsmesh import smesh
 from salome.smesh import smeshBuilder
 
 # -----------------------------------------------------------------------------
index 4c61d1b924f821d53c152c7c70b09013a3203fc7..631a3e283024f5088926161419806786ce5ff3ba 100644 (file)
@@ -2,7 +2,7 @@
 
 import logging
 #logging.info('start')
-import initLog
+from . import initLog
 
 import salome
 salome.salome_init()
index 52f1f3bd9c5902998e9054abfbfcc5be654c8126..34d3e09ca06710c3828aa2e8cb48291748de359a 100644 (file)
@@ -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
index 453b6b90489e4b48fe9f53009d4c9aabd70f7c1f..cf06fb33cb15450398f9137c27c44d8796a083d3 100644 (file)
@@ -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)      
index 7783596466b6d65723da3852e4dee3af4f5faf77..15383c9cd33334a097fe9599ea6ad601346b7fac 100644 (file)
@@ -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
index 70595896ef34d9461632b806c2840defafa5b0ba..53b2cc5b91ff500a33a55fe899665d85b9e46c11 100644 (file)
@@ -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):
index fb03f94b713a0137f659681dd06c8ac2268778c1..4eb25795acf34524a05082611a0f6d9ad0c87a43 100644 (file)
@@ -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,
index fcad8c51966f68a9ce7a21b6a8068f8c29c2e8b5..8add85194d18cc515919d7a3ecb6f75dfae95fd4 100644 (file)
@@ -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,
index c60682c513b17832f08b1f6fc5340602f08937bf..2fdd9251aafbe728c53cb9e02c01c51e82079527 100644 (file)
@@ -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,
index 12efab46ce6b21c0f6c87a4d537673ea050e95e8..170ad723bba19df90d866d641672ae0123bd6daa 100644 (file)
@@ -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):
   """
index a8917ad78b26061c8474790f3b7b31d5fb3dd731..ab009b7c8ab0bde4a00bd2d4ad7b4807f7f1da15 100644 (file)
@@ -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,
index 1e73886b63cf8a664e34a9849b46356d96d7c10a..c59b54d3ad9391629bf26b9efc0142ee01cc03e1 100644 (file)
@@ -7,4 +7,4 @@ def initEtude():
   """
   creation nouvelle etude salome
   """
-  import geomsmesh
+  from . import geomsmesh
index de8fbeb17a232d9fd23c5279562df713f1909d7e..07ba999102089da16137b6536f2c89b09dabb36a 100644 (file)
@@ -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
index a8619bdda38b8b09cce60634d2a34dacd5270e8b..68195f8a4f4c99273f623950b444d19f3699880e 100644 (file)
@@ -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:
index 347fb401c678a5b95caead419dcb7b7ae6d16e30..a0671a18819d727d53dcd7ad766aac0723ee6f6e 100644 (file)
@@ -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
index fbdd5cf97af60f8d26771f41d211e12f26410856..803e37a6c422c9ed13dadfda58a281d717c607b2 100644 (file)
@@ -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):
     
index e8f9d81974613477e1edd26e81fefc5de62e63ea..6c249374059d8edd607f8118d7cf7d642595ce94 100644 (file)
@@ -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):
   """
index 90bd8701271531570522c4ecf221a1032cb5fca9..99101ecaf5b3d62c0e9819c08462e1d2ca50f353 100644 (file)
@@ -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):
index 41a72e9ab0897bf1215ce652cd1d2164658c0d44..8f9abab99d5a8d9d45607bc433d6d89dd2220d45 100644 (file)
@@ -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,
index c868ed1391007741419dbb6a5684a9c445199620..4b13379529bf60532519715ee7953f24de600b69 100644 (file)
@@ -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
index 0a092e26cd12f1e8fbff417cf6b8e752d55d4c89..36d95f2fdd0ca2a5b86ecf5c2fa2f7b310bb7c3b 100644 (file)
@@ -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)
index be3a3481dfb73d116d3461b60dbbe8f64b93f4d9..7a34e935f90d66ecb547bc76760b84cc2cfc7ea2 100644 (file)
@@ -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
index e7ce51a11b479791a38d63361c0941d2529ef9ee..f3a50635db1c6cdbd05b82f099b5b99472d469aa 100644 (file)
@@ -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
index 32ae8b3f091073bb1181c89908800b23c0c32deb..bf5a4c10994257009a57bfdd4cc48fcb9640f9bb 100644 (file)
@@ -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):
   """
index 6e6915966ddba61a814015f0b902b0aa02cd29c9..4e4004e404549110ad3b99a338121a6e991e721c 100644 (file)
@@ -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:
index 509a75889fd1559e917730e382e01256ec05870d..96c7cce7fd823ab60ad6d23daeafa6cc82c389ca 100644 (file)
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 
 import logging
-from geomsmesh import geompy
+from .geomsmesh import geompy
 
 # -----------------------------------------------------------------------------
 # --- calcul de produit mixte pour orientation
index fa43d39262aa5ef77b5fd67be3bb506e79bc53a1..47c83612f48eae7c6963c305c4606ce6d6fdcb9d 100644 (file)
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 
-from geomsmesh import geompy
+from .geomsmesh import geompy
 import logging
 import math
 
index e6e6f038acc4425f9410ee8fceb50a20dae771ab..63e465f1b21c55535fcb187b200d2a39b3c528a4 100644 (file)
@@ -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
index 52b3991b4540059b9314027dc2f47b9deec52f28..75cbb518add48e103705067f37abc9dd02d464e0 100644 (file)
@@ -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]
index 23200e1f738b06dc72086bb037497b9fbc186bb3..ab96494a9e08d397887824a1a11b5a26efbca135 100644 (file)
@@ -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
index b8d4cbfa3090c8dc1245ed3fe55df30482c1f389..35b8888cc63b8caa214ae90af72fe6b34e2da3b1 100644 (file)
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 
-from geomsmesh import smesh
+from .geomsmesh import smesh
 
 # -----------------------------------------------------------------------------
 # --- nommage des objets mesh (algorithme, hypothèse, subMesh)
index b9facb652fe7dcd83eea7aeac10d572d3a46219f..1ffd6ba7eaa9b1c329148c841b9f26ea622505f6 100644 (file)
@@ -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)
index d3c52ab59cf4e2129c01cea7feb6ad46144012bd..0ef3227e0c8768dfc1deab776150207a3b1d199f 100644 (file)
@@ -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)
index 66963300fddc3cbd2f778a39ebaae1c2590d32be..bc77c59f032d98ba7b95b1880182981c2e880330 100644 (file)
@@ -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
index 7acbe4c77c6b7341575c5b5d9fed99933301808c..6238a409668cbd9fccae27956e70f45b5d473e55 100644 (file)
@@ -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
index b300ae19f9086e10cfb53f8c7b26b985874bfd82..cdda80f8533415932be2b6976ef0f50858fe96d1 100644 (file)
@@ -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):
   """
index 05e3dcbe10db1d2821891018d22779c132854a48..fc2d2a98e9ce48157abcc107fd2e7e98b198dfb0 100644 (file)
@@ -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()
 
 # -----------------------------------------------------------------------------
index f9e36ac195bd91a41f3f39357bb8473d85e4a05c..0c54646b06c4be7804f831edb0ea7f4bbd52563d 100644 (file)
@@ -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)
index a8a98a1a13236dd8447b72cf772afd1666ccc601..9c975c41bb55bc8978cd4b675a6a104d95c6040a 100644 (file)
@@ -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)
index 6d633f7d89c4183dc0cde4a9bc1ed204d12544a2..576338bd5e6d40c2cd4c1554c1815741a45a9164 100644 (file)
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 
 import logging
-from geomsmesh import geompy
+from .geomsmesh import geompy
 
 # -----------------------------------------------------------------------------
 # --- tri par longueur d'edges
index 0fe962e6da543563a890ed0c3e7610abcad234c9..f45cd61052b63870e8e8d2b6b9abe69cea442e65 100644 (file)
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 
 import logging
-from geomsmesh import geompy
+from .geomsmesh import geompy
 
 # -----------------------------------------------------------------------------
 # --- tri par surface de faces
index f61dc28381106d83f652fc5e6edcc64c454c0ec4..a72f83c642dbd016a609c5839ea1df15b8edef9e 100644 (file)
@@ -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
index c51bca539ad1c41cf06fba8bec984799bc43a453..4905ccaeb71302c50ac3696f437812115f6ad5db 100644 (file)
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 
 import logging
-from geomsmesh import geompy
+from .geomsmesh import geompy
 
 # -----------------------------------------------------------------------------
 # --- tri par volume de solides
index 3f819d7f4f58b80ad5fb76cd95f745da7c4577bc..7abb8b564a0775e3e6464cc0513ca8e164bafd5d 100644 (file)
@@ -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
index 12464f65d3b35abb45794a875c9f1928f4d9327f..742bd0eddca10ef5c58948cb32e5ba31af2a0d32 100644 (file)
@@ -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()
 
index 8113cd077eecff59ca66b848cbc0149ccb48c1bf..3188601c8052353dc1b5edd0cd94b0520812d97a 100644 (file)
@@ -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
 
index 49205e6887c870d76862ae60390e121fae4ea2e9..6b652465036f27a891af11f926be8951f808d88a 100644 (file)
@@ -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):
   """
index d31fad2dd652f993070df5a4282aa69016506936..ab36a27c35b9ecc5ce5fedf8db0215c611bcf403 100644 (file)
@@ -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)
index 248e6cf2cca0c59a71f7e58df9f199589797f6d7..f33ecfcdd702a4a03d4768541c6d1296a40d3ed4 100644 (file)
@@ -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)
index 13a29c4fa1c406611763e18d13117fcf18efc8e7..713aae5ddcf1417cfe2b88127673783fd3854e84 100644 (file)
@@ -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)
index 1167c55fac7106acb7049032c6f45f3e3bfbb04c..54a50407a6e46d695df08029091fd6368bd4cf9a 100644 (file)
@@ -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'],
index 30936d50cbabb3a66f838cac69da3373cd34aa4f..622f82ee6326eb74dff4f2105d63297e16a9412a 100644 (file)
@@ -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
   
index 48d962653cb613e999132e5d74814ac52b4a230e..832c06c37f304d730b1790bb693d3f59c29b1dfe 100644 (file)
@@ -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 += +"<br>" +'-'*60 +"<br>"
 #           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
 
index 0031b907da0ef0eceaec8e87daeae25fc4ba45c0..effd68f7d6c96cb9b2279d536367a744bf882261 100644 (file)
@@ -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())
index 9580a51e40ceb730301171bc0b460e038c2b5f72..7593ccf50f6310b1d900f9da4f2b1084e8d7b0c3 100644 (file)
@@ -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
index 138b237ac3293e4141556de426d8a154558588df..47abc561aaac76ccbefaf9b7db673883ac61b316 100644 (file)
@@ -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__":
index 1d7f246ab7212b916b16032731e15e7257573df5..f576bf317064666452c049c6db361f941b55dddb 100644 (file)
@@ -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
index e9f8fa12e7fc88da76f641f2cca3515b21186974..99ee5bc967bf0ddce86f65d9decfd5a7bf56e864 100644 (file)
@@ -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())
index 131e7c3157aad3adadf26228826a6f0f60a594a9..393840239d54ca1bcbdeb9df9881f6bd41ff8021 100644 (file)
@@ -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)
index 65566eb4eb461ad04ff69e79980abbd7e19ae68a..39167defcc344d63d7c3e4d5dce0c875cb7e3202 100644 (file)
@@ -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")