CurrentFeed = GetOemDRO(818) 'Get the current feedrate to return to when finished CurrentAbsInc = GetOemLED(48) 'Get the current G90/G91 state CurrentGmode = GetOemDRO(819) 'Get the current G0/G1 state If GetOemLed (825)=0 Then 'Check to see if the probe is already grounded DoOEMButton (1010) 'zero the Z axis so the probe move will start from here Code "G4 P3" ' this delay gives you time hold the probe firmly in place Code "G90 G31Z-2. F4" 'you can reset the feed rate here if you would like While IsMoving() Wend ZProbePos = GetVar(2002) 'get the exact point the probe touched the tool Code "G0 Z" &ZProbePos 'go back to that point While IsMoving () Wend Call SetDro (2, .125) ' change .125 to your touch plate thickness Sleep 200 'Pause to allow the Dro to update. Code "G1 Z1. F50" 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