I got the probe from Zarzul. I works great. I downloaded the tool touch off routine from the video. It also works well but i would like to make one change.
I would like to "record" the XY location of the probe relative to the part XY zero. I modified the code to get the XY locations if the tool is Tool 0. Then if the tool is some other tool then Zero it would load the XY coordinates and position the cutter over the probe.
It seems like the Variables that i am using get zeroed out when I run the program for Tool 0 and then for some other Tool Number. This actually makes sense to me.
So my question is how do I store this XY location? Do I use a work offset or is there another way to store a variable so that it can be used when the program is run again?
Here is the code: (Xpostion and Yposition are the variables)
Zmove = 1.5
Zpos = GetDRO(2)
Tool = GetDRO (24)
Dim Xposition As Integer
Dim Yposition As Integer
ZOffset = GetVar (1000)
If Tool = 0 Then
Response = MsgBox ("Is the X and Y Located over the probe?", 4 , "Set up offset")
If (Response = 6) Then ' Yes
Response = MsgBox ("Did you zero off the part First?", 4 , "Set up offset")
If (Response = 6) Then ' Yes
Xposition = GetVar(2000)
Yposition = GetVar(2001)
ZPos = Zpos - ZMove
Code "G31 Z" & ZPos & " F20.0"
While IsMoving()
Wend
Zpos = GetVar(2002)
Call SetVar (1000,ZPos)
Else
MsgBox "Set zero on the top of the part and run again"
End If
Else
MsgBox "Position X and Y over probe"
End If
Else
Response = MsgBox ("Is there enough Z height to move to probe?", 4 , "Set up offset")
If (Response = 6) Then ' Yes
Else
Code "G00 Z" & (Zpos + 2.0)
End If
Code "G00 X" & Xposition
Code "G00 Y" & Yposition
OldZpos = Zpos
ZPos = Zpos - ZMove
Code "G31 Z" & ZPos & " F20.0"
While IsMoving()
Wend
Zpos = GetVar (2002)
Code "G00 Z" & Zpos
TIA
Dan