From: LUCIE BERTHON Date: Tue, 11 Sep 2018 09:45:20 +0000 (+0200) Subject: Modification du dictionnaire pour prendre en compte la valeur par defaut X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=041305a9fc7d3b960fd6a0c0f32efb9fbaa57044;p=tools%2Feficas.git Modification du dictionnaire pour prendre en compte la valeur par defaut --- diff --git a/generator/generator_MapIdentification.py b/generator/generator_MapIdentification.py index 58285861..71708e00 100644 --- a/generator/generator_MapIdentification.py +++ b/generator/generator_MapIdentification.py @@ -31,12 +31,13 @@ except : pass import traceback import types,re,os import Accas +import sys -from .generator_dicoImbrique import DicoImbriqueGenerator -from .generator_python import PythonGenerator +from .generator_dico import DicoGenerator from MapIdentification.mesScripts_MAPIDENTIFICATION import writeMAPinput, writeXMLmaterialparameters, writeXMLexperiences + def entryPoint(): """ Retourne les informations necessaires pour le chargeur de plugins @@ -51,7 +52,7 @@ def entryPoint(): } -class MapIdentificationGenerator(DicoImbriqueGenerator): +class MapIdentificationGenerator(DicoGenerator): """ Ce generateur parcourt un objet de type JDC et produit un texte au format eficas et @@ -63,28 +64,53 @@ class MapIdentificationGenerator(DicoImbriqueGenerator): def gener(self,obj,format='brut',config=None,appli=None): self.initDico() - self.text=PythonGenerator.gener(self,obj,format) + self.text=DicoGenerator.gener(self,obj,format) return self.text def writeDefault(self, fn): """Convert comm file into XML file""" print("je rentre dans writeDefault") - print(self.Dico) - - if self.Dico.has_key("Parameters_list"): - writeXMLmaterialparameters(self.Dico["Parameters_list"], fn) + print("="*50) + print (self.Dico) + print("-"*80) - elif self.Dico.has_key("Experiences"): - writeXMLexperiences(self.Dico["Experiences"], fn) - elif self.Dico.has_key("MAP_input_file"): + if self.Dico.has_key("MAP_input_file"): dico = self.Dico["MAP_input_file"] - print(dico) + writeMAPinput(dico, fn) if dico["constitutive_law_parameters_status"]=="New": - writeXMLmaterialparameters(dico, - dico["constitutive_law_parameters"]) + writeXMLmaterialparameters(dico["b_constitutive_law_parameters_new"]) if dico["exp_filename_list_status"]=="New": - writeXMLexperiences(dico, - "tmp_exp.xml") + writeXMLexperiences(dico["b_exp_filename_list_new"]) + else: + if self.Dico.has_key("Parameters_list"): + writeXMLmaterialparameters(self.Dico["Parameters_list"], fn) + + elif self.Dico.has_key("Experiences_list"): + writeXMLexperiences(self.Dico["Experiences_list"], fn) + + + def generMCSIMP(self,obj) : + """recuperation de l objet MCSIMP""" + s=DicoGenerator.generMCSIMP(self,obj) + courant=self.Dico + for p in obj.getGenealogiePrecise()[0:-1]: + if not (p in courant.keys()) : courant[p]={} + courant=courant[p] + courant[obj.nom]=obj.valeur + self.texteDico+=obj.nom+ "=" + s[0:-1]+ "\n" + return s + + #def generMCSIMP(self,obj) : + #"""recuperation de l objet MCSIMP""" + + #s=PythonGenerator.generMCSIMP(self,obj) + #if obj.isInformation() : return s + #if not obj.isValid() : return s + + #liste=obj.getGenealogiePrecise() + #print(obj.getGenealogiePrecise() ) + #print(obj.valeur ) + #return s diff --git a/generator/generator_dico.py b/generator/generator_dico.py index 20cba9eb..f44654d9 100644 --- a/generator/generator_dico.py +++ b/generator/generator_dico.py @@ -95,7 +95,7 @@ class DicoGenerator(PythonGenerator): for p in obj.getGenealogiePrecise()[0:-1]: if not (p in courant.keys()) : courant[p]={} courant=courant[p] - courant[obj.nom]=obj.val + courant[obj.nom]=obj.valeur self.texteDico+=obj.nom+ "=" + s[0:-1]+ "\n" return s