From: rnv Date: Thu, 22 Jun 2017 15:09:29 +0000 (+0300) Subject: Merge Python 3 porting. X-Git-Tag: V9_0_0~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bd7477efc255f965c479d88d1be1ee3dbf4aa760;p=modules%2Fsmesh.git Merge Python 3 porting. --- bd7477efc255f965c479d88d1be1ee3dbf4aa760 diff --cc doc/salome/examples/grouping_elements_ex03.py index 560f6a3fb,928b49563..19ce71311 --- a/doc/salome/examples/grouping_elements_ex03.py +++ b/doc/salome/examples/grouping_elements_ex03.py @@@ -44,6 -44,6 +44,6 @@@ print("With a new filter, group on filt # 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) +salome.sg.updateObjBrowser() diff --cc doc/salome/examples/grouping_elements_ex04.py index a9b03ed0b,a7b26c4e5..e0e58acc9 --- a/doc/salome/examples/grouping_elements_ex04.py +++ b/doc/salome/examples/grouping_elements_ex04.py @@@ -36,10 -36,10 +36,10 @@@ print("Criterion: 35 < Area < 40, Nb = 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) +salome.sg.updateObjBrowser() diff --cc doc/salome/examples/grouping_elements_ex05.py index 16c1f14ca,23e1abf87..96aa7fa56 --- a/doc/salome/examples/grouping_elements_ex05.py +++ b/doc/salome/examples/grouping_elements_ex05.py @@@ -50,6 -50,6 +50,6 @@@ aGroup4.SetColor( SALOMEDS.Color(1.,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) +salome.sg.updateObjBrowser() diff --cc doc/salome/examples/grouping_elements_ex06.py index 2fc70fe6e,a5b2c3ffb..9423cf7d4 --- a/doc/salome/examples/grouping_elements_ex06.py +++ b/doc/salome/examples/grouping_elements_ex06.py @@@ -31,7 -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) +salome.sg.updateObjBrowser() diff --cc doc/salome/examples/grouping_elements_ex07.py index e0c7ab199,eb288de24..800e8e80a --- a/doc/salome/examples/grouping_elements_ex07.py +++ b/doc/salome/examples/grouping_elements_ex07.py @@@ -29,7 -29,7 +29,7 @@@ aGroupTool = mesh.MakeGroupByIds("Area # 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) +salome.sg.updateObjBrowser() diff --cc doc/salome/examples/modifying_meshes_ex16.py index 280527223,8b958f95b..2ecc4ed07 --- a/doc/salome/examples/modifying_meshes_ex16.py +++ b/doc/salome/examples/modifying_meshes_ex16.py @@@ -46,9 -46,9 +46,9 @@@ ff[4] = mesh.AddFace([bb[2], bb[3], tt[ 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) +salome.sg.updateObjBrowser() diff --cc doc/salome/examples/modifying_meshes_ex17.py index 939278143,7cd708158..1fe0c466b --- a/doc/salome/examples/modifying_meshes_ex17.py +++ b/doc/salome/examples/modifying_meshes_ex17.py @@@ -46,9 -46,9 +46,9 @@@ ff[4] = mesh.AddFace([bb[2], bb[3], tt[ 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) +salome.sg.updateObjBrowser() diff --cc doc/salome/examples/modifying_meshes_ex18.py index d6256cdc1,b44dde891..fd21b376e --- a/doc/salome/examples/modifying_meshes_ex18.py +++ b/doc/salome/examples/modifying_meshes_ex18.py @@@ -46,9 -46,9 +46,9 @@@ ff[4] = mesh.AddFace([bb[2], bb[3], tt[ 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) +salome.sg.updateObjBrowser() diff --cc doc/salome/examples/modifying_meshes_ex21.py index a6d108bc2,e9afc8e48..a2b92a9f9 --- a/doc/salome/examples/modifying_meshes_ex21.py +++ b/doc/salome/examples/modifying_meshes_ex21.py @@@ -28,8 -28,8 +28,8 @@@ GroupSmooth = mesh.GroupOnGeom(face, "G # 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) +salome.sg.updateObjBrowser() diff --cc doc/salome/examples/quality_controls_ex03.py index 6ac5410e7,089341109..fca52fddf --- a/doc/salome/examples/quality_controls_ex03.py +++ b/doc/salome/examples/quality_controls_ex03.py @@@ -33,17 -33,17 +33,17 @@@ aFilter = smesh.GetFilter(SMESH.EDGE, S 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) +salome.sg.updateObjBrowser() diff --cc doc/salome/examples/quality_controls_ex05.py index bf6d7fa4c,7d60b91ac..1ec552f75 --- a/doc/salome/examples/quality_controls_ex05.py +++ b/doc/salome/examples/quality_controls_ex05.py @@@ -42,13 -42,13 +42,13 @@@ aGroup = mesh.CreateEmptyGroup(SMESH.NO 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) +salome.sg.updateObjBrowser() diff --cc doc/salome/examples/quality_controls_ex11.py index dffd85ca2,d108ef6d2..7c00278dc --- a/doc/salome/examples/quality_controls_ex11.py +++ b/doc/salome/examples/quality_controls_ex11.py @@@ -34,17 -34,17 +34,17 @@@ aFilter = smesh.GetFilter(SMESH.FACE, S 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) +salome.sg.updateObjBrowser() diff --cc doc/salome/examples/quality_controls_ex12.py index 77027c2f5,8e81e5130..adedda57d --- a/doc/salome/examples/quality_controls_ex12.py +++ b/doc/salome/examples/quality_controls_ex12.py @@@ -34,17 -34,17 +34,17 @@@ aFilter = smesh.GetFilter(SMESH.FACE, S 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) +salome.sg.updateObjBrowser() diff --cc doc/salome/examples/quality_controls_ex13.py index 82070ac3b,f623081e5..5cee2a8dd --- a/doc/salome/examples/quality_controls_ex13.py +++ b/doc/salome/examples/quality_controls_ex13.py @@@ -15,17 -15,17 +15,17 @@@ aFilter = smesh.GetFilter(SMESH.FACE, S 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) +salome.sg.updateObjBrowser() diff --cc doc/salome/examples/quality_controls_ex14.py index eb6f844ef,7ed0afcfe..ab939bae8 --- a/doc/salome/examples/quality_controls_ex14.py +++ b/doc/salome/examples/quality_controls_ex14.py @@@ -15,17 -15,17 +15,17 @@@ aFilter = smesh.GetFilter(SMESH.FACE, S 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) +salome.sg.updateObjBrowser() diff --cc doc/salome/examples/quality_controls_ex15.py index 4bc47d2e1,7c2029a1e..d7cb29071 --- a/doc/salome/examples/quality_controls_ex15.py +++ b/doc/salome/examples/quality_controls_ex15.py @@@ -15,17 -15,17 +15,17 @@@ aFilter = smesh.GetFilter(SMESH.FACE, S 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) +salome.sg.updateObjBrowser() diff --cc doc/salome/examples/quality_controls_ex18.py index 431557e6e,514653527..9f6f7a3f3 --- a/doc/salome/examples/quality_controls_ex18.py +++ b/doc/salome/examples/quality_controls_ex18.py @@@ -15,17 -15,17 +15,17 @@@ aFilter = smesh.GetFilter(SMESH.FACE, S 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) +salome.sg.updateObjBrowser() diff --cc doc/salome/examples/quality_controls_ex19.py index 19b680f29,5713800c8..62ef71030 --- a/doc/salome/examples/quality_controls_ex19.py +++ b/doc/salome/examples/quality_controls_ex19.py @@@ -15,17 -15,17 +15,17 @@@ aFilter = smesh.GetFilter(SMESH.FACE, S 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) +salome.sg.updateObjBrowser() diff --cc doc/salome/examples/quality_controls_ex22.py index 15335f979,aff8d25d3..131091f8c --- a/doc/salome/examples/quality_controls_ex22.py +++ b/doc/salome/examples/quality_controls_ex22.py @@@ -15,17 -15,17 +15,17 @@@ aFilter = smesh.GetFilter(SMESH.FACE, S 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) +salome.sg.updateObjBrowser() diff --cc doc/salome/examples/transforming_meshes_ex06.py index 36cf38544,bd1a36f61..1d973dadb --- a/doc/salome/examples/transforming_meshes_ex06.py +++ b/doc/salome/examples/transforming_meshes_ex06.py @@@ -71,10 -71,10 +71,10 @@@ 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) +salome.sg.updateObjBrowser() diff --cc src/SMESH_I/SMESH_Gen_i.cxx index 072d11800,7a3404d24..a31b802b2 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@@ -3018,7 -3033,7 +3018,7 @@@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( S TCollection_AsciiString aStudyName( "" ); if ( isMultiFile ) - aStudyName = ( (char*)SALOMEDS_Tool::GetNameFromPath( aStudy->URL() ).c_str() ); - aStudyName = ( (char*)SALOMEDS_Tool::GetNameFromPath( Kernel_Utils::encode(myCurrentStudy->URL()) ).c_str() ); ++ aStudyName = ( (char*)SALOMEDS_Tool::GetNameFromPath( Kernel_Utils::encode(aStudy->URL()) ).c_str() ); // Set names of temporary files TCollection_AsciiString filename = @@@ -4011,13 -4033,13 +4011,13 @@@ bool SMESH_Gen_i::Load( SALOMEDS::SComp ( char* )( isMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir().c_str() ); // Convert the stream into sequence of files to process - SALOMEDS::ListOfFileNames_var aFileSeq = SALOMEDS_Tool::PutStreamToFiles( theStream, - tmpDir.ToCString(), - isMultiFile ); + SALOMEDS_Tool::ListOfFiles aFileSeq = SALOMEDS_Tool::PutStreamToFiles( theStream, + tmpDir.ToCString(), + isMultiFile ); TCollection_AsciiString aStudyName( "" ); if ( isMultiFile ) { - CORBA::String_var url = aStudy->URL(); - aStudyName = (char*)SALOMEDS_Tool::GetNameFromPath( url.in() ).c_str(); - CORBA::WString_var url = myCurrentStudy->URL(); ++ CORBA::WString_var url = aStudy->URL(); + aStudyName = (char*)SALOMEDS_Tool::GetNameFromPath( Kernel_Utils::encode(url.in()) ).c_str(); } // Set names of temporary files TCollection_AsciiString filename = tmpDir + aStudyName + "_SMESH.hdf"; diff --cc src/SMESH_SWIG/PAL_MESH_041_mesh.py index 86dc13003,5cb4dfed0..2bb4d9ecf --- a/src/SMESH_SWIG/PAL_MESH_041_mesh.py +++ b/src/SMESH_SWIG/PAL_MESH_041_mesh.py @@@ -98,10 -98,10 +98,10 @@@ 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) +salome.sg.updateObjBrowser() diff --cc src/SMESH_SWIG/SMESH_GroupFromGeom2.py index 324ca1d10,0d9be36d3..6d21e8fb8 --- a/src/SMESH_SWIG/SMESH_GroupFromGeom2.py +++ b/src/SMESH_SWIG/SMESH_GroupFromGeom2.py @@@ -53,25 -53,25 +53,25 @@@ geompy.addToStudy(aGeomGroup2, "Group o aSmeshGroup1 = mesh.GroupOnGeom(aGeomGroup1, "SMESHGroup1", SMESH.FACE) aSmeshGroup2 = mesh.GroupOnGeom(aGeomGroup2, "SMESHGroup2", SMESH.EDGE) - print "Create aGroupOnShell - a group linked to a shell" + print("Create aGroupOnShell - a group linked to a shell") aGroupOnShell = mesh.GroupOnGeom(shell, "GroupOnShell", SMESH.EDGE) - print "aGroupOnShell type =", aGroupOnShell.GetType() - print "aGroupOnShell size =", aGroupOnShell.Size() - print "aGroupOnShell ids :", aGroupOnShell.GetListOfID() + print("aGroupOnShell type =", aGroupOnShell.GetType()) + print("aGroupOnShell size =", aGroupOnShell.Size()) + print("aGroupOnShell ids :", aGroupOnShell.GetListOfID()) - print " " + print(" ") - print "Modify hypothesis: 100 -> 50" + print("Modify hypothesis: 100 -> 50") hypLen1.SetLength(50) - print "Contents of aGroupOnShell changes:" - print "aGroupOnShell size =", aGroupOnShell.Size() - print "aGroupOnShell ids :", aGroupOnShell.GetListOfID() + print("Contents of aGroupOnShell changes:") + print("aGroupOnShell size =", aGroupOnShell.Size()) + print("aGroupOnShell ids :", aGroupOnShell.GetListOfID()) - print " " + print(" ") - print "Re-compute mesh, contents of aGroupOnShell changes again:" + print("Re-compute mesh, contents of aGroupOnShell changes again:") mesh.Compute() - print "aGroupOnShell size =", aGroupOnShell.Size() - print "aGroupOnShell ids :", aGroupOnShell.GetListOfID() + print("aGroupOnShell size =", aGroupOnShell.Size()) + print("aGroupOnShell ids :", aGroupOnShell.GetListOfID()) -salome.sg.updateObjBrowser(True) +salome.sg.updateObjBrowser() diff --cc src/SMESH_SWIG/SMESH_Nut.py index 293a62390,323304674..77055838d --- a/src/SMESH_SWIG/SMESH_Nut.py +++ b/src/SMESH_SWIG/SMESH_Nut.py @@@ -146,16 -146,16 +146,16 @@@ 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) +salome.sg.updateObjBrowser() diff --cc src/SMESH_SWIG/SMESH_Partition1_tetra.py index 0b6667fe4,0b6b98245..c12165c0d --- a/src/SMESH_SWIG/SMESH_Partition1_tetra.py +++ b/src/SMESH_SWIG/SMESH_Partition1_tetra.py @@@ -173,15 -173,15 +173,15 @@@ 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) +salome.sg.updateObjBrowser() diff --cc src/SMESH_SWIG/SMESH_box2_tetra.py index 6d137e9d8,f8b123616..bab8d4abb --- a/src/SMESH_SWIG/SMESH_box2_tetra.py +++ b/src/SMESH_SWIG/SMESH_box2_tetra.py @@@ -127,15 -127,15 +127,15 @@@ 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) +salome.sg.updateObjBrowser() diff --cc src/SMESH_SWIG/SMESH_box3_tetra.py index 2fa39e644,55e047583..5f5213438 --- a/src/SMESH_SWIG/SMESH_box3_tetra.py +++ b/src/SMESH_SWIG/SMESH_box3_tetra.py @@@ -137,15 -137,15 +137,15 @@@ 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) +salome.sg.updateObjBrowser() diff --cc src/SMESH_SWIG/SMESH_box_tetra.py index 61538ebf8,d2e6c8e71..f4b257c87 --- a/src/SMESH_SWIG/SMESH_box_tetra.py +++ b/src/SMESH_SWIG/SMESH_box_tetra.py @@@ -96,15 -96,15 +96,15 @@@ 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) +salome.sg.updateObjBrowser() diff --cc src/SMESH_SWIG/SMESH_demo_hexa2_upd.py index 9629def07,604f21714..68558d27c --- a/src/SMESH_SWIG/SMESH_demo_hexa2_upd.py +++ b/src/SMESH_SWIG/SMESH_demo_hexa2_upd.py @@@ -176,9 -176,9 +176,9 @@@ for i in range(8) smesh.SetName(algo.GetSubMesh(), "SubMeshEdgeZ_"+str(i+1)) -salome.sg.updateObjBrowser(True) +salome.sg.updateObjBrowser() - print "-------------------------- compute the mesh of the volume" + print("-------------------------- compute the mesh of the volume") ret=mesh.Compute() @@@ -187,14 -187,14 +187,14 @@@ 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) +salome.sg.updateObjBrowser() diff --cc src/SMESH_SWIG/SMESH_fixation_hexa.py index 0f464cf42,32eb83eb5..076e13bf2 --- a/src/SMESH_SWIG/SMESH_fixation_hexa.py +++ b/src/SMESH_SWIG/SMESH_fixation_hexa.py @@@ -42,15 -42,15 +42,15 @@@ subShellList = geompy.SubShapeAll(comps 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) +smesh.UpdateStudy() # ---- init a Mesh with the compshell shape_mesh = salome.IDToObject( idcomp ) @@@ -88,15 -88,15 +88,15 @@@ 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) +salome.sg.updateObjBrowser() diff --cc src/SMESH_SWIG/SMESH_fixation_netgen.py index fbcbc1a18,c8c00f67f..ec532d57f --- a/src/SMESH_SWIG/SMESH_fixation_netgen.py +++ b/src/SMESH_SWIG/SMESH_fixation_netgen.py @@@ -42,17 -42,17 +42,17 @@@ subShellList = geompy.SubShapeAll(comps 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) +smesh.UpdateStudy() - 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 +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) +salome.sg.updateObjBrowser() diff --cc src/SMESH_SWIG/SMESH_fixation_tetra.py index dd661d969,d01119d5a..ecbd29883 --- a/src/SMESH_SWIG/SMESH_fixation_tetra.py +++ b/src/SMESH_SWIG/SMESH_fixation_tetra.py @@@ -42,15 -42,15 +42,15 @@@ subShellList = geompy.SubShapeAll(comps 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) +smesh.UpdateStudy() # ---- init a Mesh with the compshell @@@ -111,16 -111,16 +111,16 @@@ 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) +salome.sg.updateObjBrowser() diff --cc src/SMESH_SWIG/SMESH_flight_skin.py index 122ebabfd,144a9fab9..05d1f94f9 --- a/src/SMESH_SWIG/SMESH_flight_skin.py +++ b/src/SMESH_SWIG/SMESH_flight_skin.py @@@ -97,14 -97,14 +97,14 @@@ 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) +salome.sg.updateObjBrowser() diff --cc src/SMESH_SWIG/SMESH_freebord.py index a45499144,6422701ab..709e27dad --- a/src/SMESH_SWIG/SMESH_freebord.py +++ b/src/SMESH_SWIG/SMESH_freebord.py @@@ -71,8 -71,8 +71,8 @@@ aGroup = mesh.MakeGroupByCriterion("Fre 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) +salome.sg.updateObjBrowser() diff --cc src/SMESH_SWIG/SMESH_hexaedre.py index 6a215780a,0373a57f4..5dd1d8f9e --- a/src/SMESH_SWIG/SMESH_hexaedre.py +++ b/src/SMESH_SWIG/SMESH_hexaedre.py @@@ -62,8 -62,8 +62,8 @@@ salome.sg.updateObjBrowser( # ----------------------------------------------------------------------------- - print "-------------------------- mesh" + print("-------------------------- mesh") -smesh.SetCurrentStudy(salome.myStudy) +smesh.UpdateStudy() # ---- define a mesh on the geom shape 'blob' mesh=smesh.Mesh(blob, "MeshBlob") @@@ -85,17 -85,17 +85,17 @@@ for edges in edgeGroups: # loop on grou 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) +salome.sg.updateObjBrowser() diff --cc src/SMESH_SWIG/SMESH_mechanic.py index e2ba044c4,f74a37208..d09e9e78b --- a/src/SMESH_SWIG/SMESH_mechanic.py +++ b/src/SMESH_SWIG/SMESH_mechanic.py @@@ -179,13 -179,13 +179,13 @@@ print("-------------------------- compu 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) +salome.sg.updateObjBrowser() diff --cc src/SMESH_SWIG/SMESH_mechanic_netgen.py index e824149e8,388d42e3c..5c0c5cefb --- a/src/SMESH_SWIG/SMESH_mechanic_netgen.py +++ b/src/SMESH_SWIG/SMESH_mechanic_netgen.py @@@ -119,20 -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) +salome.sg.updateObjBrowser() diff --cc src/SMESH_SWIG/SMESH_mechanic_tetra.py index 815ad0d90,284da9268..dc0fdafb2 --- a/src/SMESH_SWIG/SMESH_mechanic_tetra.py +++ b/src/SMESH_SWIG/SMESH_mechanic_tetra.py @@@ -146,16 -146,16 +146,16 @@@ 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) +salome.sg.updateObjBrowser() diff --cc src/SMESH_SWIG/SMESH_reg.py index 3b852193b,2c5aa2465..80322918c --- a/src/SMESH_SWIG/SMESH_reg.py +++ b/src/SMESH_SWIG/SMESH_reg.py @@@ -57,10 -57,10 +57,10 @@@ 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) +salome.sg.updateObjBrowser() # ---- launch SMESH smeshgui = salome.ImportComponentGUI("SMESH") diff --cc src/SMESH_SWIG/SMESH_test.py index e8e6f4d1a,0de274585..a642a670d --- a/src/SMESH_SWIG/SMESH_test.py +++ b/src/SMESH_SWIG/SMESH_test.py @@@ -138,13 -138,13 +138,13 @@@ for a in log 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) +salome.sg.updateObjBrowser() diff --cc src/SMESH_SWIG/SMESH_test0.py index 625eaafb5,bc70c54d9..1950f3097 --- a/src/SMESH_SWIG/SMESH_test0.py +++ b/src/SMESH_SWIG/SMESH_test0.py @@@ -60,7 -60,7 +60,7 @@@ idshell = geompy.addToStudyInFather(box 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) +salome.sg.updateObjBrowser() diff --cc src/SMESH_SWIG/SMESH_test1_AndDisplay.py index 97ac10826,72fbb578a..b8f54fd7f --- a/src/SMESH_SWIG/SMESH_test1_AndDisplay.py +++ b/src/SMESH_SWIG/SMESH_test1_AndDisplay.py @@@ -111,8 -111,8 +111,8 @@@ smesh.SetName(hypArea2, "MaxElementArea mesh.Compute() -salome.sg.updateObjBrowser(True) +salome.sg.updateObjBrowser() sg = salome.ImportComponentGUI('SMESH') - if type(sg) != type(salome.salome_ComponentGUI): + if not isinstance(sg, type(salome.salome_ComponentGUI)): sg.CreateAndDisplayActor('0:1:2:3') diff --cc src/SMESH_SWIG/SMESH_test2.py index 092cf447d,8fa9b8c78..271d4261e --- a/src/SMESH_SWIG/SMESH_test2.py +++ b/src/SMESH_SWIG/SMESH_test2.py @@@ -28,11 -28,11 +28,11 @@@ 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) +salome.sg.updateObjBrowser() diff --cc src/SMESH_SWIG/ex29_refine.py index 69754d2b7,1848af2fc..7edfad86d --- a/src/SMESH_SWIG/ex29_refine.py +++ b/src/SMESH_SWIG/ex29_refine.py @@@ -36,11 -36,8 +36,11 @@@ import o # Values # ------ +tmpDir = os.getenv('SALOME_TMP_DIR', '/tmp') - print "Output directory:", tmpDir ++print("Output directory:", tmpDir) + # Path for ".med" files -path = "/tmp/ex29_%s_" % os.getenv('USER','unknown') +path = os.path.join( tmpDir, "ex29_%s_" % os.getenv('USER','unknown')) # Name of the shape and the mesh name = "Carre" diff --cc src/SMESH_SWIG/smesh.py index 0fdd1aeb3,812264961..92a88aaf3 --- a/src/SMESH_SWIG/smesh.py +++ b/src/SMESH_SWIG/smesh.py @@@ -42,9 -43,9 +43,9 @@@ from salome.smesh import smeshBuilde try: # get instance of class smeshBuilder engineSmesh = salome.lcc.FindOrLoadComponent( "FactoryServer", "SMESH" ) - smesh = smeshBuilder.New(salome.myStudy, engineSmesh) + smesh = smeshBuilder.New(True,engineSmesh) except: - print "exception in smesh.py: instance creation failed" + print("exception in smesh.py: instance creation failed") smesh = None pass diff --cc src/SMESH_SWIG/smeshBuilder.py index 233432117,9ce830c28..6da2aaf29 --- a/src/SMESH_SWIG/smeshBuilder.py +++ b/src/SMESH_SWIG/smeshBuilder.py @@@ -745,10 -830,10 +818,10 @@@ class smeshBuilder(SMESH._objref_SMESH_ # 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() + study = salome.myStudy if study: so = study.FindObjectIOR( aCriterion.ThresholdID ) if so: @@@ -1183,10 -1266,10 +1254,10 @@@ def New( isPublished = True, instance=N global doLcc engine = instance if engine is None: - doLcc = True + doLcc = True smeshInst = smeshBuilder() assert isinstance(smeshInst,smeshBuilder), "Smesh engine class is %s but should be smeshBuilder.smeshBuilder. Import salome.smesh.smeshBuilder before creating the instance."%smeshInst.__class__ - smeshInst.init_smesh(study) + smeshInst.init_smesh(isPublished) return smeshInst @@@ -1501,15 -1585,15 +1570,15 @@@ class Mesh(metaclass=MeshMeta) 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 salome.sg.hasDesktop(): if not isinstance( refresh, list): # not a call from subMesh.Compute() smeshgui = salome.ImportComponentGUI("SMESH") - smeshgui.Init(self.mesh.GetStudyId()) + smeshgui.Init() smeshgui.SetMeshIcon( salome.ObjectToID( self.mesh ), ok, (self.NbNodes()==0) ) - if refresh: salome.sg.updateObjBrowser(True) + if refresh: salome.sg.updateObjBrowser() return ok @@@ -5183,41 -5270,18 +5251,42 @@@ class algoCreator # Create an instance of algorithm def __call__(self,algo="",geom=0,*args): - algoType = self.defaultAlgoType - for arg in args + (algo,geom): - if isinstance( arg, geomBuilder.GEOM._objref_GEOM_Object ): - geom = arg - if isinstance( arg, str ) and arg: + algoType = "" + shape = 0 + if isinstance( algo, str ): + algoType = algo + elif ( isinstance( algo, geomBuilder.GEOM._objref_GEOM_Object ) and \ + not isinstance( geom, geomBuilder.GEOM._objref_GEOM_Object )): + shape = algo + elif algo: + args += (algo,) + + if isinstance( geom, geomBuilder.GEOM._objref_GEOM_Object ): + shape = geom + elif not algoType and isinstance( geom, str ): + algoType = geom + elif geom: + args += (geom,) + for arg in args: + if isinstance( arg, geomBuilder.GEOM._objref_GEOM_Object ) and not shape: + shape = arg + elif isinstance( arg, str ) and not algoType: algoType = arg + else: + import traceback, sys + msg = "Warning. Unexpected argument in mesh.%s() ---> %s" % ( self.method, arg ) + sys.stderr.write( msg + '\n' ) + tb = traceback.extract_stack(None,2) + traceback.print_list( [tb[0]] ) + if not algoType: + algoType = self.defaultAlgoType 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) ++ + return self.algoTypeToClass[ algoType ]( self.mesh, shape ) - 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. @@@ -5295,10 -5359,10 +5364,10 @@@ for pluginName in os.environ[ "SMESH_Me if k[0] == '_': continue algo = getattr( plugin, k ) #print " algo:", str(algo) - if type( algo ).__name__ == 'classobj' and hasattr( algo, "meshMethod" ): + if inspect.isclass(algo) and hasattr(algo, "meshMethod"): #print " meshMethod:" , str(algo.meshMethod) if not hasattr( Mesh, algo.meshMethod ): - setattr( Mesh, algo.meshMethod, algoCreator() ) + setattr( Mesh, algo.meshMethod, algoCreator( algo.meshMethod )) pass getattr( Mesh, algo.meshMethod ).add( algo ) pass diff --cc src/Tools/MGCleanerPlug/MGCleanerMonPlugDialog.py index e7603d916,2f2e5c1ee..5bcb15973 --- a/src/Tools/MGCleanerPlug/MGCleanerMonPlugDialog.py +++ b/src/Tools/MGCleanerPlug/MGCleanerMonPlugDialog.py @@@ -262,9 -263,9 +262,9 @@@ class MGCleanerMonPlugDialog(Ui_MGClean ACmt = myBuilder.FindOrCreateAttribute(myObject, "AttributeComment") ACmt.SetValue(datai) - if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(False) + if salome.sg.hasDesktop(): salome.sg.updateObjBrowser() 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): @@@ -305,9 -307,9 +305,9 @@@ notebook.set("MGCleaner_%i" % self.num, data) """ - if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(False) + if salome.sg.hasDesktop(): salome.sg.updateObjBrowser() 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): diff --cc src/Tools/Verima/Stats/getCritere.py index 6dcc3345b,ab7edff59..7f718755b --- a/src/Tools/Verima/Stats/getCritere.py +++ b/src/Tools/Verima/Stats/getCritere.py @@@ -3,13 -2,13 +2,13 @@@ 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): +def getCritere(dim,NomMesh,acritere): import SMESH from salome.smesh import smeshBuilder - smesh = smeshBuilder.New(theStudy) + smesh = smeshBuilder.New() import numpy # print dim,NomMesh,acritere if dim == 2 : diff --cc src/Tools/YamsPlug/monYamsPlugDialog.py index 29754d4b4,90e491797..4aac5cf7c --- a/src/Tools/YamsPlug/monYamsPlugDialog.py +++ b/src/Tools/YamsPlug/monYamsPlugDialog.py @@@ -236,9 -236,9 +236,9 @@@ class MonYamsPlugDialog(Ui_YamsPlugDial ACmt = myBuilder.FindOrCreateAttribute(myObject, "AttributeComment") ACmt.SetValue(datai) - if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(False) + if salome.sg.hasDesktop(): salome.sg.updateObjBrowser() 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): @@@ -273,9 -273,9 +273,9 @@@ data = self.getResumeData(separator=" ; ") self.editor.setAttributeValue(newStudyIter, "AttributeComment", data) - if salome.sg.hasDesktop(): salome.sg.updateObjBrowser(False) + if salome.sg.hasDesktop(): salome.sg.updateObjBrowser() 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): diff --cc src/Tools/blocFissure/ihm/fissureCoude_plugin.py index fa561d6f3,44c9dec47..d028f3d8a --- a/src/Tools/blocFissure/ihm/fissureCoude_plugin.py +++ b/src/Tools/blocFissure/ihm/fissureCoude_plugin.py @@@ -22,13 -22,17 +22,16 @@@ # if you already have plugins defined in a salome_plugins.py file, add this file at the end. # if not, copy this file as ${HOME}/Plugins/smesh_plugins.py or ${APPLI}/Plugins/smesh_plugins.py - import sys, traceback import math + import sys + import traceback + from blocFissure import gmu + def fissureCoudeDlg(context): - # get context study, studyId, salomeGui + # get context study, salomeGui study = context.study - studyId = context.studyId sg = context.sg import os diff --cc src/Tools/padder/resources/testdata/buildparticules.py index d4ce4adaa,c2dea7a86..dc9ee8190 --- a/src/Tools/padder/resources/testdata/buildparticules.py +++ b/src/Tools/padder/resources/testdata/buildparticules.py @@@ -22,13 -23,12 +23,12 @@@ import salom salome.salome_init() import GEOM from salome.geom import geomBuilder -geompy = geomBuilder.New(salome.myStudy) +geompy = geomBuilder.New() filename="/home/gboulant/development/projets/salome/SPADDER/spadder/resources/padderexe/REF_spheres.dat.xyz" - file=open(filename,'rb') - import csv - datalines = csv.reader(file, delimiter=' ') + with open(filename,'rb') as f: + datalines = csv.reader(file, delimiter=' ') i=0 for row in datalines: x=float(row[0]) diff --cc src/Tools/padder/unittests/usecase_spadderPluginTester.py index 511c5d1f5,39167defc..efb8053b2 --- a/src/Tools/padder/unittests/usecase_spadderPluginTester.py +++ b/src/Tools/padder/unittests/usecase_spadderPluginTester.py @@@ -44,9 -44,9 +44,9 @@@ 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) +c.testsmesh() - print "Test completed : OK" + print("Test completed : OK")