Salome HOME
Merge branch 'V9_11_BR'
[modules/smesh.git] / src / Tools / blocFissure / gmu / putName.py
index c7480fb8f20a7f88bb9fc425ebede280a758fa6d..492bd9cb2dfd865bc46479e7972cfb3434db471d 100644 (file)
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-# Copyright (C) 2014-2021  EDF R&D
+# Copyright (C) 2014-2023  EDF
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
 #
 # 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
 
-# -----------------------------------------------------------------------------
-# --- nommage des objets mesh (algorithme, hypothèse, subMesh)
+def putName (objmesh, name, i_suff=-1, i_pref=None):
+  """Nommage des objets mesh
 
-def putName (objmesh, name, i_suff=-1, i_pref=-1):
+  @objmesh objet à nommer
+  @name le nom brut
+  @i_suff un éventuel suffixe
+  @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)
-