Gents,
I'm having an issue with my zero tool script, hoping someone can provide some help.
Whenever I finish running G-Code and try to Auto-Zero my tool again in the Z-axis, the scrip works nothing like it should. If I restart Mach 3 with no G-code loaded and rerun the script it works without issue. Hoping there is an easy fix I'm missing, see below for a copy of my zero script code.
Script:
'Z AXIS HOME CODE
x = MsgBox ("Home Z Axis?", 3,"Z Axis Home")
If x = 6 Then
Code "(Getting Ready to Home Z Axis in 5 seconds)"
PlateHome = 1.485 + 0.2000 'Retract amount from Z Axis home when done.
PlateHomeCommand = "G0 Z" + CStr(PlateHome)
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 "G4 P5" ' give delay to hold fixture
Code "G31Z-1 F5" 'probe move slow feed
While IsMoving() 'wait for it to happen
Wend
ZProbePos = GetVar(2002) 'get the exact point the probe was hit
Code "G0 Z" &ZProbePos 'go back to point
While IsMoving ()
Wend
Call SetDro (2, 1.485) 'set the Z axis DRO to plate thickness
Code "G4 P0.25" 'Pause for Dro to update.
Code PlateHomeCommand '"G0 Z0.002" 'put the Z retract height you want here
x = MsgBox ("Z axis is now zeroed",0,"Z Axis Home")
Else
Code "(Z-Plate is grounded, check connection and try again)" 'status bar
x = MsgBox ("Z-Plate is grounded, check connection and try again",0 ,"Z Axis Home")
End If
End If
Thanks,
Shawn