Hello Guest it is May 25, 2019, 08:03:54 AM

Author Topic: Tool Probe XY Positioning  (Read 2827 times)

0 Members and 1 Guest are viewing this topic.

Tool Probe XY Positioning
« on: April 19, 2008, 10:46:14 PM »
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

Offline jimpinder

*
  •  1,233 1,233
  • Wakefield, West Yorks, UK
    • View Profile
Re: Tool Probe XY Positioning
« Reply #1 on: April 20, 2008, 04:34:21 AM »
If you set up a couple of User DRO's and call them temp tool pos X and Y or something similar, and put them on the screen, and have the Vis Basic post data to them, they are persistant, even when Mach 3 is turned off.

I have several on my front screen - all to do with Macro turning routines that I can call up. They are persistant if I enter the data from the keyboard, so I can't see any reason why the wouldn't be when fed from Vis Basic.

It will also be re-assuring to see that the data is still there.
Not me driving the engine - I'm better looking.