Bonjour tous le monde,

Je tourne en rond depuis plusieurs jours sur un problème...

J'ai du code ISO CNC, en voilà un extrait ci-dessous, et je voudrais pouvoir parser tout ça ligne par lignes mais je ne sais pas vraiment comment le prendre ...

Les espaces ne sont pas réguliers donc ce n'est pas évident ...

Certain codes sont des mots clefs du langage iso (cf: https://fr.wikipedia.org/wiki/Progra...num%C3%A9rique)

Les Axes machines ici sont connus sous les lettres, X, Y, Z, C, B1, B2, U1, U2

Les "R" suivis de numéros sont des variables ( ex: R505)

[Edit] les commentaires sont situés derrière les ";"

Voilà je suis ouvert à vos propositions car pour le moment rien ne me vient à part peu être des usines à gaz très fortement liées mais ça ne me semble pas très pertinent ...

Extrait d'un programme:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
;-----Ne pas toucher ces paramètres-----
N20 R1000=-92.5 ;DEC U1
N21 R1001=115.91 ;DEC U2
;-----------------------------------------------
N22 M47
N23 G90 G0 G603 M61 U1=66
N24 G90 G0 G603 U2=0
N25 G90 G0 G603 B1=0.00 B2=0.00 
N26 M45 M55 
N27 M43 M53 
 
N28 G90 G0 G603 C=-90 Y=R600+R111-20.00
N29 G90 G0 G603 X=18
N30 G90 G0 G603  Z=83.80
N31 M0
N32 M60
N33 M56
N34 G0 G90 X=0 Y=(R600+R500+R540)  Z=R508
N35 M57
N36 M0
N37 M60
N38 M56
N39 G0 G90 Y=IC(10)
N40 G90 G0 G603 X=(R510+R505+2) Z=R508
N41 G0 G90 Y=R600+R500 ;B1=IC(R502)
N42 M42 
N43 G90 G0 G601 X=(R510+R505+2) U1=(R1000+R510+R520+R505+R505+4) U2=(R1001-R530)
N44 G90 G0 G601 X=(R510+R506) U1=(R1000+R510+R520+R506+R506) M44 ;Ecrasement
N45 DEBUT:
N46 M61
N47 G90 G01 F=120000*1 G601 Y=R600 B1=(R112*1) B2=(R112*0)
N48 M60
N49 G90 G0 G603 U2=0 U1=66 M45 
N50 G91 G0 X=5
N51 G90 G0 G603  Z=R509
N52 G90 G0 G603 X=(R511+2) U2=(R1001-R531-2) 
N53 M42 
 
 
 
N54  ; ----------CINTRE N°1------------
 
N55 G91 G0 Y=R500-R540-R111
N56 G91 G0 B1=IC(R502)
N57 G90 G0 G601 X=18 U2=31.8
N58 G90 G0 G601 U1=9.5 M44 
N59 M61
N60 G90 G0 B1=0
N61 M60
 
N62 STOPRE
N63 ACC[Y]=100 ACC[C]=100
 
N64 G91 G0  G601 C=+R113 Y=-(0.3142*R60*R113) M69;Cintrage
 
N65 STOPRE
N66 ACC[Y]=100 ACC[C]=100
N67 G90 G0 M61
N68 G90 G0 Y=92.7+R121+0
N69 G90 G0 M60
N70 G90 G0 G603 U2=(31.8-2) U1=IC(R0) 
N71 M45
N72 G90 G01 F=120000*1 G603 Y=IC(-20) U1=IC(20.00) X=(2+18) 
N73 G90 G0 G603 C=-90
N74 G90 G01 F=22500*1 G601 Y=92.7 B1=IC(R122*1) B2=IC(R122*0) U1=19.5 M42 
 
N75  ; ----------CINTRE N°2------------
 
N76 G90 G0 G601 X=18 U2=31.8
N77 G90 G0 G601 U1=9.5 M44 
N78 STOPRE
N79 ACC[Y]=100 ACC[C]=100
 
N80 G91 G0  G601 C=+R123 Y=-(0.3142*R60*R123) M69;Cintrage
 
N81 STOPRE
N82 ACC[Y]=100 ACC[C]=100
N83 M61
N84 G90 G0 Y=(R600+R131+R501)
N85 G91 G0 B1=R503
N86 M60
N87 G91 G01 F=120000*1 G603 Y=-20 U1=20 X=5
N88 G90 G0 G603 C=-90
N89 G90 G0 G603 U2=0 U1=66 X=IC(30)  M45 
N90 G90 G0 G603 Z=R508
N91 G91 G0 Y=+20-R131+R501-R540 B1=R503