Salome HOME
Infortmations
[modules/smesh.git] / src / Tools / blocFissure / gmu / putName.py
index af556e6229a602ae5f6f87bb8dfaf27316f925d0..4aa08be336f9ac42816c5bd01c62887e9fa81859 100644 (file)
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-
 """Nommage des objets mesh (algorithme, hypothèse, subMesh)"""
 
+#import logging
 from .geomsmesh import smesh
 
-def putName (objmesh, name, i_suff=-1, i_pref=-1):
+def putName (objmesh, name, i_suff=-1, i_pref=None):
   """Nommage des objets mesh
 
   @objmesh objet à nommer
@@ -31,14 +31,21 @@ def putName (objmesh, name, i_suff=-1, i_pref=-1):
   @i_pref un éventuel préfixe
   """
 
+  #texte = "Name = {}, i_suff = {}, i_pref = {}".format(name,i_suff,i_pref)
+  #print(texte)
+  #logging.info(texte)
   # suffixe éventuel :
-  if i_suff >= 0:
+  if ( i_suff >= 0 ):
     suffixe = "_{}".format(i_suff)
     name += suffixe
 
   # préfixe éventuel :
-  if i_pref >= 0:
-    prefixe = "Cas{:02d}_".format(i_pref)
+  if ( i_pref is not None):
+    if isinstance(i_pref,int):
+      prefixe = "Cas{:02d}_".format(i_pref)
+    else:
+      prefixe = "{}_".format(i_pref)
     name = prefixe + name
+  #logging.info("Au final : %s", name)
 
   smesh.SetName(objmesh, name)