Thanks again Greg for the constructive suggestions.
New revisions to the XY & Z sections now zero the axis DRO's prior to moving toward the touch plate. The only prerequisite is the tool be positioned be less than +2" from the X touch plate face, less than +1" from the Y touch place face and less than +2" from the Z touch plate face.
The revised code now looks like this:
XYZ Auto Tool Zero Macro Version3.1 by airnocker
Sub Main()
Dim ConfirmReady As String
Dim DoXY As String
Dim DoZ As String
ConfirmReady = AskTextQuestion("Confirm Touch plate leads are connected and ready. (y/n)")
If ConfirmReady = "y" Then GoTo 1 Else GoTo 5
1:
DoXY = AskTextQuestion("Zero X and Y also? (y/n)")
If DoXY = "y" Then GoTo 2 Else GoTo 3
2:
Message( "Auto Zeroing X..." )
Call SetOEMDRO( 800, 0 )
Sleep 100
If IsSuchSignal (22) Then
code "G31 X-2 F10"
While IsMoving()
Sleep 100
Wend
Call SetOEMDRO( 800, .0625 )
Sleep 100
code "G1 X.5"
End If
Message( "Auto Zeroing Y..." )
Call SetOEMDRO( 801, 0 )
Sleep 100
If IsSuchSignal (22) Then
code "G31 Y-1 F10"
While IsMoving()
Sleep 100
Wend
Call SetOEMDRO( 801, .0625 )
Sleep 100
code "G1 Y.5"
End If
3:
DoZ = AskTextQuestion("Position the touch plate to zero Z. y to continue or n to skip. (y/n)")
If DoZ = "y" Then GoTo 4 Else GoTo 6
4:
Message( "Auto Zeroing Z..." )
Call SetOEMDRO( 802, 0 )
Sleep 100
If IsSuchSignal (22) Then
code "G31 Z-2 F10"
While IsMoving()
Sleep 100
Wend
Call SetOEMDRO( 802, .180 )
Sleep 100
code "G1 Z1"
End If
GoTo 6
5:
Message ("Tool zeroing aborted. Try again when ready.")
GoTo 7
6:
Message "Tool zeroing complete. Check the results on the DROs."
7:
End Sub
End