X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FTools%2FMacMesh%2FMacMesh%2FCutnGroup.py;h=aa797d45d25f2d9b09ca3afe375fbee50b4b1574;hb=6d32f944a0a115b6419184c50b57bf7c4eef5786;hp=6c548653fcc1f9f350a86e1b323010ea57202ab4;hpb=84cf6c491178cc4cea1be9c8b2ba4d13750d02a3;p=modules%2Fsmesh.git diff --git a/src/Tools/MacMesh/MacMesh/CutnGroup.py b/src/Tools/MacMesh/MacMesh/CutnGroup.py index 6c548653f..aa797d45d 100644 --- a/src/Tools/MacMesh/MacMesh/CutnGroup.py +++ b/src/Tools/MacMesh/MacMesh/CutnGroup.py @@ -1,4 +1,4 @@ -# Copyright (C) 2014-2016 EDF R&D +# Copyright (C) 2014-2019 EDF R&D # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -24,7 +24,7 @@ import math, Config from salome.geom import geomBuilder -geompy = geomBuilder.New( Config.theStudy ) +geompy = geomBuilder.New() def Go(GeoObj, CutPlnLst, OutLvlLst, PrefixLst, Publish): @@ -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 = {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 = {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)):