X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FTools%2FMacMesh%2FMacMesh%2FCompositeBox.py;h=43dd60746833566132504d5664729aae831d678f;hp=c929ede2bbef2923975af920b81872ed443245e5;hb=HEAD;hpb=84cf6c491178cc4cea1be9c8b2ba4d13750d02a3 diff --git a/src/Tools/MacMesh/MacMesh/CompositeBox.py b/src/Tools/MacMesh/MacMesh/CompositeBox.py index c929ede2b..449823556 100644 --- a/src/Tools/MacMesh/MacMesh/CompositeBox.py +++ b/src/Tools/MacMesh/MacMesh/CompositeBox.py @@ -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])