Salome HOME
[bos #40653][CEA] New mesh import export formats with meshio.
[modules/smesh.git] / src / Tools / MacMesh / MacMesh / CompositeBox.py
index c929ede2bbef2923975af920b81872ed443245e5..449823556bc3721fc93a9d1fc44b5f9fcb786925 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2016  EDF R&D
+# Copyright (C) 2014-2024  EDF
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -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 :
@@ -174,8 +174,7 @@ def IndexMultiOcc (Array,Element) :
 
 def SortList (ValList, CritList):
     Output = []
-    SortedCritList = copy.copy(CritList)
-    SortedCritList.sort()
+    SortedCritList = sorted(copy.copy(CritList))
     for i in range(0,len(ValList)):
         index = CritList.index(SortedCritList[i])
         Output.append(ValList[index])