Hello Guest it is April 17, 2024, 11:29:20 PM

Author Topic: GetVar(2002)  (Read 7004 times)

0 Members and 1 Guest are viewing this topic.

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: GetVar(2002)
« Reply #10 on: October 22, 2014, 07:30:18 AM »
post your macro

Offline amnon

*
  •  40 40
    • View Profile
Re: GetVar(2002)
« Reply #11 on: October 22, 2014, 12:13:03 PM »
Code: [Select]
code "g90"

ChX = GetUserDRO( 1200 )
ChY = GetUserDRO( 1201 )
ChZ = GetUserDRO( 1202 )
Feed = GetDRO(18)

Code "G53 G00 Z-0.1" 'Move the tool all the way up
Code "G53 G00 X" & ChX & "Y" & ChY 'Move to the probe position
While IsMoving()
Wend

Code "G31 Z" & Z-100 & "f100" 'Z move down untill hit

While IsMoving()
Wend

ZposOld = GetVar(2002) 'Get the Position that the Porbe hit at
Code "G53 G00 Z-0.1"'Z move all way up

While IsMoving()
Wend

MsgBox ("Insert the new tool")
MsgBox ("Ok to finish tool change")

Code "G53 G00 Z-0.1" 'Move the tool all the way up
Code "G53 G00 X" & ChX & "Y" & ChY 'Move to the probe position

While IsMoving()
Wend

Code "G53 G00 X" & ChX & "Y" & ChY 'Move to the probe position

Code "G31 Z" & Z-100 & "f100" 'Z move down untill hit

While IsMoving()
Wend

ZposNew = GetVar(2002) 'Get the Position that the Porbe hit at
Offs = ZposOld - ZposNew

Call setdro (2,Offs)   'Set the value of the DRO to the value that is in "Offs"
Code "G53 G00 Z-0.1"   'or hoever high you want to go to get up safely off the probe

MsgBox ("Ok to return to program")


Code "G00 x0 y0"


My intention is to understand step by step what is going on in each line, and make my own macro.
I change tools manually - Kress, and my tool height measurement is in the same location, so I have to measure each tool twice to calculate difference.
Maybe there is a easier way to do this?

Respect
Amnon

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: GetVar(2002)
« Reply #12 on: October 22, 2014, 02:50:24 PM »
your original post asked about MsgBox ZProbePos always printing 0

Not only is there no call to MsgBox in this code there is also no variable called ZProbePos