From feadee6c12727fec9797d5e56da0daa56fdaa1de Mon Sep 17 00:00:00 2001 From: Eric Fayolle Date: Fri, 21 May 2021 11:40:49 +0200 Subject: [PATCH] MAJ Poc --- Poc/cataPocRN.py | 54 +++--- Poc/cataPocRNWithAssemblyName.py | 295 +++++++++++++++++++++++++++++ Poc/cdm_helpers.py | 32 ++++ Poc/edg32WithAssemblyName.comm | 70 +++++++ Poc/readExemple.py | 32 +++- Poc/readExempleWithAssemblyName.py | 73 +++++++ 6 files changed, 522 insertions(+), 34 deletions(-) create mode 100644 Poc/cataPocRNWithAssemblyName.py create mode 100644 Poc/cdm_helpers.py create mode 100644 Poc/edg32WithAssemblyName.comm create mode 100644 Poc/readExempleWithAssemblyName.py diff --git a/Poc/cataPocRN.py b/Poc/cataPocRN.py index 36c5d6f2..b1e71317 100644 --- a/Poc/cataPocRN.py +++ b/Poc/cataPocRN.py @@ -19,7 +19,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com import os -from Accas import OPER, BLOC, FACT, SIMP, ASSD, JDC_CATA, VerifTypeTuple +from Accas import OPER, BLOC, FACT, SIMP, ASSD, JDC_CATA, VerifTypeTuple, Matrice from Extensions.i18n import tr import types monFichier = os.path.abspath(__file__) @@ -47,33 +47,33 @@ class Tuple: return "Tuple de %s elements" % self.ntuple -class Matrice: - def __init__(self, nbLigs=None, nbCols=None, - methodeCalculTaille=None, formatSortie="ligne", - valSup=None, valMin=None, structure=None, typElt='R', - typEltInto=None, listeHeaders=None): - self.nbLigs = nbLigs - self.nbCols = nbCols - self.methodeCalculTaille = methodeCalculTaille - self.formatSortie = formatSortie - self.valSup = valSup - self.valMin = valMin - self.structure = structure - self.typElt = typElt - self.listeHeaders = listeHeaders - self.typEltInto = typEltInto +# class Matrice: +# def __init__(self, nbLigs=None, nbCols=None, +# methodeCalculTaille=None, formatSortie="ligne", +# valSup=None, valMin=None, structure=None, typElt='R', +# typEltInto=None, listeHeaders=None): +# self.nbLigs = nbLigs +# self.nbCols = nbCols +# self.methodeCalculTaille = methodeCalculTaille +# self.formatSortie = formatSortie +# self.valSup = valSup +# self.valMin = valMin +# self.structure = structure +# self.typElt = typElt +# self.listeHeaders = listeHeaders +# self.typEltInto = typEltInto - def __convert__(self, valeur): - # Attention ne verifie pas grand chose - if not isinstance(valeur, types.ListType): - return None - return valeur +# def __convert__(self, valeur): +# # Attention ne verifie pas grand chose +# if not isinstance(valeur, types.ListType): +# return None +# return valeur - def info(self): - return "Matrice %s x %s" % (self.nbLigs, self.nbCols) +# def info(self): +# return "Matrice %s x %s" % (self.nbLigs, self.nbCols) - __repr__ = info - __str__ = info +# __repr__ = info +# __str__ = info class VerifPostTreatment(VerifTypeTuple): @@ -228,8 +228,8 @@ def generate_ass_map(nass_list): assembly_map=SIMP(statut="o", typ=Matrice(nbLigs=n+2, nbCols=n+2, - valSup=1, - valMin=-1, + # valSup=1, + # valMin=-1, typElt='TXM', # ici c'est le nom de l'assemblage listeHeaders=None), defaut=(n+2)*[(n+2)*['.']]), diff --git a/Poc/cataPocRNWithAssemblyName.py b/Poc/cataPocRNWithAssemblyName.py new file mode 100644 index 00000000..4fdb2de6 --- /dev/null +++ b/Poc/cataPocRNWithAssemblyName.py @@ -0,0 +1,295 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2008-2018 EDF R&D +# +# This file is part of SALOME ADAO module +# +# 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 +import os +from Accas import OPER, BLOC, FACT, SIMP, ASSD, JDC_CATA, VerifTypeTuple, Matrice +from Extensions.i18n import tr +import types +monFichier = os.path.abspath(__file__) + +JdC = JDC_CATA( + code='Essai' +) +VERSION_CATALOGUE = 'V_0' + + +NMIN_ASSEMBLY = 1 +NMAX_ASSEMBLY = 18 + + +class Tuple: + def __init__(self, ntuple): + self.ntuple = ntuple + + def __convert__(self, valeur): + if len(valeur) != self.ntuple: + return None + return valeur + + def info(self): + return "Tuple de %s elements" % self.ntuple + + + +class VerifPostTreatment(VerifTypeTuple): + + def __init__(self): + super(VerifPostTreatment, self).__init__(('TXM', 'TXM')) + self.cata_info = "" + self.physValeurs = ('Neutronics', 'Thermalhydraulics') + self.typeValeurs = ('MED', 'SUM', 'MIN', 'MAX', 'MEAN') + + def info(self): + return tr(": verifie les \ntypes dans un tuple") + + def infoErreurListe(self): + return tr("Les types entres ne sont pas permis") + + def default(self, valeur): + return valeur + + def isList(self): + return 1 + + def convertItem(self, valeur): + if len(valeur) != len(self.typeDesTuples): + raise ValueError( + tr("%s devrait etre de type %s ") % (valeur, self.typeDesTuples)) + ok = self.verifType(valeur) + if ok == 0: + raise ValueError( + tr("%s devrait etre de type %s (%d)") % (valeur, self.typeDesTuples, ok)) + if ok < 0: + raise ValueError( + tr("%s devrait etre dans %s ") % (valeur[1], self.typeValeurs)) + return valeur + + def verifItem(self, valeur): + try: + if len(valeur) != len(self.typeDesTuples): + return 0 + ok = self.verifType(valeur) + if ok != 1: + return 0 + except: + return 0 + return 1 + + def verifType(self, valeur): + ok = 0 + for v in valeur: + if type(v) == bytes or type(v) == str: + ok += 1 + if ok == len(self.typeDesTuples): + if valeur[1] in self.typeValeurs: # and valeur[1] in self.physValeurs: + return 1 + return -1 + return 0 + + def verif(self, valeur): + if type(valeur) in (list, tuple): + liste = list(valeur) + for val in liste: + if self.verifItem(val) != 1: + return 0 + return 1 + return 0 + + +class myAssembly(ASSD): + pass + + +class myTechnoData(ASSD): + pass + + +class myRodBank(ASSD): + pass + + +class myModelData(ASSD): + pass + + +class myScenarioData(ASSD): + pass + + +Assembly = OPER(nom='Assembly', sd_prod=myAssembly, + assembly_name=SIMP(statut='o', typ='TXM'), + assembly_type=SIMP(statut='o', typ='TXM', into=("UOX", "MOX", "REF")), + description=BLOC(condition='assembly_type != "REF"', + assembly_width=SIMP(statut='o', typ='R'), + radial_description=FACT(statut='o', + clad_outer_radius=SIMP(statut='o', typ='R'), + guide_tube_outer_radius=SIMP(statut='o', typ='R'), + fuel_rod_pitch=SIMP(statut='o', typ='R'), + nfuel_rods=SIMP(statut='o', typ='I')), + axial_description=FACT(statut='o', + active_length_start=SIMP(statut='o', typ='R'), + active_length_end=SIMP(statut='o', typ='R')), + grids=FACT(statut='o', + mixing=FACT(statut='o', + positions=SIMP( + statut='f', typ='R', max="**"), + size=SIMP(statut='o', typ='R')), + non_mixing=FACT(statut='o', + positions=SIMP( + statut='f', typ='R', max='**'), + size=SIMP(statut='o', typ='R')), + ) + ) + ) + + +RodBank = OPER(nom="RodBank", sd_prod=myRodBank, + rodbank_name=SIMP(statut='o', typ='TXM'), + step_height=SIMP(statut='o', typ='R'), + nsteps=SIMP(statut='o', typ='I')) + + +def add_lr_refl(ass_list): + return ["RW"] + ass_list + ["RE"] + + +def add_tb_refl(ass_list): + return ["RS"] + ass_list + ["RN"] + + +def generate_ass_map(nass_list): + xsym_list = [a for a in 'ABCDEFGHJKLNPRSTUVWXYZ'] + xsym_list.reverse() + ysym_list = ["%02d" % i for i in range(NMIN_ASSEMBLY, NMAX_ASSEMBLY+1)] + ysym_list.reverse() + def_xaxis = {} + def_yaxis = {} + for n in range(NMIN_ASSEMBLY, NMAX_ASSEMBLY+1): + def_xaxis[n] = add_lr_refl(xsym_list[-n:]) + def_yaxis[n] = add_tb_refl(ysym_list[-n:]) + + dico = {} + #for n in nass_list: + for n in (6,) : + dico['assembly_map_%d' % n] = BLOC(condition="nb_assembly==%d" % n, + xaxis=SIMP(statut='o', + typ='TXM', + min=n+2, max=n+2, + defaut=def_xaxis[n],), + #defaut=def_xaxis[n], + #nomXML='xaxis'+str(n)), + yaxis=SIMP(statut='o', + typ='TXM', + min=n+2, max=n+2, + defaut=def_yaxis[n]), + assembly_map=SIMP(statut="o", + typ=Matrice(nbLigs=n+2, + nbCols=n+2, + #valSup=1, + #valMin=-1, + #typElt='TXM', # ici c'est le nom de l'assemblage + typElt=myAssembly, # ici c'est le nom de l'assemblage + listeHeaders=None), + ), + rod_map=SIMP(statut="o", + typ=Matrice(nbLigs=n+2, + nbCols=n+2, + valSup=1, + valMin=-1, + typElt='TXM', # ici c'est le nom de l'assemblage + listeHeaders=None), + defaut=(n+2)*[(n+2)*['.']])) + + return dico + + +Techno_data = OPER(nom='Techno_data', sd_prod=myTechnoData, + assembly_list=SIMP(statut='o', typ=myAssembly, min=1, max="**"), # à resorber quand on mettra dans la Matrice + rodbank_list=SIMP(statut='o', typ=myRodBank, min=0, max="**"), # idem + radial_description=FACT(statut='o', + nb_assembly=SIMP(statut='o', typ='I', into=list(range(NMIN_ASSEMBLY, NMAX_ASSEMBLY))), + **(generate_ass_map(range(NMIN_ASSEMBLY, NMAX_ASSEMBLY))) + ), # Radial_Description + axial_description=FACT(statut='o', + lower_refl_size=SIMP(statut='o', typ='R'), + upper_refl_size=SIMP(statut='o', typ='R'), + ), + nominal_power=SIMP(statut='o', typ='R'), + fuel_power_fraction=SIMP(statut='o', typ='R'), + ) # Techno data + +Model_data = OPER(nom='Model_data', sd_prod=myModelData, + physics=SIMP(statut='o', typ='TXM', into=( + 'Neutronics', 'Thermalhydraulics')), + scale=SIMP(statut='o', typ='TXM', into=( + 'system', 'component', 'local')), + b_neutro_compo=BLOC(condition='physics=="Neutronics" and scale=="component"', + codeNeutro=SIMP(statut='o', typ='TXM', into=('COCAGNE', 'APOLLO3')), + radial_meshingNeutro=FACT(statut='o', + flux_solver=SIMP(statut='o', typ='TXM', into=('subdivision', 'pin-by-pin')), + b_flux_subdivision=BLOC(condition='flux_solver=="subdivision"', + flux_subdivision=SIMP(statut='o', typ='I')), + feedback_solver=SIMP(statut='o', typ='TXM', into=('subdivision', 'pin-by-pin')), + b_feedback_subdivision=BLOC(condition='feedback_solver=="subdivision"', + feedback_subdivision=SIMP(statut='o', typ='I')))), + b_thermo_compo=BLOC(condition='physics=="Thermalhydraulics" and scale=="component"', + code=SIMP(statut='o', typ='TXM', into=('THYC', 'CATHARE3', 'FLICA4')), + radial_meshing=FACT(statut='o', + fluid=SIMP(statut='o', typ='TXM', into=('subdivision', 'subchannel')), + b_fluid_subdivision=BLOC(condition='fluid=="subdivision"', + fluid_subdivision=SIMP(statut='o', typ='I')), + pellet=SIMP(statut='o', typ='I'), + clad=SIMP(statut='o', typ='I'))), + b_scale_compo=BLOC(condition='scale=="component"', + axial_meshing=FACT(statut='o', + lower_refl=SIMP(statut='o', typ='I'), + fuel=SIMP(statut='o', typ='I'), + upper_refl=SIMP(statut='o', typ='I'))), + b_scale_local=BLOC(condition='scale=="local"', + mesh_file=SIMP(statut='o', typ='Fichier')), + ) + + +Scenario_data = OPER(nom='Scenario_data', sd_prod=myScenarioData, + initial_power=SIMP(statut='o', typ='R', val_min=0., defaut=100.), + initial_power_unit=SIMP(statut='o', typ='TXM', + into=('% Nominal power', 'W'), + defaut ='% Nominal power',), + initial_rod_positions=SIMP(statut='o', + typ=Tuple(2), + validators=VerifTypeTuple(['TXM', 'I']), + ang="Type@label, position (e.g. RodBank@RB, 0)", + max='**'), + scenario_type=SIMP(statut='o', + typ='TXM', + into=['RIA']), + b_ria=BLOC(condition='scenario_type=="RIA"', + ejected_rod=SIMP(statut='o', + typ='TXM'), + rod_position_program=SIMP(statut='o', + typ=Tuple(2), + validators=VerifTypeTuple(['R', 'I']), + max='**'), + ), + post_processing=SIMP(statut='f', + typ=Tuple(2), + validators=VerifPostTreatment(), + max='**'), + ) diff --git a/Poc/cdm_helpers.py b/Poc/cdm_helpers.py new file mode 100644 index 00000000..f09e022f --- /dev/null +++ b/Poc/cdm_helpers.py @@ -0,0 +1,32 @@ +try: + import cataPocRN_driver as drv +except ImportError: + raise Exception("This module requires the Common Data Model Driver (cata_CSAndCPS_driver module)") + +def getMainEntities(wkflDataset,typeName,sdName=None): + cdm = wkflDataset.step_Essai + _typename='T_'+typeName + if sdName != None : + return [c for c in cdm[:] if ( isinstance(c,getattr(drv,_typename)) and (c.sdName == sdName) )] + else: + return [c for c in cdm[:] if isinstance(c,getattr(drv,_typename)) ] + + +#Si les attributs ne sont pas multiple values +def getMultipleAttr(e,attributename): + if attributename.count('.') != 0: + pIndex=attributename.index('.') + # print("--------",attributename[0:pIndex]," ",attributename[pIndex+1:],"------------") + return getMultipleAttr(getattr(e,attributename[0:pIndex]),attributename[pIndex+1:]) + else: + # print("+++++++++", getattr(e,attributename), type(getattr(e,attributename)) ) + return getattr(e,attributename) + +def getFilteredEntities(element,attributename=None,attributevalue=None): +# print("getFilteredEntities(element,attributename=None,attributevalue=None):",element,attributename,attributevalue) + if attributename != None : + return [e for e in element[:] if getMultipleAttr(e,attributename) == attributevalue] + else: + return element[:] + + diff --git a/Poc/edg32WithAssemblyName.comm b/Poc/edg32WithAssemblyName.comm new file mode 100644 index 00000000..38b82cf6 --- /dev/null +++ b/Poc/edg32WithAssemblyName.comm @@ -0,0 +1,70 @@ + +REF=Assembly(assembly_name='REF', + assembly_type='REF',); + +U1=Assembly(assembly_name='U1', + assembly_type='UOX', + assembly_width=0.21504, + radial_description=_F(clad_outer_radius=0.00475, + guide_tube_outer_radius=0.006025, + fuel_rod_pitch=0.0126, + nfuel_rods=264,), + axial_description=_F(active_length_start=0.2, + active_length_end=1.5,), + grids=_F(mixing=_F(positions=(1.0807,), + size=0.033,), + non_mixing=_F(positions=(0.026,), + size=0.033,),),); + +RB=RodBank(rodbank_name='RB', + step_height=0.008, + nsteps=162,); + +techno_data=Techno_data(assembly_list=(REF,U1,), + rodbank_list=(RB,), + radial_description=_F(nb_assembly=6, + xaxis=('RW','F','E','D','C','B','A','RE',), + yaxis=('RS','06','05','04','03','02','01','RN',), + assembly_map=((REF,REF,REF,REF,REF,REF,REF,REF,),(REF,REF,U1,U1,U1,U1,REF,REF,),(REF,U1,U1,U1,U1,U1,U1,REF,),(REF,U1,U1,U1,U1,U1,REF,REF,),(REF,U1,U1,U1,U1,U1,U1,REF,),(REF,U1,U1,U1,U1,U1,REF,REF,),(REF,REF,U1,U1,U1,U1,REF,REF,),(REF,REF,REF,REF,REF,REF,REF,REF,),), + rod_map= + (['#','#','#','#','#','#','#', + '#'],['#','#','.','.','.','.','#','#'],['#','.','.','.','RB','.', + '.','#'],['#','.','RB','.','.','.','.','#'],['#','.','.','.','.', + 'RB','.','#'],['#','.','.','RB','.','.','.','#'],['#','#','.','.', + '.','.','#','#'],['#','#','#','#','#','#','#','#'],),), + axial_description=_F(lower_refl_size=0.2, + upper_refl_size=0.2,), + nominal_power=100000000.0, + fuel_power_fraction=0.974,); + +neutro_model=Model_data(physics='Neutronics', + scale='component', + codeNeutro='COCAGNE', + radial_meshingNeutro=_F(flux_solver='subdivision', + flux_subdivision=2, + feedback_solver='subdivision', + feedback_subdivision=1,), + axial_meshing=_F(lower_refl=1, + fuel=21, + upper_refl=1,),); + +thermo_model=Model_data(physics='Thermalhydraulics', + scale='component', + code='THYC', + radial_meshing=_F(fluid='subdivision', + fluid_subdivision=1, + pellet=8, + clad=2,), + axial_meshing=_F(lower_refl=1, + fuel=40, + upper_refl=1,),); + +scenario_data=Scenario_data(initial_power=100.0, + initial_power_unit='% Nominal power', + initial_rod_positions=(('Rodbank@RB',162),('Rodcluster@B04',0)), + scenario_type='RIA', + ejected_rod='B04', + rod_position_program=((0.0,0),(0.1,162)), + post_processing=(('Fuel temperature@Thermalhydraulics','MAX'),('Neutronic power@Neutronics','SUM'),('Fuel temperature@Thermalhydraulics','MED')),); +#VERSION_CATALOGUE:V_0:FIN VERSION_CATALOGUE +#CHECKSUM:650687868fdfea444161002a5481615c -:FIN CHECKSUM \ No newline at end of file diff --git a/Poc/readExemple.py b/Poc/readExemple.py index 2f78a0df..41453b26 100644 --- a/Poc/readExemple.py +++ b/Poc/readExemple.py @@ -1,14 +1,24 @@ from cataPocRN_driver import * import cataPocRN_driver as m +import cdm_helpers as hlp -pyxb.GlobalValidationConfig._setContentInfluencesGeneration(pyxb.GlobalValidationConfig.ALWAYS) -pyxb.GlobalValidationConfig._setInvalidElementInContent(pyxb.GlobalValidationConfig.RAISE_EXCEPTION) -pyxb.GlobalValidationConfig._setOrphanElementInContent(pyxb.GlobalValidationConfig.RAISE_EXCEPTION) +#pyxb.GlobalValidationConfig._setContentInfluencesGeneration(pyxb.GlobalValidationConfig.ALWAYS) +#pyxb.GlobalValidationConfig._setInvalidElementInContent(pyxb.GlobalValidationConfig.RAISE_EXCEPTION) +#pyxb.GlobalValidationConfig._setOrphanElementInContent(pyxb.GlobalValidationConfig.RAISE_EXCEPTION) jdd = CreateFromDocument(open('edg32.xml').read()) print (jdd.toDOM().toprettyxml()) -techno=jdd.step_Essai[3] +#Helper pour trier les PROC du premier niveau +# il est possible de filter par le nom aussi +technoList=hlp.getMainEntities(jdd,'Techno_data') +techno1=technoList[0] + +#Accès direct sans le helper +techno2=jdd.step_Essai[3] +assert(techno1==techno2) +techno=techno1 + techno.assembly_list techno.rodbank_list techno.radial_description.nb_assembly @@ -24,7 +34,10 @@ monAssembly1=T_Assembly('REF','REF') #Sans élément racine, il faut spécifier un element_name print(monAssembly1.toDOM(element_name='essai').toprettyxml()) #Génère une erreur attendue : -monAssembly1=T_Assembly('REF','REFP') +try: + monAssembly1=T_Assembly('REF','REFP') +except BaseException as e: + print('Cette erreur est voulue...',e) #Avec l'élément racine, plus besoin de spécifier un element_name m.Essai(monAssembly1).toxml() @@ -38,9 +51,14 @@ l5=m.T_assembly_map_line(('REF','REF','REF','REF','REF','REF','REF','REF')) l6=m.T_assembly_map_line(('REF','REF','REF','REF','REF','REF','REF','REF')) l7=m.T_assembly_map_line(('REF','REF','REF','REF','REF','REF','REF','REF')) l8=m.T_assembly_map_line(('REF','REF','REF','REF','REF','REF','REF','REF')) + +#On construit un assembly_map incomplet ma=m.T_assembly_map(l1,l2,l3,l4,l5,l6,l7) -print (ma.toDOM(element_name='Essai')) -ma.validateBinding() +try: + print (ma.toDOM(element_name='Essai')) + ma.validateBinding() +except BaseException as e: + print('Cette erreur est voulue...',e) ma=m.T_assembly_map(l1,l2,l3,l4,l5,l6,l7,l8) print (ma.toDOM(element_name='Essai')) diff --git a/Poc/readExempleWithAssemblyName.py b/Poc/readExempleWithAssemblyName.py new file mode 100644 index 00000000..e2be516e --- /dev/null +++ b/Poc/readExempleWithAssemblyName.py @@ -0,0 +1,73 @@ +from cataPocRNWithAssemblyName_driver import * +import cataPocRNWithAssemblyName_driver as m + +pyxb.GlobalValidationConfig._setContentInfluencesGeneration(pyxb.GlobalValidationConfig.ALWAYS) +pyxb.GlobalValidationConfig._setInvalidElementInContent(pyxb.GlobalValidationConfig.RAISE_EXCEPTION) +pyxb.GlobalValidationConfig._setOrphanElementInContent(pyxb.GlobalValidationConfig.RAISE_EXCEPTION) + +jdd = CreateFromDocument(open('edg32WithAssemblyName.xml').read()) +print (jdd.toDOM().toprettyxml()) + +techno=jdd.step_Essai[3] +techno.assembly_list +techno.rodbank_list +techno.radial_description.nb_assembly +techno.radial_description.xaxis +techno.radial_description.yaxis +techno.radial_description.assembly_map.line[:] +techno.radial_description.assembly_map.line[0] +techno.radial_description.assembly_map.line[1] +techno.radial_description.assembly_map.line[1][3] +print(techno.toDOM().toprettyxml()) + +monAssembly1=T_Assembly('REF','REF') +#Sans élément racine, il faut spécifier un element_name +print(monAssembly1.toDOM(element_name='essai').toprettyxml()) +#Génère une erreur attendue : +try: + monAssembly1=T_Assembly('REF','REFP') +except BaseException as e: + print('Cette erreur est voulue...',e) + +#Avec l'élément racine, plus besoin de spécifier un element_name +m.Essai(monAssembly1).toxml() +print(m.Essai(monAssembly1).toDOM().toprettyxml()) + +l1=m.T_assembly_map_line(('REF','REF','REF','REF','REF','REF','REF','REF')) +l2=m.T_assembly_map_line(('REF','REF','REF','REF','REF','REF','REF','REF')) +l3=m.T_assembly_map_line(('REF','REF','REF','REF','REF','REF','REF','REF')) +l4=m.T_assembly_map_line(('REF','REF','REF','REF','REF','REF','REF','REF')) +l5=m.T_assembly_map_line(('REF','REF','REF','REF','REF','REF','REF','REF')) +l6=m.T_assembly_map_line(('REF','REF','REF','REF','REF','REF','REF','REF')) +l7=m.T_assembly_map_line(('REF','REF','REF','REF','REF','REF','REF','REF')) +l8=m.T_assembly_map_line(('REF','REF','REF','REF','REF','REF','REF','REF')) + +#On construit un assembly_map incomplet +ma=m.T_assembly_map(l1,l2,l3,l4,l5,l6,l7) +try: + print (ma.toDOM(element_name='Essai')) + ma.validateBinding() +except BaseException as e: + print('Cette erreur est voulue...',e) + +ma=m.T_assembly_map(l1,l2,l3,l4,l5,l6,l7,l8) +print (ma.toDOM(element_name='Essai')) + +ll1=m.T_rod_map_line(['#','#','#','#','#','#','#','#']) +ll2=ll1 +ll3=ll1 +ll4=ll1 +ll5=ll1 +ll6=ll1 +ll7=ll1 +ll8=ll1 +ro=m.T_rod_map(ll1,ll2,ll3,ll4,ll5,ll6,ll7,ll8) +print (ro.toDOM(element_name='essai2').toprettyxml()) + +nb=m.T_nb_assembly(6) +xa=m.T_xaxis(('RW', 'F', 'E', 'D', 'C', 'B', 'A', 'RE')) +ya=m.T_yaxis(['RS', '06', '05', '04', '03', '02', '01', 'RN']) + +jdd = CreateFromDocument(open('edg32.xml').read()) +print (jdd.toDOM().toprettyxml()) + -- 2.39.2