X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FTools%2FblocFissure%2Fgmu%2Fgeomsmesh.py;h=41994125d296d1aea4cdc8e46d79ff373f9e3890;hp=631a3e283024f5088926161419806786ce5ff3ba;hb=HEAD;hpb=442fd64c19a6e27a339ca36264c15ec91732cf32 diff --git a/src/Tools/blocFissure/gmu/geomsmesh.py b/src/Tools/blocFissure/gmu/geomsmesh.py index 631a3e283..1327a87f5 100644 --- a/src/Tools/blocFissure/gmu/geomsmesh.py +++ b/src/Tools/blocFissure/gmu/geomsmesh.py @@ -1,25 +1,72 @@ # -*- coding: utf-8 -*- - -import logging -#logging.info('start') -from . import initLog +# Copyright (C) 2014-2024 EDF +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +"""Publications dans salome""" import salome salome.salome_init() from salome.geom import geomBuilder -geompy = geomBuilder.New(salome.myStudy) +geompy = geomBuilder.New() from salome.smesh import smeshBuilder -smesh = smeshBuilder.New(salome.myStudy) +smesh = smeshBuilder.New() + +from . import initLog -# logging.debug("initialisation de geompy et smesh OK") +def geomPublish(level,aShape, aName, i_pref=None): + """Publication d'un objet sous GEOM -def geomPublish(level,aShape, aName): + @level niveau d'impression voulu + @aShape objet à nommer + @aName le nom brut + @i_pref un éventuel préfixe + """ + #print ("initLog.getLogLevel() = {}".format(initLog.getLogLevel())) + #print ("level = {}".format(level)) if initLog.getLogLevel() <= level: + # 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) + aName = prefixe + aName + geompy.addToStudy(aShape, aName) - -def geomPublishInFather(level, aFather, aShape, aName): + +def geomPublishInFather(level, aFather, aShape, aName, i_pref=None): + """Publication d'un objet sous son ascendant sous GEOM + + @level niveau d'impression voulu + @aFather objet ascendant + @aShape objet à nommer + @aName le nom brut + @i_pref un éventuel préfixe + """ if initLog.getLogLevel() <= level: + # 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) + aName = prefixe + aName + geompy.addToStudyInFather(aFather, aShape, aName) - \ No newline at end of file