__import__(name)
import os, sys
-sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..'))
+
+sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..','..'))
import prefs
from InterfaceQT4 import eficas_go
+++ /dev/null
-# -*- coding: utf-8 -*-
-# Copyright (C) 2007-2021 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 la classe 3Dpilote qui va creer les ordres
- de pilotage de l idl PAL pour un element de structure
-"""
-from __future__ import absolute_import
-from __future__ import print_function
-try :
- from builtins import object
-except :
- pass
-import generator
-from Extensions.i18n import tr
-
-class TroisDPilote(object):
-
- def __init__(self,node,appliEficas):
- self.node=node
- self.appliEficas=appliEficas
-
- def envoievisu(self):
- """
- """
- format="vers3DSalome"
- if format in generator.plugins :
- # Le generateur existe on l'utilise
- g=generator.plugins[format]()
- g.initJdc(self.node.getJdc())
- texte=g.gener(self.node)
- else:
- print ("Le generateur n'a pas ete trouve")
- print ("Erreur ! Erreur!")
- return ""
- from Extensions.param2 import originalMath
- originalMath.toOriginal()
- self.appliEficas.envoievisu(texte)
- originalMath.toSurcharge()
+++ /dev/null
-# Copyright (C) 2007-2021 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
-#
-try :
- from builtins import object
-except : pass
-
-class STYLE(object):
- background='gray90'
- foreground='black'
- entry_background='white'
- list_background='white'
- list_select_background='#00008b'
- list_select_foreground='grey'
- tooltip_background="yellow"
-
- standard = ("Helvetica",12)
- standard_italique = ("Helvetica",12,'italic')
- standard_gras = ("Helvetica",12,'bold')
- standard_gras_souligne = ("Helvetica",12,'bold','underline')
-
- canvas = ('Helvetica',10)
- canvas_italique = ('Helvetica',10,'italic')
- canvas_gras = ("Helvetica",10,'bold')
- canvas_gras_italique = ("Helvetica",12,'bold','italic')
-
- standard12 = ("Helvetica",14)
- standard12_gras = ("Helvetica",14,'bold')
- standard12_gras_italique = ( "Helvetica",14,'bold','italic')
-
- standardcourier10 = ("Courier",14)
- statusfont = ("Helvetica",16)
-
-style=STYLE()
+++ /dev/null
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# Copyright (C) 2007-2021 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
-#
-
-import sys,os
-sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..'))
-sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'../InterfaceQT4'))
-sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'../UiQT4'))
-from Extensions.i18n import tr
-from string import split,strip,lowercase,uppercase
-import re,string
-import Accas
-
-
-class ChercheInto:
- def __init__(self,cata,cataName):
- self.cata=cata
- self.dictInto={}
- mesCommandes=self.cata.JdC.commandes
- for maCommande in mesCommandes:
- self.construitListeInto(maCommande)
-
-
- def construitListeInto(self,e):
- if isinstance(e,Accas.A_BLOC.BLOC) :
- print (e.condition)
- for nomFils, fils in e.entites.items():
- self.construitListeInto(fils)
-
-
-if __name__ == "__main__" :
- #monCata="/local/noyret/Install_Eficas/MAP/mapcata.py"
- #monCata="/local/noyret/Install_Eficas/Aster/Cata/cataSTA11/cata.py"
- #monCata="/local/noyret/Install_Eficas/MAP/mapcata.py"
- #monCata="/local/noyret/Install_Eficas/MAP/mapcata.py"
- code="Aster"
- version=None
-
- from Editeur import session
- options=session.parse(sys.argv)
- if options.code!= None : code=options.code
- if options.cata!= None : monCata=options.cata
- if options.ssCode!= None : ssCode=options.ssCode
-
- sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..',code))
-
- from InterfaceQT4.ssIhm import QWParentSSIhm, appliEficasSSIhm
- Eficas=appliEficasSSIhm(code=code)
- parent=QWParentSSIhm(code,Eficas,version)
-
- import readercata
- monreadercata = readercata.READERCATA( parent, parent )
- Eficas.readercata=monreadercata
- monCata=monreadercata.cata
-
- monConstruitInto=ChercheInto(monCata,code)
+++ /dev/null
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# Copyright (C) 2007-2021 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
-#
-
-import sys,os
-sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..'))
-sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'../InterfaceQT4'))
-sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'../UiQT4'))
-from Extensions.i18n import tr
-from string import split,strip,lowercase,uppercase
-import re,string
-import Accas
-
-
-class ChercheInto:
- def __init__(self,cata,cataName):
- self.cata=cata
- self.dictInto={}
- mesCommandes=self.cata.JdC.commandes
- for maCommande in mesCommandes:
- print (maCommande.nom)
- print (maCommande.entites )
- print (len(maCommande.entites) )
-
-
-# def construitListeInto(self,e):
-# if isinstance(e,Accas.A_BLOC.BLOC) :
-# print (e.condition.
-# for nomFils, fils in e.entites.items():
-# self.construitListeInto(fils)
-
-
-if __name__ == "__main__" :
- #monCata="/local/noyret/Install_Eficas/MAP/mapcata.py"
- #monCata="/local/noyret/Install_Eficas/Aster/Cata/cataSTA11/cata.py"
- #monCata="/local/noyret/Install_Eficas/MAP/mapcata.py"
- monCata="/local/noyret/Install_Eficas/MAP/mapcata.py"
- code="MAP"
- version=None
-
- from Editeur import session
- options=session.parse(sys.argv)
- if options.code!= None : code=options.code
- if options.cata!= None : monCata=options.cata
- if options.ssCode!= None : ssCode=options.ssCode
-
- sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..',code))
-
- from InterfaceQT4.ssIhm import QWParentSSIhm, appliEficasSSIhm
- Eficas=appliEficasSSIhm(code=code)
- parent=QWParentSSIhm(code,Eficas,version)
-
- import readercata
- monreadercata = readercata.READERCATA( parent, parent )
- Eficas.readercata=monreadercata
- monCata=monreadercata.cata
-
- monConstruitInto=ChercheInto(monCata,code)
+++ /dev/null
-
--------------------------------------------------------------------------------------------------------------
- FAQs et Limitations d'EFICAS
--------------------------------------------------------------------------------------------------------------
-
-
-1. Mots réservés :
-
- Tous les mots du langage Python sont des mots réservés.
- On ne peut donc pas appeler une variable ou un concept 'fin' ou 'dir'
- Pour la liste complète de ces mots-clés, veuillez vous référer à la
- documentation Python
-
-2. Concepts réentrants :
-
- Ne pas indiquer par un '&' devant son nom qu'un concept est utilisé comme
- concept réentrant. En effet EFICAS le sait !
-
-3. Carte commentaire :
-
- La carte commentaire est désormais le '#' (dièse) au lieu du '%' (pourcent)
- Les commentaires sont gérés comme des objets de même niveau que les
- commandes ; il n'est plus possible de placer des commentaires "dans"
- une commande. Attention, lors de la traduction d'un fichier de version 5
- en 6, les commentaires "dans" les commandes seront perdus.
-
-4. Nommer le concept produit par un opérateur :
-
- Vous ne pouvez nommer le concept produit d'un opérateur que lorsque
- celui-ci aura été entièrement et correctement rempli.
-
-5. Règle de rémanence dans les mots-clés facteurs répétés :
-
- La règle de rémanence qui permettait pour certains mots-clés facteurs
- et pour certains de leurs mots-clés simples de ne pas répeter la valeur
- de ces derniers dans toutes les occurrences du mot-clé facteur n'est pas
- connue d'EFICAS.
- En conséquence, vous devez répéter les mots-clés simples concernés dans
- toutes les occurrences des mots-clés facteurs.
-
-6. Besoin d'aide ?
-
- La documentation d'utilisation d'EFICAS a pris un peu de retard sur le produit ...
- Néanmoins, vous disposez sur la plupart des panneaux contextuels ( les panneaux à
- droite de l'arbre) d'une aide en ligne que vous pouvez activer en maintenant le
- bouton droit de votre souris enfoncé.
+++ /dev/null
-# -*- coding: utf-8 -*-
-# Copyright (C) 2007-2021 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
-#
-standard = ("Times",10)
-standard_italique = ("Times",10,'italic')
-standard_gras = ("Times",10,'bold')
-standard_gras_souligne = ("Times",10,'bold','underline')
-
-canvas = ('times',8)
-canvas_italique = ('times',8,'italic')
-canvas_gras = ("Times",8,'bold')
-canvas_gras_italique = ("Times",10,'bold','italic')
-
-standard12 = ("Times",12)
-standard12_gras = ("Times",12,'bold')
-standard12_gras_italique = ( "times",12,'bold','italic')
-
-standardcourier10 = ("Courier",10)
+++ /dev/null
-# -*- coding: utf-8 -*-
-# Copyright (C) 2007-2021 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 realise toutes les mises a jour du chemin pour
- les imports de modules Python
-"""
-from __future__ import absolute_import
-import sys
-import os
-
-import prefs
-name='prefs_'+prefs.code
-prefs_Code=__import__(name)
-INSTALLDIR=prefs_Code.INSTALLDIR
-
-# Ce chemin permet d'importer les modules Noyau et Validation
-# representant le code utilise (si fourni)
-# Ensuite on utilise les packages de l'intallation
-if hasattr(prefs_Code,'CODE_PATH'):
- if prefs_Code.CODE_PATH:
- sys.path[:0]=[prefs_Code.CODE_PATH]
- import Noyau,Validation
- del sys.path[0]
-sys.path[:0]=[prefs_Code.INSTALLDIR]
-
-import Accas
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2021 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
+#
+
+import sys,os
+sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..'))
+sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'../InterfaceQT4'))
+sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'../UiQT4'))
+from Extensions.i18n import tr
+from string import split,strip,lowercase,uppercase
+import re,string
+import Accas
+
+
+class ChercheInto:
+ def __init__(self,cata,cataName):
+ self.cata=cata
+ self.dictInto={}
+ mesCommandes=self.cata.JdC.commandes
+ for maCommande in mesCommandes:
+ self.construitListeInto(maCommande)
+
+
+ def construitListeInto(self,e):
+ if isinstance(e,Accas.A_BLOC.BLOC) :
+ print (e.condition)
+ for nomFils, fils in e.entites.items():
+ self.construitListeInto(fils)
+
+
+if __name__ == "__main__" :
+ #monCata="/local/noyret/Install_Eficas/MAP/mapcata.py"
+ #monCata="/local/noyret/Install_Eficas/Aster/Cata/cataSTA11/cata.py"
+ #monCata="/local/noyret/Install_Eficas/MAP/mapcata.py"
+ #monCata="/local/noyret/Install_Eficas/MAP/mapcata.py"
+ code="Aster"
+ version=None
+
+ from Editeur import session
+ options=session.parse(sys.argv)
+ if options.code!= None : code=options.code
+ if options.cata!= None : monCata=options.cata
+ if options.ssCode!= None : ssCode=options.ssCode
+
+ sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..',code))
+
+ from InterfaceQT4.ssIhm import QWParentSSIhm, appliEficasSSIhm
+ Eficas=appliEficasSSIhm(code=code)
+ parent=QWParentSSIhm(code,Eficas,version)
+
+ import readercata
+ monreadercata = readercata.READERCATA( parent, parent )
+ Eficas.readercata=monreadercata
+ monCata=monreadercata.cata
+
+ monConstruitInto=ChercheInto(monCata,code)
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2021 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
+#
+
+import sys,os
+sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..'))
+sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'../InterfaceQT4'))
+sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'../UiQT4'))
+from Extensions.i18n import tr
+from string import split,strip,lowercase,uppercase
+import re,string
+import Accas
+
+
+class ChercheInto:
+ def __init__(self,cata,cataName):
+ self.cata=cata
+ self.dictInto={}
+ mesCommandes=self.cata.JdC.commandes
+ for maCommande in mesCommandes:
+ print (maCommande.nom)
+ print (maCommande.entites )
+ print (len(maCommande.entites) )
+
+
+# def construitListeInto(self,e):
+# if isinstance(e,Accas.A_BLOC.BLOC) :
+# print (e.condition.
+# for nomFils, fils in e.entites.items():
+# self.construitListeInto(fils)
+
+
+if __name__ == "__main__" :
+ #monCata="/local/noyret/Install_Eficas/MAP/mapcata.py"
+ #monCata="/local/noyret/Install_Eficas/Aster/Cata/cataSTA11/cata.py"
+ #monCata="/local/noyret/Install_Eficas/MAP/mapcata.py"
+ monCata="/local/noyret/Install_Eficas/MAP/mapcata.py"
+ code="MAP"
+ version=None
+
+ from Editeur import session
+ options=session.parse(sys.argv)
+ if options.code!= None : code=options.code
+ if options.cata!= None : monCata=options.cata
+ if options.ssCode!= None : ssCode=options.ssCode
+
+ sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..',code))
+
+ from InterfaceQT4.ssIhm import QWParentSSIhm, appliEficasSSIhm
+ Eficas=appliEficasSSIhm(code=code)
+ parent=QWParentSSIhm(code,Eficas,version)
+
+ import readercata
+ monreadercata = readercata.READERCATA( parent, parent )
+ Eficas.readercata=monreadercata
+ monCata=monreadercata.cata
+
+ monConstruitInto=ChercheInto(monCata,code)
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2021 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 la classe 3Dpilote qui va creer les ordres
+ de pilotage de l idl PAL pour un element de structure
+"""
+from __future__ import absolute_import
+from __future__ import print_function
+try :
+ from builtins import object
+except :
+ pass
+import generator
+from Extensions.i18n import tr
+
+class TroisDPilote(object):
+
+ def __init__(self,node,appliEficas):
+ self.node=node
+ self.appliEficas=appliEficas
+
+ def envoievisu(self):
+ """
+ """
+ format="vers3DSalome"
+ if format in generator.plugins :
+ # Le generateur existe on l'utilise
+ g=generator.plugins[format]()
+ g.initJdc(self.node.getJdc())
+ texte=g.gener(self.node)
+ else:
+ print ("Le generateur n'a pas ete trouve")
+ print ("Erreur ! Erreur!")
+ return ""
+ from Extensions.param2 import originalMath
+ originalMath.toOriginal()
+ self.appliEficas.envoievisu(texte)
+ originalMath.toSurcharge()
--- /dev/null
+# Copyright (C) 2007-2021 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
+#
+try :
+ from builtins import object
+except : pass
+
+class STYLE(object):
+ background='gray90'
+ foreground='black'
+ entry_background='white'
+ list_background='white'
+ list_select_background='#00008b'
+ list_select_foreground='grey'
+ tooltip_background="yellow"
+
+ standard = ("Helvetica",12)
+ standard_italique = ("Helvetica",12,'italic')
+ standard_gras = ("Helvetica",12,'bold')
+ standard_gras_souligne = ("Helvetica",12,'bold','underline')
+
+ canvas = ('Helvetica',10)
+ canvas_italique = ('Helvetica',10,'italic')
+ canvas_gras = ("Helvetica",10,'bold')
+ canvas_gras_italique = ("Helvetica",12,'bold','italic')
+
+ standard12 = ("Helvetica",14)
+ standard12_gras = ("Helvetica",14,'bold')
+ standard12_gras_italique = ( "Helvetica",14,'bold','italic')
+
+ standardcourier10 = ("Courier",14)
+ statusfont = ("Helvetica",16)
+
+style=STYLE()
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2021 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
+#
+
+from __future__ import absolute_import
+from __future__ import print_function
+try :
+ from builtins import str
+ from builtins import object
+except :
+ pass
+import sys,os
+sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..'))
+sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'../InterfaceQT4'))
+sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'../UiQT4'))
+from Extensions.i18n import tr
+from string import split,strip,lowercase,uppercase
+import re,string
+
+import xml.etree.ElementTree as ET
+from xml.dom import minidom
+
+from PyQt4.QtGui import *
+
+def prettify(elem):
+ """Return a pretty-printed XML string for the Element.
+ """
+ rough_string = ET.tostring(elem, 'iso-8859-1')
+ reparsed = minidom.parseString(rough_string)
+ return reparsed.toprettyxml(indent=" ")
+
+
+class CatalogueXML(object):
+ def __init__(self,cata,cataName):
+ self.fichier="/tmp/XML/"+cataName+".xml"
+ self.cata=cata
+ self.first=ET.Element('cata')
+ comment=ET.Comment("catalogue "+str(cataName))
+ self.first.append(comment)
+ self.reglesUtilisees=[]
+ self.validatorsUtilises=[]
+ self.constrListTxtCmd()
+ self.ecrire_fichier()
+
+
+ def ecrire_fichier(self):
+ try :
+ import codecs
+ f = codecs.open(self.fichier, "w", "ISO-8859-1")
+ #print prettify(self.first)
+ f.write(prettify(self.first))
+ f.close()
+ except :
+ print(("Impossible d'ecrire le fichier : "+ str(self.fichier)))
+
+ def constrListTxtCmd(self):
+ mesCommandes=self.cata.JdC.commandes
+ self.commandes=ET.SubElement(self.first,'commandes')
+ for maCommande in mesCommandes:
+ maCommande.enregistreXMLStructure(self.commandes,self)
+
+
+if __name__ == "__main__" :
+ #monCata="/local/noyret/Install_Eficas/MAP/mapcata.py"
+ #monCata="/local/noyret/Install_Eficas/Aster/Cata/cataSTA11/cata.py"
+ #monCata="/local/noyret/Install_Eficas/MAP/mapcata.py"
+ #monCata="/local/noyret/Install_Eficas/MAP/mapcata.py"
+ code="Aster"
+ version=None
+
+ from Editeur import session
+ options=session.parse(sys.argv)
+ if options.code!= None : code=options.code
+ if options.cata!= None : monCata=options.cata
+ if options.ssCode!= None : ssCode=options.ssCode
+
+ sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..',code))
+
+ from InterfaceQT4.ssIhm import QWParentSSIhm, appliEficasSSIhm
+ Eficas=appliEficasSSIhm(code=code)
+ parent=QWParentSSIhm(code,Eficas,version)
+
+ import readercata
+ monreadercata = readercata.READERCATA( parent, parent )
+ Eficas.readercata=monreadercata
+ monCata=monreadercata.cata
+
+ monCataXML=CatalogueXML(monCata,code)
--- /dev/null
+
+-------------------------------------------------------------------------------------------------------------
+ FAQs et Limitations d'EFICAS
+-------------------------------------------------------------------------------------------------------------
+
+
+1. Mots réservés :
+
+ Tous les mots du langage Python sont des mots réservés.
+ On ne peut donc pas appeler une variable ou un concept 'fin' ou 'dir'
+ Pour la liste complète de ces mots-clés, veuillez vous référer à la
+ documentation Python
+
+2. Concepts réentrants :
+
+ Ne pas indiquer par un '&' devant son nom qu'un concept est utilisé comme
+ concept réentrant. En effet EFICAS le sait !
+
+3. Carte commentaire :
+
+ La carte commentaire est désormais le '#' (dièse) au lieu du '%' (pourcent)
+ Les commentaires sont gérés comme des objets de même niveau que les
+ commandes ; il n'est plus possible de placer des commentaires "dans"
+ une commande. Attention, lors de la traduction d'un fichier de version 5
+ en 6, les commentaires "dans" les commandes seront perdus.
+
+4. Nommer le concept produit par un opérateur :
+
+ Vous ne pouvez nommer le concept produit d'un opérateur que lorsque
+ celui-ci aura été entièrement et correctement rempli.
+
+5. Règle de rémanence dans les mots-clés facteurs répétés :
+
+ La règle de rémanence qui permettait pour certains mots-clés facteurs
+ et pour certains de leurs mots-clés simples de ne pas répeter la valeur
+ de ces derniers dans toutes les occurrences du mot-clé facteur n'est pas
+ connue d'EFICAS.
+ En conséquence, vous devez répéter les mots-clés simples concernés dans
+ toutes les occurrences des mots-clés facteurs.
+
+6. Besoin d'aide ?
+
+ La documentation d'utilisation d'EFICAS a pris un peu de retard sur le produit ...
+ Néanmoins, vous disposez sur la plupart des panneaux contextuels ( les panneaux à
+ droite de l'arbre) d'une aide en ligne que vous pouvez activer en maintenant le
+ bouton droit de votre souris enfoncé.
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2021 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
+#
+standard = ("Times",10)
+standard_italique = ("Times",10,'italic')
+standard_gras = ("Times",10,'bold')
+standard_gras_souligne = ("Times",10,'bold','underline')
+
+canvas = ('times',8)
+canvas_italique = ('times',8,'italic')
+canvas_gras = ("Times",8,'bold')
+canvas_gras_italique = ("Times",10,'bold','italic')
+
+standard12 = ("Times",12)
+standard12_gras = ("Times",12,'bold')
+standard12_gras_italique = ( "times",12,'bold','italic')
+
+standardcourier10 = ("Courier",10)
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2021 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 realise toutes les mises a jour du chemin pour
+ les imports de modules Python
+"""
+from __future__ import absolute_import
+import sys
+import os
+
+import prefs
+name='prefs_'+prefs.code
+prefs_Code=__import__(name)
+INSTALLDIR=prefs_Code.INSTALLDIR
+
+# Ce chemin permet d'importer les modules Noyau et Validation
+# representant le code utilise (si fourni)
+# Ensuite on utilise les packages de l'intallation
+if hasattr(prefs_Code,'CODE_PATH'):
+ if prefs_Code.CODE_PATH:
+ sys.path[:0]=[prefs_Code.CODE_PATH]
+ import Noyau,Validation
+ del sys.path[0]
+sys.path[:0]=[prefs_Code.INSTALLDIR]
+
+import Accas
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2021 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
+#
+from __future__ import absolute_import
+import os
+import prefs
+name='prefs_'+prefs.code
+prefsCode=__import__(name)
+from basestyle import STYLE,style
+
+inistylefile=os.path.join(prefsCode.repIni,"style.py")
+if os.path.isfile(inistylefile):
+ exec(compile(open(inistylefile).read(), inistylefile, 'exec'))
+
+import fontes
+for attr in dir(style):
+ if attr[0]=='_':continue
+ if not hasattr(fontes,attr):continue
+ setattr(fontes,attr,getattr(style,attr))
+++ /dev/null
-# -*- coding: utf-8 -*-
-# Copyright (C) 2007-2021 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
-#
-from __future__ import absolute_import
-import os
-import prefs
-name='prefs_'+prefs.code
-prefsCode=__import__(name)
-from basestyle import STYLE,style
-
-inistylefile=os.path.join(prefsCode.repIni,"style.py")
-if os.path.isfile(inistylefile):
- exec(compile(open(inistylefile).read(), inistylefile, 'exec'))
-
-import fontes
-for attr in dir(style):
- if attr[0]=='_':continue
- if not hasattr(fontes,attr):continue
- setattr(fontes,attr,getattr(style,attr))
+++ /dev/null
-echo "Aster"
-./cata2Xml.py -k Aster
-
-echo "Adao"
-read a
-./cata2Xml.py -k Adao
-
-echo "Carmel3D"
-read a
-./cata2Xml.py -k Carmel3D
-
-echo "CarmelCND"
-read a
-./cata2Xml.py -k CarmelCND
-
-echo "Openturns_Wrapper"
-read a
-./cata2Xml.py -k Openturns_Wrapper
-
-echo "Openturns_Study"
-read a
-./cata2Xml.py -k Openturns_Study
-
-echo "MAP"
-read a
-./cata2Xml.py -k MAP
-
-echo "MT"
-read a
-./cata2Xml.py -k MT
-
-echo "SPECA"
-read a
-./cata2Xml.py -k SPECA
-
+++ /dev/null
-echo "Aster"
-./chercheBlocInto.py -k Aster
-
-echo "Adao"
-read a
-./chercheBlocInto.py -k Adao
-
-echo "Carmel3D"
-read a
-./chercheBlocInto.py -k Carmel3D
-
-echo "CarmelCND"
-read a
-./chercheBlocInto.py -k CarmelCND
-
-echo "Openturns_Wrapper"
-read a
-./chercheBlocInto.py -k Openturns_Wrapper
-
-echo "Openturns_Study"
-read a
-./chercheBlocInto.py -k Openturns_Study
-
-echo "MAP"
-read a
-./chercheBlocInto.py -k MAP
-
-echo "MT"
-read a
-./chercheBlocInto.py -k MT
-
-echo "SPECA"
-read a
-./chercheBlocInto.py -k SPECA
-
+++ /dev/null
-echo "Aster"
-./construitInto.py -k Aster
-
-echo "Adao"
-read a
-./construitInto.py -k Adao
-
-echo "Carmel3D"
-read a
-./construitInto.py -k Carmel3D
-
-echo "CarmelCND"
-read a
-./construitInto.py -k CarmelCND
-
-echo "Openturns_Wrapper"
-read a
-./construitInto.py -k Openturns_Wrapper
-
-echo "Openturns_Study"
-read a
-./construitInto.py -k Openturns_Study
-
-echo "MAP"
-read a
-./construitInto.py -k MAP
-
-echo "MT"
-read a
-./construitInto.py -k MT
-
-echo "SPECA"
-read a
-./construitInto.py -k SPECA
-
except :
valid=0
return valid
+class compareAutreMC(Valid) :
+#----------------------------
+ def __init__(self,frere=None):
+ Valid.__init__(self, frere=frere)
+ self.nomFrere=frere
+
+ def set_MCSimp (self, MCSimp):
+ debug = 1
+ if debug : print ('je passe la pour ', self, MCSimp.nom)
+ self.MCSimp=MCSimp
+
+class infFrereMC(compareAutreMC):
+#-------------------------------
+ def convert(self, valeur):
+ # on sort de cardProto on a une liste
+ valeur=valeur[0]
+ try: MCFrere=self.MCSimp.parent.getChildOrChildInBloc(self.nomFrere)
+ except : return valeur
+ if not MCFrere : return valeur
+ if MCFrere== None : return valeur
+ if MCFrere.valeur == None : return valeur
+ if MCFrere.valeur < valeur :
+ raise CataError('la valeur de '+self.nomFrere + ' est inferieure a la valeur entree ')
+ return valeur
+
+ def verifItem(self, valeur):
+ try: MCFrere=self.MCSimp.parent.getChildOrChildInBloc(self.nomFrere)
+ except : return valeur
+ if not MCFrere : return valeur
+ if MCFrere== None : return valeur
+ if MCFrere.valeur == None : return valeur
+ if MCFrere.valeur < valeur :
+ raise CataError('la valeur de '+self.nomFrere + ' est inferieure a la valeur entree et doit etre superieure')
+ return 0
+ return 1
+
+ def infoErreurItem(self, valeur):
+ return 'la valeur de '+self.nomFrere + ' est inferieure a la valeur entree et doit etre superieure'
+
+ def info(self):
+ return 'la valeur de '+self.nomFrere + ' est inferieure a la valeur entree et doit etre superieure'
+
+class supFrereMC(compareAutreMC):
+#--------------------------------
+ def convert(self, valeur):
+ # on sort de cardProto on a une liste
+ valeur=valeur[0]
+ MCFrere=self.MCSimp.parent.getChildOrChildInBloc(self.nomFrere)
+ if not MCFrere : return valeur
+ if MCFrere== None : return valeur
+ if MCFrere.valeur > valeur :
+ raise CataError('la valeur de '+self.nomFrere + ' est superieure a la valeur entree et doit etre inferieure')
+ return valeur
+
+ def verifItem(self, valeur):
+ MCFrere=self.MCSimp.parent.getChildOrChildInBloc(self.nomFrere)
+ if not MCFrere : return 1
+ if MCFrere== None : return 1
+ if MCFrere.valeur > valeur :
+ raise CataError('la valeur de '+self.nomFrere + ' est superieure a la valeur entree et doit etre inferieure')
+ return 0
+ return 1
+
+ def infoErreurItem(self, valeur):
+ return 'la valeur de '+self.nomFrere + ' est superieure a la valeur entree et doit etre inferieure'
+
+ def info(self):
+ return 'la valeur de '+self.nomFrere + ' est superieure a la valeur entree '
+
+++ /dev/null
-# -*- coding: utf-8 -*-
-# Copyright (C) 2007-2021 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 Code_Carmel3D pour EFICAS.
-"""
-
-from __future__ import absolute_import
-try :
- from builtins import str
-except : pass
-
-texte_debut="int main() \n{ \n init_var();\n"
-texte_debut+=' format="med";\n'
-import traceback
-import types,re,os
-from Extensions.i18n import tr
-from .generator_dicoImbrique import DicoImbriqueGenerator
-
-def entryPoint():
- """
- Retourne les informations necessaires pour le chargeur de plugins
- Ces informations sont retournees dans un dictionnaire
- """
- return {
- # Le nom du plugin
- 'name' : 'PSEN',
- # La factory pour creer une instance du plugin
- 'factory' : PSENGenerator,
- }
-
-
-class PSENGenerator(DicoImbriqueGenerator):
- """
- Ce generateur parcourt un objet de type JDC et produit
- un texte au format eficas et
- un texte au format dictionnaire
-
- """
- # Les extensions de fichier permis?
- extensions=('.comm',)
-
-#----------------------------------------------------------------------------------------
- def gener(self,obj,format='brut',config=None, appliEficas=None):
-
- try :
- self.MachineDico = obj.MachineDico
- self.LoadDico = obj.LoadDico
- self.LineDico = obj.LineDico
- self.TransfoDico = obj.TransfoDico
- self.MotorDico = obj.MotorDico
- except :
- self.MachineDico = None
- self.LoadDico = None
- self.LineDico = None
- self.TransfoDico = None
- self.MotorDico = None
-
- self.initDico()
- # Cette instruction genere le contenu du fichier de commandes (persistance)
- self.text=DicoImbriqueGenerator.gener(self,obj,format)
- return self.text
-
-
-#----------------------------------------------------------------------------------------
-# initialisations
-#----------------------------------------------------------------------------------------
-
- def initDico(self) :
- DicoImbriqueGenerator.initDico(self)
- self.Entete = 'MachineDico = ' + str(self.MachineDico) +'\n'
- self.Entete += 'LoadDico = ' + str(self.LoadDico) +'\n'
- self.Entete += 'LineDico = ' + str(self.LineDico) +'\n'
- self.Entete += 'TransfoDico = ' + str(self.TransfoDico) +'\n'
- self.Entete += 'MotorDico = ' + str(self.MotorDico) + '\n'
- self.Entete +='\n'
-
-
-#----------------------------------------------------------------------------------------
-# ecriture
-#----------------------------------------------------------------------------------------
-
- def writeDefault(self,fn) :
- fileDico=os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)),'..','PSEN_Eficas','PSEN','PSENconfig.py'))
- f = open( str(fileDico), 'wb')
- f.write( self.Entete + "Dico =" + str(self.Dico) )
- f.close()
-
-
-
-#----------------------------------------------------------------------------------------
-# analyse de chaque noeud de l'arbre
-#----------------------------------------------------------------------------------------
-
-## def generMCSIMP(self,obj) :
-## """recuperation de l objet MCSIMP"""
-## #print dir(obj)
-## self.dicoMCSIMP[obj.nom]=obj.val
-## self.dicoTemp[obj.nom]=obj.val
-## s=DicoImbriqueGenerator.generMCSIMP(self,obj)
-## return s
-##
-## def generETAPE(self,obj):
-## self.dicoTemp={}
-## s=DicoImbriqueGenerator.generETAPE(self,obj)
-## if obj.nom=="DISTRIBUTION" : self.dicoLois[obj.sd.nom]=self.dicoTemp
-## self.dicoTemp={}
-## return s
-
-
-# si repertoire on change tous les noms de fichier
+++ /dev/null
-# -*- coding: utf-8 -*-
-# Copyright (C) 2007-2021 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 Code_Carmel3D pour EFICAS.
-"""
-
-from __future__ import absolute_import
-import types,re,os
-from Extensions.i18n import tr
-from .generator_python import PythonGenerator
-from .generator_modification import ModificationGenerator
-
-def entryPoint():
- """
- Retourne les informations necessaires pour le chargeur de plugins
- Ces informations sont retournees dans un dictionnaire
- """
- return {
- # Le nom du plugin
- 'name' : 'ProcessOutputs',
- # La factory pour creer une instance du plugin
- 'factory' : ProcessOutputsGenerator,
- }
-
-
-class ProcessOutputsGenerator(PythonGenerator,ModificationGenerator):
- """
- Ce generateur parcourt un objet de type JDC et produit
- un texte au format eficas et
- un texte au format dictionnaire
-
- """
- # Les extensions de fichier permis?
- extensions=('.comm',)
-
-#----------------------------------------------------------------------------------------
- def gener(self,obj,format='brut',config=None, appliEficas=None):
-
- # Cette instruction genere le contenu du fichier de commandes (persistance)
- texteModification=self.generTexteModif(obj)
- text=PythonGenerator.gener(self,obj,format)
- self.text=texteModification+text
-
- return self.text
-
-
-
-# si repertoire on change tous les noms de fichier
+++ /dev/null
-# -*- coding: utf-8 -*-
-# Copyright (C) 2007-2021 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' : 'MAP',
- # La factory pour creer une instance du plugin
- 'factory' : MapGenerator,
- }
-
-
-class MapGenerator(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,appliEficas=None):
- self.initDico()
- self.text=PythonGenerator.gener(self,obj,format)
- if obj.isValid() :self.genereExeMap()
- return self.text
-
-
- def genereExeMap(self) :
- '''
- Prepare le contenu du fichier de parametres python
- peut ensuite etre obtenu au moyen de la fonction getTubePy().
- '''
- nomSpec="spec_"+self.schema
- self.texteEXE="from map.spec import %s;\n"%nomSpec
- self.texteEXE+="node=%s.new();\n"%nomSpec
- self.texteEXE+="node.getInputData();\n"
- self.texteEXE+="node.setInputData(%s);\n"%self.dictValeur
- self.texteEXE+="node.execute();\n"
- self.texteEXE+="res=node.getOutputData();\n"
-
-
- 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()
-
- 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
-
-
- def generRUN(self,obj,schema):
- if not(obj.isValid()) :
- print ("TODO TODO TODO")
- self.texteEXE=""
- self.schema=schema
- textComm=self.gener(obj)
- return self.texteEXE
+++ /dev/null
-# -*- coding: utf-8 -*-
-# Copyright (C) 2007-2021 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
-
-listeCalParName = ('Time' , 'Temperature', 'DoseRate', 'Thickness') #'calculation_parameter_names'
-
-
-def entryPoint():
- """
- Retourne les informations necessaires pour le chargeur de plugins
-
- Ces informations sont retournees dans un dictionnaire
- """
- return {
- # Le nom du plugin
- 'name' : 'MAPVp',
- # La factory pour creer une instance du plugin
- 'factory' : MapGenerator,
- }
-
-
-class MapGenerator(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,appliEficas=None):
- self.appliEficas=appliEficas
- self.cata=self.appliEficas.readercata.cata
- self.initDico()
- self.text=PythonGenerator.gener(self,obj,format)
- if obj.isValid() :self.genereTexte(obj)
- return self.text
-
- def initDico(self) :
- self.texteInput = ""
- self.dictParam={}
- self.dictValeur={}
- self.listeEquations=[]
- self.typeEtude = ""
-
-
- def genereTexte(self,obj) :
- print ('genereTexte', self.typeEtude)
- if self.typeEtude == "Calculation" : self.genereCalculation()
-
-
- def generPROC_ETAPE(self,obj):
- s=PythonGenerator.generPROC_ETAPE(self,obj)
- if obj.nom == "Calculation_for_Mechanistic" : print ('hjkhjkh');self.typeEtude="Calculation"
- return s
-
- def genereCalculation(self) :
- '''
- Prepare le contenu du fichier de parametres python
- '''
- self.texteInput = ""
- self.texteInput += self.genereCsv()
- self.texteInput += self.genereCalculationParams()
- self.texteInput += self.txtNomCst
- self.texteInput += self.txtVal
- self.texteInput += self.txtValAct
- self.texteInput += self.txtNomCstNA
- self.texteInput += self.txtValNA
- self.texteInput += self.txtInitName
- self.texteInput += self.txtInitVal
- self.texteInput += self.genereEquations()
- print (self.texteInput)
-
- def writeDefault(self, fn):
- # normalement c_solver_polymer_kinetics_myStudy.input ou myStudy est le nom de l etude
- fileInput = fn[:fn.rfind(".")] + '.input'
- f = open( str(fileInput), 'wb')
- f.write( self.texteInput )
- f.close()
-
-
- def genereCalculationParams(self) :
- txtNom = "calculation_parameter_names = [ "
- txtVal = "calculation_parameters = [ "
- for param in ('Time' , 'Temperature', 'DoseRate', 'Thickness') :
- if param in self.dictValeur.keys() :
- txtNom += "'"+param + "', "
- txtVal += str(self.dictValeur[param]) + ", "
- # on enleve les dernieres , et on ferme
- txtNom = txtNom[0:-2]
- txtNom += "]\n"
- txtVal = txtVal[0:-2]
- txtVal += "]\n"
- txt = txtNom + txtVal
- return txt
-
- def genereEquations(self) :
- txt="equation =["
- index=0
- TechnicalUse = self.dictValeur['TechnicalUse']
- ModelName = self.dictValeur['ModelName']
- for param in self.listInitialParameters:
- print ('*******************************************')
- print (' je traite ', param , 'index : ', index)
- trouveParam=False
-
- if index != 0 : txtParam = 'Dy[j*5 + '+str(index)+ '] = '
- else : txtParam = 'Dy[j*5] = '
-
- for equation in self.listeEquations :
- if param in (self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation].keys()):
- print ('____________ trouve : ', param , 'in ', equation, ' ', self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation][param])
- trouveParam = True
- if self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation][param][0] == '-' :
- txtParam += ' ' + self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation][param]
- else :
- if index != 0 :
- txtParam += ' + ' + self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation][param]
- else :
- txtParam += self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation][param]
- print (' txtParam intermediaire ', txtParam)
-
- if trouveParam :
- txtParam = txtParam + ", "
- txt += txtParam
- index = index+1
- print (txtParam)
- print ('fin param', param, 'trouve ', trouveParam, '___________________________')
- print ('*************************************************')
- print (' ')
- print ('_________________fin for')
- txt=txt[0:-3]
- txt+="]\n"
- return txt
-
- def genereCsv(self) :
- txt = 'study_name = ' +self.dictValeur['SimulationName'] + "\n"
- txt += 'csv_output_file_name = ' + self.dictValeur['OutPutFolder'] + '/c_solver_stiff_ode_1d_' + self.dictValeur['SimulationName']+ '.csv\n'
- return txt
-
-
- def generMCList(self,obj):
- s=PythonGenerator.generMCList(self,obj)
- if obj.nom == 'ConstantesArrhenius' :
- self.txtNomCst = "Arrhenius_Name = [ "
- self.txtVal = "Arrhenius_A = [ "
- self.txtValAct = "Arrhenius_Ea = [ "
- for objFils in obj.data:
- for mc in objFils.mcListe :
- self.txtNomCst += "'" + mc.nom + "', "
- self.txtVal += str(mc.valeur[0]) + ", "
- self.txtValAct += str(mc.valeur[1]) + ", "
- self.txtNomCst = self.txtNomCst[0:-2]
- self.txtVal = self.txtVal[0:-2]
- self.txtValAct = self.txtValAct [0:-2]
- self.txtNomCst += ']\n'
- self.txtVal += ']\n'
- self.txtValAct += ']\n'
-
- if obj.nom == 'ConstantesNonArrhenius' :
- self.txtNomCstNA = "non_Arrhenius_coefs_names = [ "
- self.txtValNA = "non_Arrhenius_coefs = [ "
- for objFils in obj.data:
- for mc in objFils.mcListe :
- self.txtNomCstNA += "'" + mc.nom + "', "
- self.txtValNA += str(mc.valeur) + ", "
- self.txtNomCstNA = self.txtNomCstNA[0:-2]
- self.txtValNA = self.txtValNA[0:-2]
- self.txtNomCstNA += ']\n'
- self.txtValNA += ']\n'
-
- if obj.nom == 'InitialParameters' :
- self.listInitialParameters =[]
- self.txtInitName = "initial_Value_names = [ "
- self.txtInitVal = "initial_Values = [ "
- for objFils in obj.data:
- for mc in objFils.mcListe :
- self.txtInitName += "'" + mc.nom + "', "
- self.txtInitVal += str(mc.valeur) + ", "
- self.listInitialParameters.append(mc.nom)
- self.txtInitName = self.txtInitName[0:-2]
- self.txtInitVal = self.txtInitVal[0:-2]
- self.txtInitName += ']\n'
- self.txtInitVal += ']\n'
-
- if obj.nom in( 'initiation','propagation','termination','stabilization') :
- for o in obj :
- for mc in o.mcListe :
- nom=mc.nom.replace (' ','').replace ('+','_').replace ('-','_').replace ('>','_').replace('(','').replace(')','').replace('*','').replace('[','').replace(']','')
- nom=obj.nom+'_'+nom
- self.listeEquations.append(nom )
- return s
-
- def generMCSIMP(self,obj) :
- """
- Convertit un objet MCSIMP en texte python
- Remplit le dictionnaire des MCSIMP
- """
- s=PythonGenerator.generMCSIMP(self,obj)
- if obj.nom=='Consigne' : return s
-
- if obj.getGenealogie()[0][-6:-1]=="_PARA":
- self.dictParam[obj.nom]=obj.valeur
- else :
- self.dictValeur[obj.nom]=obj.valeur
- return s
+++ /dev/null
-# -*- coding: utf-8 -*-
-# Copyright (C) 2007-2021 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
- python pour EFICAS.
- PN
-
-"""
-from __future__ import absolute_import
-from __future__ import print_function
-from __future__ import division
-try :
- from builtins import range
-except :
- pass
-import traceback
-import types,re
-import math
-
-from Noyau import N_CR
-from Noyau.N_utils import repr_float
-import Accas
-import Extensions
-from Extensions.parametre import ITEM_PARAMETRE
-from .Formatage import Formatage
-from .generator_python import PythonGenerator
-from six.moves import range
-#from Editeur.widgets import showerror
-
-def entryPoint():
- """
- Retourne les informations necessaires pour le chargeur de plugins
-
- Ces informations sont retournees dans un dictionnaire
- """
- return {
- # Le nom du plugin
- 'name' : 'vers3DSalome',
- # La factory pour creer une instance du plugin
- 'factory' : vers3DSalomeGenerator,
- }
-
-
-class vers3DSalomeGenerator(PythonGenerator):
- """
- Ce generateur parcourt un objet AFFE-CARA_ELEM
- et produit un fichier au format texte contenant
- les instructions idl pour PAL
- """
-
- def __init__(self,cr=None):
- self.list_commandes=[];
- self.jdc=None
- self.node=None
- self.clefs=None
- self.liste_motetat = ("AFFE_CARA_ELEM", "ORIG_AXE", "AXE" ,
- "BARRE", "CABLE", "CARA", "COQUE", "EPAIS",
- "EXCENTREMENT", "GROUP_MA", "ORIENTATION",
- "POUTRE", "SECTION", "VALE", "VARI_SECT",
- "GRILLE", "ANGL_REP", "VECTEUR",
- "b_constant", "b_homothetique",
- "b_rectangle", "b_affine", "b_cercle", "b_generale" )
- self.dict_deb_com={"POUTRE":"VisuPoutre", "CABLE" : "VisuCable",
- "COQUE" : "VisuCoque", "GRILLE" : "VisuGrille",
- "ORIENTATION" : "Orientation", "BARRE" : "VisuBarre"}
-
- self.dict_suite_com={"RECTANGLE":"Rectangle","GENERALE":"Generale",
- "CERCLE":"Cercle"}
-
- self.dict_traduit={"VARI_SECT":"extrusion","EXCENTREMENT":"Excentre","EPAIS":"Epais","VECTEUR":"Vecteur"}
-
- self.initLigne ()
-
- def initJdc(self,jdc) :
- self.jdc=jdc
-
- def initLigne (self) :
- self.boolGpMa = 0
- self.commande = ""
- self.dict_attributs = {}
-
- def gener(self,node,config=None,appliEficas=None):
- """
- """
- self.node=node
- self.list_commandes=[];
- self.generator(self.node.object)
- return self.list_commandes
-
- def generator(self,obj):
- if (obj.nom in self.liste_motetat) and (self.calculeOuiNon(obj)):
- PythonGenerator.generator(self,obj)
- """
- f1=PythonGenerator.generator(self,obj)
- else :
- return ""
- """
-
- def calculeOuiNon(self,obj):
- ouinon=1
- for l in obj.getGenealogie() :
- if not l in self.liste_motetat :
- ouinon=0
- break
- return ouinon
-
-
- def generETAPE(self,obj):
- """
- """
- if obj.isValid() == 0 :
- #showerror("Element non valide","Salome ne sait pas traiter les elements non valides")
- return
- for v in obj.mcListe:
- liste=self.generator(v)
-
- def generMACRO_ETAPE(self,obj):
- """
- """
- if obj.isValid() == 0 :
- #showerror("Element non valide","Salome ne sait pas traiter les elements non valides")
- return
- for v in obj.mcListe:
- liste=self.generator(v)
-
-
- def generMCSIMP(self,obj) :
- """
- """
- if obj.nom in dir(self) :
- suite = self.__class__.__dict__[obj.nom](self,obj)
- else :
- clef=self.dict_traduit[obj.nom]
- # traitement des parametres
- try :
- self.dict_attributs[clef]=obj.val.eval()
- except :
- self.dict_attributs[clef]=obj.val
-
-
- def generMCFACT(self,obj):
- """
- Convertit un objet MCFACT en une liste de chaines de caracteres a la
- syntaxe python
- """
- self.initLigne ()
- self.commande=self.dict_deb_com[obj.nom]
- for v in obj.mcListe:
- self.generator(v)
- if self.boolGpMa == 1:
- self.list_commandes.append((self.commande,self.dict_attributs))
- else :
- #showerror("Elements ne portant pas sur un Groupe de Maille","Salome ne sait pas montrer ce type d' element")
- print(("Elements ne portant pas sur un Groupe de Maille","Salome ne sait pas montrer ce type d' element"))
- pass
-
- def generMCList(self,obj):
- """
- """
- for mcfact in obj.data:
- self.generator(mcfact)
-
- def generMCBLOC(self,obj):
- """
- """
- for v in obj.mcListe:
- self.generator(v)
-
- def GROUP_MA(self,obj):
- self.boolGpMa = 1
- self.dict_attributs["Group_Maille"]=obj.val
-
- def SECTION(self,obj):
- assert (self.commande != "" )
- if self.commande == "VisuCable" :
- self.dict_attributs["R"]= math.sqrt(obj.val/math.pi).eval()
- elif (self.commande !="VisuGrille") :
- self.commande=self.commande+self.dict_suite_com[obj.valeur]
-
- def CARA(self,obj) :
- self.clefs=obj.val
- if type(self.clefs) == bytes or type(self.clefs) == str:
- self.clefs=(obj.val,)
-
- def VALE(self,obj) :
- atraiter=obj.val
- if len(self.clefs) > 1 :
- assert (len(atraiter) == len(self.clefs))
- else :
- atraiter=(atraiter,)
- for k in range(len(atraiter)) :
- clef=self.clefs[k]
- val =atraiter[k]
- if isinstance(val, (tuple, list)) and len(val) == 1:
- val = val[0]
- if isinstance (val, Extensions.parametre.PARAMETRE):
- val=val.valeur
- print(( val.__class))
- context={}
- if type(val) == type("aaa") :
- for p in self.jdc.params:
- context[p.nom]=eval(p.val,self.jdc.const_context, context)
- print((context[p.nom]))
- res=eval(val,self.jdc.const_context, context)
- val=res
- self.dict_attributs[clef]=val
-
- def ANGL_REP(self,obj) :
- assert (len(obj.val) == 2)
- alpha,beta=obj.val
- self.dict_attributs["angleAlpha"]=alpha
- self.dict_attributs["angleBeta"]=beta
-
- def ORIG_AXE(self,obj) :
- assert (len(obj.val) == 3)
- alpha,beta,gamma=obj.val
- self.dict_attributs["origAxeX"]=alpha
- self.dict_attributs["origAxeY"]=beta
- self.dict_attributs["origAxeZ"]=gamma
-
- def AXE(self,obj) :
- assert (len(obj.val) == 3)
- alpha,beta,gamma=obj.val
- self.dict_attributs["axeX"]=alpha
- self.dict_attributs["axeY"]=beta
- self.dict_attributs["axeZ"]=gamma
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2021 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 Code_Carmel3D pour EFICAS.
+"""
+
+from __future__ import absolute_import
+try :
+ from builtins import str
+except : pass
+
+texte_debut="int main() \n{ \n init_var();\n"
+texte_debut+=' format="med";\n'
+import traceback
+import types,re,os
+from Extensions.i18n import tr
+from .generator_dicoImbrique import DicoImbriqueGenerator
+
+def entryPoint():
+ """
+ Retourne les informations necessaires pour le chargeur de plugins
+ Ces informations sont retournees dans un dictionnaire
+ """
+ return {
+ # Le nom du plugin
+ 'name' : 'PSEN',
+ # La factory pour creer une instance du plugin
+ 'factory' : PSENGenerator,
+ }
+
+
+class PSENGenerator(DicoImbriqueGenerator):
+ """
+ Ce generateur parcourt un objet de type JDC et produit
+ un texte au format eficas et
+ un texte au format dictionnaire
+
+ """
+ # Les extensions de fichier permis?
+ extensions=('.comm',)
+
+#----------------------------------------------------------------------------------------
+ def gener(self,obj,format='brut',config=None, appliEficas=None):
+
+ try :
+ self.MachineDico = obj.MachineDico
+ self.LoadDico = obj.LoadDico
+ self.LineDico = obj.LineDico
+ self.TransfoDico = obj.TransfoDico
+ self.MotorDico = obj.MotorDico
+ except :
+ self.MachineDico = None
+ self.LoadDico = None
+ self.LineDico = None
+ self.TransfoDico = None
+ self.MotorDico = None
+
+ self.initDico()
+ # Cette instruction genere le contenu du fichier de commandes (persistance)
+ self.text=DicoImbriqueGenerator.gener(self,obj,format)
+ return self.text
+
+
+#----------------------------------------------------------------------------------------
+# initialisations
+#----------------------------------------------------------------------------------------
+
+ def initDico(self) :
+ DicoImbriqueGenerator.initDico(self)
+ self.Entete = 'MachineDico = ' + str(self.MachineDico) +'\n'
+ self.Entete += 'LoadDico = ' + str(self.LoadDico) +'\n'
+ self.Entete += 'LineDico = ' + str(self.LineDico) +'\n'
+ self.Entete += 'TransfoDico = ' + str(self.TransfoDico) +'\n'
+ self.Entete += 'MotorDico = ' + str(self.MotorDico) + '\n'
+ self.Entete +='\n'
+
+
+#----------------------------------------------------------------------------------------
+# ecriture
+#----------------------------------------------------------------------------------------
+
+ def writeDefault(self,fn) :
+ fileDico=os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)),'..','PSEN_Eficas','PSEN','PSENconfig.py'))
+ f = open( str(fileDico), 'wb')
+ f.write( self.Entete + "Dico =" + str(self.Dico) )
+ f.close()
+
+
+
+#----------------------------------------------------------------------------------------
+# analyse de chaque noeud de l'arbre
+#----------------------------------------------------------------------------------------
+
+## def generMCSIMP(self,obj) :
+## """recuperation de l objet MCSIMP"""
+## #print dir(obj)
+## self.dicoMCSIMP[obj.nom]=obj.val
+## self.dicoTemp[obj.nom]=obj.val
+## s=DicoImbriqueGenerator.generMCSIMP(self,obj)
+## return s
+##
+## def generETAPE(self,obj):
+## self.dicoTemp={}
+## s=DicoImbriqueGenerator.generETAPE(self,obj)
+## if obj.nom=="DISTRIBUTION" : self.dicoLois[obj.sd.nom]=self.dicoTemp
+## self.dicoTemp={}
+## return s
+
+
+# si repertoire on change tous les noms de fichier
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2021 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 Code_Carmel3D pour EFICAS.
+"""
+
+from __future__ import absolute_import
+import types,re,os
+from Extensions.i18n import tr
+from .generator_python import PythonGenerator
+from .generator_modification import ModificationGenerator
+
+def entryPoint():
+ """
+ Retourne les informations necessaires pour le chargeur de plugins
+ Ces informations sont retournees dans un dictionnaire
+ """
+ return {
+ # Le nom du plugin
+ 'name' : 'ProcessOutputs',
+ # La factory pour creer une instance du plugin
+ 'factory' : ProcessOutputsGenerator,
+ }
+
+
+class ProcessOutputsGenerator(PythonGenerator,ModificationGenerator):
+ """
+ Ce generateur parcourt un objet de type JDC et produit
+ un texte au format eficas et
+ un texte au format dictionnaire
+
+ """
+ # Les extensions de fichier permis?
+ extensions=('.comm',)
+
+#----------------------------------------------------------------------------------------
+ def gener(self,obj,format='brut',config=None, appliEficas=None):
+
+ # Cette instruction genere le contenu du fichier de commandes (persistance)
+ texteModification=self.generTexteModif(obj)
+ text=PythonGenerator.gener(self,obj,format)
+ self.text=texteModification+text
+
+ return self.text
+
+
+
+# si repertoire on change tous les noms de fichier
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2021 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' : 'MAP',
+ # La factory pour creer une instance du plugin
+ 'factory' : MapGenerator,
+ }
+
+
+class MapGenerator(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,appliEficas=None):
+ self.initDico()
+ self.text=PythonGenerator.gener(self,obj,format)
+ if obj.isValid() :self.genereExeMap()
+ return self.text
+
+
+ def genereExeMap(self) :
+ '''
+ Prepare le contenu du fichier de parametres python
+ peut ensuite etre obtenu au moyen de la fonction getTubePy().
+ '''
+ nomSpec="spec_"+self.schema
+ self.texteEXE="from map.spec import %s;\n"%nomSpec
+ self.texteEXE+="node=%s.new();\n"%nomSpec
+ self.texteEXE+="node.getInputData();\n"
+ self.texteEXE+="node.setInputData(%s);\n"%self.dictValeur
+ self.texteEXE+="node.execute();\n"
+ self.texteEXE+="res=node.getOutputData();\n"
+
+
+ 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()
+
+ 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
+
+
+ def generRUN(self,obj,schema):
+ if not(obj.isValid()) :
+ print ("TODO TODO TODO")
+ self.texteEXE=""
+ self.schema=schema
+ textComm=self.gener(obj)
+ return self.texteEXE
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2021 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
+
+listeCalParName = ('Time' , 'Temperature', 'DoseRate', 'Thickness') #'calculation_parameter_names'
+
+
+def entryPoint():
+ """
+ Retourne les informations necessaires pour le chargeur de plugins
+
+ Ces informations sont retournees dans un dictionnaire
+ """
+ return {
+ # Le nom du plugin
+ 'name' : 'MAPVp',
+ # La factory pour creer une instance du plugin
+ 'factory' : MapGenerator,
+ }
+
+
+class MapGenerator(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,appliEficas=None):
+ self.appliEficas=appliEficas
+ self.cata=self.appliEficas.readercata.cata
+ self.initDico()
+ self.text=PythonGenerator.gener(self,obj,format)
+ if obj.isValid() :self.genereTexte(obj)
+ return self.text
+
+ def initDico(self) :
+ self.texteInput = ""
+ self.dictParam={}
+ self.dictValeur={}
+ self.listeEquations=[]
+ self.typeEtude = ""
+
+
+ def genereTexte(self,obj) :
+ print ('genereTexte', self.typeEtude)
+ if self.typeEtude == "Calculation" : self.genereCalculation()
+
+
+ def generPROC_ETAPE(self,obj):
+ s=PythonGenerator.generPROC_ETAPE(self,obj)
+ if obj.nom == "Calculation_for_Mechanistic" : print ('hjkhjkh');self.typeEtude="Calculation"
+ return s
+
+ def genereCalculation(self) :
+ '''
+ Prepare le contenu du fichier de parametres python
+ '''
+ self.texteInput = ""
+ self.texteInput += self.genereCsv()
+ self.texteInput += self.genereCalculationParams()
+ self.texteInput += self.txtNomCst
+ self.texteInput += self.txtVal
+ self.texteInput += self.txtValAct
+ self.texteInput += self.txtNomCstNA
+ self.texteInput += self.txtValNA
+ self.texteInput += self.txtInitName
+ self.texteInput += self.txtInitVal
+ self.texteInput += self.genereEquations()
+ print (self.texteInput)
+
+ def writeDefault(self, fn):
+ # normalement c_solver_polymer_kinetics_myStudy.input ou myStudy est le nom de l etude
+ fileInput = fn[:fn.rfind(".")] + '.input'
+ f = open( str(fileInput), 'wb')
+ f.write( self.texteInput )
+ f.close()
+
+
+ def genereCalculationParams(self) :
+ txtNom = "calculation_parameter_names = [ "
+ txtVal = "calculation_parameters = [ "
+ for param in ('Time' , 'Temperature', 'DoseRate', 'Thickness') :
+ if param in self.dictValeur.keys() :
+ txtNom += "'"+param + "', "
+ txtVal += str(self.dictValeur[param]) + ", "
+ # on enleve les dernieres , et on ferme
+ txtNom = txtNom[0:-2]
+ txtNom += "]\n"
+ txtVal = txtVal[0:-2]
+ txtVal += "]\n"
+ txt = txtNom + txtVal
+ return txt
+
+ def genereEquations(self) :
+ txt="equation =["
+ index=0
+ TechnicalUse = self.dictValeur['TechnicalUse']
+ ModelName = self.dictValeur['ModelName']
+ for param in self.listInitialParameters:
+ print ('*******************************************')
+ print (' je traite ', param , 'index : ', index)
+ trouveParam=False
+
+ if index != 0 : txtParam = 'Dy[j*5 + '+str(index)+ '] = '
+ else : txtParam = 'Dy[j*5] = '
+
+ for equation in self.listeEquations :
+ if param in (self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation].keys()):
+ print ('____________ trouve : ', param , 'in ', equation, ' ', self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation][param])
+ trouveParam = True
+ if self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation][param][0] == '-' :
+ txtParam += ' ' + self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation][param]
+ else :
+ if index != 0 :
+ txtParam += ' + ' + self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation][param]
+ else :
+ txtParam += self.cata.dicoEquations[TechnicalUse][ModelName]['equa_diff'][equation][param]
+ print (' txtParam intermediaire ', txtParam)
+
+ if trouveParam :
+ txtParam = txtParam + ", "
+ txt += txtParam
+ index = index+1
+ print (txtParam)
+ print ('fin param', param, 'trouve ', trouveParam, '___________________________')
+ print ('*************************************************')
+ print (' ')
+ print ('_________________fin for')
+ txt=txt[0:-3]
+ txt+="]\n"
+ return txt
+
+ def genereCsv(self) :
+ txt = 'study_name = ' +self.dictValeur['SimulationName'] + "\n"
+ txt += 'csv_output_file_name = ' + self.dictValeur['OutPutFolder'] + '/c_solver_stiff_ode_1d_' + self.dictValeur['SimulationName']+ '.csv\n'
+ return txt
+
+
+ def generMCList(self,obj):
+ s=PythonGenerator.generMCList(self,obj)
+ if obj.nom == 'ConstantesArrhenius' :
+ self.txtNomCst = "Arrhenius_Name = [ "
+ self.txtVal = "Arrhenius_A = [ "
+ self.txtValAct = "Arrhenius_Ea = [ "
+ for objFils in obj.data:
+ for mc in objFils.mcListe :
+ self.txtNomCst += "'" + mc.nom + "', "
+ self.txtVal += str(mc.valeur[0]) + ", "
+ self.txtValAct += str(mc.valeur[1]) + ", "
+ self.txtNomCst = self.txtNomCst[0:-2]
+ self.txtVal = self.txtVal[0:-2]
+ self.txtValAct = self.txtValAct [0:-2]
+ self.txtNomCst += ']\n'
+ self.txtVal += ']\n'
+ self.txtValAct += ']\n'
+
+ if obj.nom == 'ConstantesNonArrhenius' :
+ self.txtNomCstNA = "non_Arrhenius_coefs_names = [ "
+ self.txtValNA = "non_Arrhenius_coefs = [ "
+ for objFils in obj.data:
+ for mc in objFils.mcListe :
+ self.txtNomCstNA += "'" + mc.nom + "', "
+ self.txtValNA += str(mc.valeur) + ", "
+ self.txtNomCstNA = self.txtNomCstNA[0:-2]
+ self.txtValNA = self.txtValNA[0:-2]
+ self.txtNomCstNA += ']\n'
+ self.txtValNA += ']\n'
+
+ if obj.nom == 'InitialParameters' :
+ self.listInitialParameters =[]
+ self.txtInitName = "initial_Value_names = [ "
+ self.txtInitVal = "initial_Values = [ "
+ for objFils in obj.data:
+ for mc in objFils.mcListe :
+ self.txtInitName += "'" + mc.nom + "', "
+ self.txtInitVal += str(mc.valeur) + ", "
+ self.listInitialParameters.append(mc.nom)
+ self.txtInitName = self.txtInitName[0:-2]
+ self.txtInitVal = self.txtInitVal[0:-2]
+ self.txtInitName += ']\n'
+ self.txtInitVal += ']\n'
+
+ if obj.nom in( 'initiation','propagation','termination','stabilization') :
+ for o in obj :
+ for mc in o.mcListe :
+ nom=mc.nom.replace (' ','').replace ('+','_').replace ('-','_').replace ('>','_').replace('(','').replace(')','').replace('*','').replace('[','').replace(']','')
+ nom=obj.nom+'_'+nom
+ self.listeEquations.append(nom )
+ return s
+
+ def generMCSIMP(self,obj) :
+ """
+ Convertit un objet MCSIMP en texte python
+ Remplit le dictionnaire des MCSIMP
+ """
+ s=PythonGenerator.generMCSIMP(self,obj)
+ if obj.nom=='Consigne' : return s
+
+ if obj.getGenealogie()[0][-6:-1]=="_PARA":
+ self.dictParam[obj.nom]=obj.valeur
+ else :
+ self.dictValeur[obj.nom]=obj.valeur
+ return s
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2021 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
+ python pour EFICAS.
+ PN
+
+"""
+from __future__ import absolute_import
+from __future__ import print_function
+from __future__ import division
+try :
+ from builtins import range
+except :
+ pass
+import traceback
+import types,re
+import math
+
+from Noyau import N_CR
+from Noyau.N_utils import repr_float
+import Accas
+import Extensions
+from Extensions.parametre import ITEM_PARAMETRE
+from .Formatage import Formatage
+from .generator_python import PythonGenerator
+from six.moves import range
+#from Editeur.widgets import showerror
+
+def entryPoint():
+ """
+ Retourne les informations necessaires pour le chargeur de plugins
+
+ Ces informations sont retournees dans un dictionnaire
+ """
+ return {
+ # Le nom du plugin
+ 'name' : 'vers3DSalome',
+ # La factory pour creer une instance du plugin
+ 'factory' : vers3DSalomeGenerator,
+ }
+
+
+class vers3DSalomeGenerator(PythonGenerator):
+ """
+ Ce generateur parcourt un objet AFFE-CARA_ELEM
+ et produit un fichier au format texte contenant
+ les instructions idl pour PAL
+ """
+
+ def __init__(self,cr=None):
+ self.list_commandes=[];
+ self.jdc=None
+ self.node=None
+ self.clefs=None
+ self.liste_motetat = ("AFFE_CARA_ELEM", "ORIG_AXE", "AXE" ,
+ "BARRE", "CABLE", "CARA", "COQUE", "EPAIS",
+ "EXCENTREMENT", "GROUP_MA", "ORIENTATION",
+ "POUTRE", "SECTION", "VALE", "VARI_SECT",
+ "GRILLE", "ANGL_REP", "VECTEUR",
+ "b_constant", "b_homothetique",
+ "b_rectangle", "b_affine", "b_cercle", "b_generale" )
+ self.dict_deb_com={"POUTRE":"VisuPoutre", "CABLE" : "VisuCable",
+ "COQUE" : "VisuCoque", "GRILLE" : "VisuGrille",
+ "ORIENTATION" : "Orientation", "BARRE" : "VisuBarre"}
+
+ self.dict_suite_com={"RECTANGLE":"Rectangle","GENERALE":"Generale",
+ "CERCLE":"Cercle"}
+
+ self.dict_traduit={"VARI_SECT":"extrusion","EXCENTREMENT":"Excentre","EPAIS":"Epais","VECTEUR":"Vecteur"}
+
+ self.initLigne ()
+
+ def initJdc(self,jdc) :
+ self.jdc=jdc
+
+ def initLigne (self) :
+ self.boolGpMa = 0
+ self.commande = ""
+ self.dict_attributs = {}
+
+ def gener(self,node,config=None,appliEficas=None):
+ """
+ """
+ self.node=node
+ self.list_commandes=[];
+ self.generator(self.node.object)
+ return self.list_commandes
+
+ def generator(self,obj):
+ if (obj.nom in self.liste_motetat) and (self.calculeOuiNon(obj)):
+ PythonGenerator.generator(self,obj)
+ """
+ f1=PythonGenerator.generator(self,obj)
+ else :
+ return ""
+ """
+
+ def calculeOuiNon(self,obj):
+ ouinon=1
+ for l in obj.getGenealogie() :
+ if not l in self.liste_motetat :
+ ouinon=0
+ break
+ return ouinon
+
+
+ def generETAPE(self,obj):
+ """
+ """
+ if obj.isValid() == 0 :
+ #showerror("Element non valide","Salome ne sait pas traiter les elements non valides")
+ return
+ for v in obj.mcListe:
+ liste=self.generator(v)
+
+ def generMACRO_ETAPE(self,obj):
+ """
+ """
+ if obj.isValid() == 0 :
+ #showerror("Element non valide","Salome ne sait pas traiter les elements non valides")
+ return
+ for v in obj.mcListe:
+ liste=self.generator(v)
+
+
+ def generMCSIMP(self,obj) :
+ """
+ """
+ if obj.nom in dir(self) :
+ suite = self.__class__.__dict__[obj.nom](self,obj)
+ else :
+ clef=self.dict_traduit[obj.nom]
+ # traitement des parametres
+ try :
+ self.dict_attributs[clef]=obj.val.eval()
+ except :
+ self.dict_attributs[clef]=obj.val
+
+
+ def generMCFACT(self,obj):
+ """
+ Convertit un objet MCFACT en une liste de chaines de caracteres a la
+ syntaxe python
+ """
+ self.initLigne ()
+ self.commande=self.dict_deb_com[obj.nom]
+ for v in obj.mcListe:
+ self.generator(v)
+ if self.boolGpMa == 1:
+ self.list_commandes.append((self.commande,self.dict_attributs))
+ else :
+ #showerror("Elements ne portant pas sur un Groupe de Maille","Salome ne sait pas montrer ce type d' element")
+ print(("Elements ne portant pas sur un Groupe de Maille","Salome ne sait pas montrer ce type d' element"))
+ pass
+
+ def generMCList(self,obj):
+ """
+ """
+ for mcfact in obj.data:
+ self.generator(mcfact)
+
+ def generMCBLOC(self,obj):
+ """
+ """
+ for v in obj.mcListe:
+ self.generator(v)
+
+ def GROUP_MA(self,obj):
+ self.boolGpMa = 1
+ self.dict_attributs["Group_Maille"]=obj.val
+
+ def SECTION(self,obj):
+ assert (self.commande != "" )
+ if self.commande == "VisuCable" :
+ self.dict_attributs["R"]= math.sqrt(obj.val/math.pi).eval()
+ elif (self.commande !="VisuGrille") :
+ self.commande=self.commande+self.dict_suite_com[obj.valeur]
+
+ def CARA(self,obj) :
+ self.clefs=obj.val
+ if type(self.clefs) == bytes or type(self.clefs) == str:
+ self.clefs=(obj.val,)
+
+ def VALE(self,obj) :
+ atraiter=obj.val
+ if len(self.clefs) > 1 :
+ assert (len(atraiter) == len(self.clefs))
+ else :
+ atraiter=(atraiter,)
+ for k in range(len(atraiter)) :
+ clef=self.clefs[k]
+ val =atraiter[k]
+ if isinstance(val, (tuple, list)) and len(val) == 1:
+ val = val[0]
+ if isinstance (val, Extensions.parametre.PARAMETRE):
+ val=val.valeur
+ print(( val.__class))
+ context={}
+ if type(val) == type("aaa") :
+ for p in self.jdc.params:
+ context[p.nom]=eval(p.val,self.jdc.const_context, context)
+ print((context[p.nom]))
+ res=eval(val,self.jdc.const_context, context)
+ val=res
+ self.dict_attributs[clef]=val
+
+ def ANGL_REP(self,obj) :
+ assert (len(obj.val) == 2)
+ alpha,beta=obj.val
+ self.dict_attributs["angleAlpha"]=alpha
+ self.dict_attributs["angleBeta"]=beta
+
+ def ORIG_AXE(self,obj) :
+ assert (len(obj.val) == 3)
+ alpha,beta,gamma=obj.val
+ self.dict_attributs["origAxeX"]=alpha
+ self.dict_attributs["origAxeY"]=beta
+ self.dict_attributs["origAxeZ"]=gamma
+
+ def AXE(self,obj) :
+ assert (len(obj.val) == 3)
+ alpha,beta,gamma=obj.val
+ self.dict_attributs["axeX"]=alpha
+ self.dict_attributs["axeY"]=beta
+ self.dict_attributs["axeZ"]=gamma