Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: John DeVere on May 20, 2020, 09:34:15 PM

Title: Needing Auto Tool Zero script
Post by: John DeVere on May 20, 2020, 09:34:15 PM
Having trouble Editing the Auto Tool Zero button.  Getting a Compile and Syntax error code.  Anyone out there have a clean script they would like to share?
Title: Re: Needing Auto Tool Zero script
Post by: reuelt on June 23, 2020, 07:27:06 AM
Try this:

'Probe z surface macro 

FeedCurrent = GetOemDRO(818) 'Get the current settings, OEM DROs (818)=Feedrate DRO
ZCurrent = GetOemDro(802) 'OEM DROs (802)=Z DRO
GageH = GetOEMDRO(1001) 'OEMDRO(1001)=Gage Block Height
ZNew = ZCurrent - 6 'probe down max. 6 inches
Code "G90F5" 'slow feed rate to 5inches/MIN
SetOemDRO(818,5)
Code "G4 P1" 'Pause 1 second to give time to position probe plate
Code "G31 Z" &ZNew
While IsMoving()
Sleep(10)
Wend
Call SetDro (2,GageH) 'DRO(2)=Z DRO
FinalMove = GageH + 1 ‘move 1 inch above gage height
Code "G0 Z" &FinalMove
Code "F" &FeedCurrent 'restore starting feed rate
SetOemDRO(818,FeedCurrent)