Fixed Tool Zero
Fixed Tool Zero
Fixed Tool Zero
AutoZeroPrompt = "Place probe for Auto Tool Zero and press OK" _
& Chr(10) & "Or press CANCEL to zero tool manually"
AutoZero = MachMsg(AutoZeroPrompt,"Auto Tool Zero",1)
If AutoZero = 1 Then 'AutoZero = 1, User pressed OK
Code "G53 G0 Z" & ToolChangeZ 'ToolChangeZ is MC for starting location of probing
While IsMoving()
Sleep (10)
Wend
ZCurrent = GetOemDro(802) 'Current Z DRO
ZNew = ZCurrent - ProbeD 'Probe depth end height
Code "G90F100" 'slow feed rate to 100 MM/MIN
Code "G31 Z" &ZNew 'Start the probe move
While IsMoving()
Sleep(10)
Wend
If GetOEMLed(825) = True Then 'Probing successful
ProbeTouch = GetVar(2002) 'Exact height touch plate was contacted
Code "G1 Z" & ProbeTouch 'Go there (corrects for potential over-run)
While IsMoving()
Sleep(10)
Wend
Call SetDro(2,GageH) 'Set Z DRO to adjusted value
FinalMove = GageH + 10
Code "G0 Z" &FinalMove 'Raise probe off of touch plate
While IsMoving()
Sleep(10)
Wend
Message("Press Cycle Start to continue...")
Else 'Probe did not contact touch plate
Message("Zero not achieved - Check probe and try again manually")
End If
Else 'User selected Cancel on Auto Tool Zero prompt
Message("Zero tool manually and press Cycle Start to continue...")
End If
'Feed Rate
'G0/G1 State
'G20/G21 State
'G90/G91 State
'The (modified) default script here moves the tool back To m6start If Any movement has
occured during the tool change..
x = GetToolChangeStart( 0 )
y = GetToolChangeStart( 1 )
z = GetToolChangeStart( 2 )
a = GetToolChangeStart( 3 )
b = GetToolChangeStart( 4 )
c = GetToolChangeStart( 5 )
If(IsSafeZ() = 1) Then
SafeZ = GetSafeZ()
Code "G53 G0 Z" & SafeZ
Else
Code "G53 G0 Z0"
End If
Code "G0 A" & a' & "B" & b & "C" & c
Code "G0 X" & x & "Y" & y
Code "G0 Z" & z