From: pascale.noyret Date: Thu, 6 Sep 2018 10:54:40 +0000 (+0200) Subject: pour le save X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=28513ed32523d088ecfc45b452f55df3c66171ee;p=tools%2Feficas.git pour le save --- diff --git a/MapIdentification/prefs_MapIdentification.py b/MapIdentification/prefs_MapIdentification.py index 4d2c4a99..0eec5d7a 100644 --- a/MapIdentification/prefs_MapIdentification.py +++ b/MapIdentification/prefs_MapIdentification.py @@ -36,7 +36,7 @@ encoding='iso-8859-1' # #typeDeCata='XML' catalogues=( - ('MapIdentification','MAP file',os.path.join(repIni,'cata_map_cl0d.py'),'python','python'), + ('MapIdentification','MAP file',os.path.join(repIni,'cata_map_cl0d.py'),'MapIdentification','python'), ('MapIdentification','Experiences plan',os.path.join(repIni,'cata_map_cl0d_exp.py'),'python','python'), ('MapIdentification','Material parameters',os.path.join(repIni,'cata_map_cl0d_param.py'),'python','python'), diff --git a/generator/generator_MapIdentification.py b/generator/generator_MapIdentification.py new file mode 100644 index 00000000..70e160e0 --- /dev/null +++ b/generator/generator_MapIdentification.py @@ -0,0 +1,100 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2007-2017 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 +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# 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 +# +""" + Ce module contient le plugin generateur de fichier au format + CARMEL3D pour EFICAS. + +""" +from __future__ import print_function +from __future__ import absolute_import +try : + from builtins import str +except : pass + +import traceback +import types,re,os +import Accas + +from .generator_python import PythonGenerator + +def entryPoint(): + """ + Retourne les informations necessaires pour le chargeur de plugins + + Ces informations sont retournees dans un dictionnaire + """ + return { + # Le nom du plugin + 'name' : 'MapIdentification', + # La factory pour creer une instance du plugin + 'factory' : MapIdentificationGenerator, + } + + +class MapIdentificationGenerator(PythonGenerator): + """ + Ce generateur parcourt un objet de type JDC et produit + un texte au format eficas et + un texte au format py + + """ + + def gener(self,obj,format='brut',config=None,appli=None): + self.initDico() + self.text=PythonGenerator.gener(self,obj,format) + #if obj.isValid() :self.genereMap() + self.genereMap() + return self.text + + + def genereMap(self) : + ''' + Prepare le contenu du fichier de parametres python + ''' + print ('ds genereMap') + + + def initDico(self) : + if not hasattr(self,'schema') : self.schema="" + self.dictParam={} + self.dictValeur={} + + def writeDefault(self, fn): + #fileEXE = fn[:fn.rfind(".")] + '.py' + #f = open( str(fileEXE), 'wb') + #f.write( self.texteEXE ) + #f.close() + print ('ds writeDefault') + print (self.dictValeur) + + def generMCSIMP(self,obj) : + """ + Convertit un objet MCSIMP en texte python + Remplit le dictionnaire des MCSIMP + """ + + if obj.getGenealogie()[0][-6:-1]=="_PARA": + self.dictParam[obj.nom]=obj.valeur + else : + self.dictValeur[obj.nom]=obj.valeur + s=PythonGenerator.generMCSIMP(self,obj) + return s + +