Il codice nella macro M6 che sto usando è questo:
CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to later
CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state
CurrentGmode = GetOemDRO(819) 'Get the current G0/G1 state
PlateThickness = 1.6
If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded or faulty
DoOEMButton (1010) 'zero the Z axis so the probe move will start from here
Code "G90 G31Z-200 F30" 'probing move, can set the feed rate here as well as how far to move
While IsMoving() 'wait while it happens
Wend
ZProbePos = GetVar(2002) 'get the exact point the probe was hit
Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
While IsMoving ()
Wend
Call SetDro (2, PlateThickness) 'use this line if DRO is used
Call SetDro (2, 1.6) 'use this line for no on-screen plate thickness DRO, change 1.5 to your plate thickness
Code "G1 Z2 F800" 'put the Z retract height you want here, must be greater than the touch plate thickness
While IsMoving ()
Wend
Code "G90 G31Z-200 F2.5" 'probing move, can set the feed rate here as well as how far to move
While IsMoving() 'wait while it happens
Wend
ZProbePos = GetVar(2002) 'get the exact point the probe was hit
Code "G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun
While IsMoving ()
Wend
Call SetDro (2, 1.6) 'use this line for no on-screen plate thickness DRO, change 1.5 to your plate thickness
Code "G1 Z75 F1500" 'put the Z retract height you want here, must be greater than the touch plate thickness
While IsMoving ()
Wend
Code "(Z axis is now zeroed)" 'puts this message in the status bar
Code "F" &CurrentFeed 'Returns to prior feed rate
Else
Code "(Z-Plate is grounded, check connection and try again)" 'this goes in the status bar if applicable
End If
If CurrentAbsInc = 0 Then 'if G91 was in effect before then return to it
Code "G91"
End If
If CurrentGMode = 0 Then 'if G0 was in effect before then return to it
Code "G0"
End If
Praticamente faccio un doppio check, la seconda volta con una velocità di feed molto bassa.
All'avviamento dell'azzeramento alcune volte fa tutto per bene, altre volte:
-salta direttamente l'azzeramento, si accende l'elettromandrino e parte a lavorare
-esegue la prima parte di codice, la Z torna su per fare il secondo check up e invece che tornare giù piano la fresa si pianta velocemente sul tastatore.
Ho notato che quando non funziona sui messaggi di mach3 mi viene scritto "error defining on line 8".
Sapete dirmi come mai fa cosi? Vi ringrazio anticipatamente, spero di risolvere perchè mi sta costando non poche frese!