]> SALOME platform Git repositories - tools/eficas.git/blob - Exemples/ex13/main.py
Salome HOME
Modif V6_4_°
[tools/eficas.git] / Exemples / ex13 / main.py
1 # -*- coding: utf-8 -*-
2 """
3    Exemple d'utilisation d'un JDC
4
5    Dans un premier temps on importe un catalogue
6    de définition contenu dans un module et on le valide ::
7
8       import cata
9       from cata import JdC
10       cr=JdC.report()
11       if cr.estvide(): ...
12
13    Dans un deuxième temps, on construit un jeu de commandes
14    a partir d'une chaine de caractères et on vérifie sa
15    conformité.
16 """
17
18 import sys
19 sys.path[:0]=['../..','../../Aster']
20
21 import cata
22 from cata import JdC
23
24 cr=JdC.report()
25 print cr
26
27 text="""
28 DEBUT()
29 a=OP1(a=1)
30 b=OP1(a=1,b=a)
31 c=OP1(a=1,b=10)
32 """
33
34 j=JdC(procedure=text,cata=cata,nom="bidon")
35
36 j.compile()
37 if not j.cr.estvide():
38    print j.cr
39    sys.exit()
40
41 j.exec_compile()
42 if not j.cr.estvide():
43    print j.cr
44    sys.exit()
45
46 cr=j.report()
47 assert j.isvalid() == 0
48 if not j.cr.estvide():
49    print j.cr
50    sys.exit()