def inseremotcleinfacteur(jdc,facteur,texte):
#-------------------------------------------------
if debug : print "inseremotcle ", texte , " dans ", facteur.name
- ancien=jdc.getLine(facteur.endline -1)
+ ancien=jdc.getLine(facteur.lineno )
# On va chercher la dernier ) pour ajouter avant
# on va verifier s il il y a un , avant
ligne,col,boolvirgule=chercheDerniereParenthese(jdc,facteur)
jdc.joinLineandNext(ligne)
debut=ancien.find("_F") + 3
aligne=debut*" "
+ # enleve les blancs en debut de texte
+ i = 0
+ while i < len(texte) :
+ if texte[i] != " " : break
+ i = i +1
texte=aligne+texte+"\n"
jdc.addLine(texte,ligne)
jdc.joinLineandNext(ligne+1)
# "AFFE_MATERIAU","DEFI_MATERIAU","STAT_NONLINE",
# )
-atraiter=("CALC_FONCTION","IMPR_GENE","STAT_NON_LINE")
+atraiter=("CALC_FONCTION","IMPR_GENE","STAT_NON_LINE","DEFI_MATERIAU")
filename="toto.comm"
jdc=getJDC(filename,atraiter)
root=jdc.root
#renamemocle.renamemocle(jdc,"AFFE_MATERIAU","MAILLAGE","MAILL")
#removemocle.removemocleinfact(jdc,"STAT_NONLINE","SOLV","METHOD")
#removemocle.removemocle(jdc,"STAT_NONLINE","AFFE")
+#renamemocle.renamecommande(jdc,"AFFE_CHAR_MECA","AFFE_CHAR_MECA_PN")
+#renamemocle.renamecommande(jdc,"DEBUT","DEBUT_PN")
# les arguments sont jdc,ancien-nom-de-commande,nouveau-nom-de-commande
renamemocle.renamecommande(jdc,"CALC_FONCTION","INFO_FONCTION")
# Attention ne fonctionne pas pour l instant avec +sieurs occurences du mot cle à déplacer
movemocle.movemoclefromfacttofactmulti(jdc,"STAT_NON_LINE","CONVERGENCE","RESI_INTE_RELA",("COMP_INCR","COMP_ELAS"))
-#renamemocle.renamecommande(jdc,"AFFE_CHAR_MECA","AFFE_CHAR_MECA_PN")
-#renamemocle.renamecommande(jdc,"DEBUT","DEBUT_PN")
+
+renamemocle.renamemocle(jdc,"DEFI_MATERIAU","LEMAITRE","LEMAITRE_IRRA")
+movemocle.movemoclefromfacttofactmulti(jdc,"DEFI_MATERIAU","FLU_IRRA","QSR_K",("LEMAITRE_IRRA",))
+movemocle.movemoclefromfacttofactmulti(jdc,"DEFI_MATERIAU","FLU_IRRA","BETA",("LEMAITRE_IRRA",))
+movemocle.movemoclefromfacttofactmulti(jdc,"DEFI_MATERIAU","FLU_IRRA","PHI_ZERO",("LEMAITRE_IRRA",))
+movemocle.movemoclefromfacttofactmulti(jdc,"DEFI_MATERIAU","FLU_IRRA","L",("LEMAITRE_IRRA",))
+removemocle.removemocle(jdc,"DEFI_MATERIAU","FLU_IRRA")
+
+renamemocle.renamemocleinfact(jdc,"DEFI_MATERIAU","GRAN_IRRA","A","GRAN_A")
+renamemocle.renamemocleinfact(jdc,"DEFI_MATERIAU","GRAN_IRRA","B","GRAN_B")
+renamemocle.renamemocleinfact(jdc,"DEFI_MATERIAU","GRAN_IRRA","S","GRAN_S")
+movemocle.movemoclefromfacttofactmulti(jdc,"DEFI_MATERIAU","GRAN_IRRA","GRAN_A",("LEMAITRE_IRRA",))
+movemocle.movemoclefromfacttofactmulti(jdc,"DEFI_MATERIAU","GRAN_IRRA","GRAN_B",("LEMAITRE_IRRA",))
+movemocle.movemoclefromfacttofactmulti(jdc,"DEFI_MATERIAU","GRAN_IRRA","GRAN_S",("LEMAITRE_IRRA",))
+removemocle.removemocle(jdc,"DEFI_MATERIAU","GRAN_IRRA")
f=open("tutu.comm",'w')
movemoclefromfacttofact(jdc,oper,factsource,mocle,factcible)
removemocle.removemocleinfact(jdc,oper,factsource,mocle)
+
def movemoclefromfacttofact(jdc,oper,factsource,mocle,factcible):
if debug : print "movemoclefromfacttofact pour " ,oper,factsource,mocle,factcible
for c in jdc.root.childNodes:
for n in ll.childNodes:
if n.name != mocle:continue
MonTexte=n.getText(jdc);
- print cible.name
inseremocle.inseremotcleinfacteur(jdc,cible,MonTexte)
logging.info("Changement de place : %s,%s, %s ",n.name, n.lineno, n.colno)
logging.info("vers : %s", cible.name)
-
if debug:print "mocle sur une ligne--%s--" % jdc.getLines()[mc.lineno-1][mc.colno:mc.endcol]
s=jdc.getLines()[mc.lineno-1]
jdc.getLines()[mc.lineno-1]=s[:mc.colno]+s[mc.endcol:]
+ fusionne(jdc,mc.lineno-1)
jdc.reset(jdc.getSource())
def removemocleinfact(jdc,command,fact,mocle):
removemc(jdc,c,n)
jdc.reset(jdc.getSource())
+
+def fusionne(jdc,numLigne):
+ index=0
+ texte=jdc.getLines()[numLigne]
+ fusion=1
+ while (index < len(texte)) :
+ if texte[index] not in (" ",",",")",";","\n") :
+ fusion=0
+ break
+ index=index+1
+ if fusion :
+ import load
+ jdc.joinLineandNext(numLigne)