From 898796393d26c9100e6e6e5c2deaa772508117b0 Mon Sep 17 00:00:00 2001 From: GERALD NICOLAS Date: Tue, 6 Apr 2021 11:08:32 +0200 Subject: [PATCH] =?utf8?q?Pr=C3=A9fixe=20autre=20qu'un=20entier?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/Tools/blocFissure/gmu/putName.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Tools/blocFissure/gmu/putName.py b/src/Tools/blocFissure/gmu/putName.py index dadd6f22f..8ea2f17df 100644 --- a/src/Tools/blocFissure/gmu/putName.py +++ b/src/Tools/blocFissure/gmu/putName.py @@ -22,7 +22,7 @@ #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 @@ -33,13 +33,16 @@ def putName (objmesh, name, i_suff=-1, i_pref=-1): #logging.info("putName pour %s - i_suff=%d, i_pref=%d", name, i_suff, i_pref) # 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) -- 2.30.2