X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FTools%2FblocFissure%2Fgmu%2FputName.py;h=1be0d00fffb5b19e0923c213c0790a3da299797a;hb=499f29d24922cec66e41b41a0039a954993bc6df;hp=c2989151d949e70d56e34618a40d794210c40053;hpb=0fc0831670e27a5611b941c52dc152fd63964515;p=modules%2Fsmesh.git diff --git a/src/Tools/blocFissure/gmu/putName.py b/src/Tools/blocFissure/gmu/putName.py index c2989151d..1be0d00ff 100644 --- a/src/Tools/blocFissure/gmu/putName.py +++ b/src/Tools/blocFissure/gmu/putName.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2014-2020 EDF R&D +# Copyright (C) 2014-2022 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 @@ -17,15 +17,35 @@ # # 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=-1): - if i >= 0: - suffix = "_%d"%i - name += suffix - smesh.SetName(objmesh, name) + @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 ): + suffixe = "_{}".format(i_suff) + name += suffixe + # préfixe éventuel : + 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)