Hello Guest it is December 06, 2019, 02:56:58 AM

Author Topic: Z offsets  (Read 1774 times)

0 Members and 1 Guest are viewing this topic.

Z offsets
« on: March 18, 2011, 01:37:26 PM »
I have a setup where I cut a lot of different diameters on my rotary axis.   What I have been trying to do is set up a macro to create Z offsets and I must say I am struggling big time.   I am not sure if I fully understand how offsets work.

Here is a graphic of my set up:



1) I was thinking that the Z home position should be G54 zero.

2) I would then touch off on the probe.

3) I know what the distance is between the rotary center line and the probe (Cline = x).

4) I would then read a userdro where I would have previously entered the radius of the stock material.

5) I would then calculate Zoffset=(Cline - userdro)

6) I would then setvar (5243, Zoffset)

Well I get every number but the one I want.  Somehow it is taking the actual offset from the home position and doing all kinds of weird stuff.

Is this thinking flawed?  How should I do this.  I need Z zero to be the top of the stock

TIA Dan
« Last Edit: March 18, 2011, 01:41:46 PM by dfurlano »
Re: Z offsets
« Reply #1 on: March 18, 2011, 04:05:54 PM »
I figured it out....  I just had to post something to get me motivated.  ;D
Re: Z offsets
« Reply #2 on: March 19, 2011, 04:23:25 PM »
Here is the code if anyone wants it.  This code sends the machine to the home positions which are x-y above the probe and Z zero is all the at the top on my machine.



PlateThickness = GetUserDRO(1151) 'Z-plate thickness DRO

Code "G54"
Code "G90"

DoButton( 24 ) 'home Z
DoButton( 23 ) 'home x
DoButton( 22 ) 'home y
DoButton( 25 ) 'home a

While ismoving()
Sleep 100
Wend

Code "G90 G0 Z-3" 'moves z to just above probe

While ismoving()
Wend

Code "G90 G31 Z-4 F4" 'probing move, can set the feed rate here as well as how far to move

While ismoving()
Wend

ZProbePos = GetVar(2002) 'get the axact point the probe was hit

While ismoving()
Sleep 100
Wend

Code "G90 G0 Z" &ZProbePos 'go back to that point, always a very small amount of overrun

While ismoving()
Sleep 100
Wend

Zoffset = getvar(5223)
Cline = (ZProbePos+-3.1325) '-3.1325 Distance between center line of rotary and probe

SetVar(5243,(Cline+PlateThickness))'Set G55 Z
While ismoving()
Wend
SetVar(5263,(Cline+PlateThickness))'Set G56 Z
While ismoving()
Wend
SetVar(5283,(Cline+PlateThickness))'Set G57 Z
While ismoving()
Wend

Code "G91"
Code "G0 Z 0.1" 'retract

While ismoving()
Sleep 100
Wend

Code "G55"
Code "G90"
While ismoving()
Sleep 100
Wend
Code "G0 X0 Y0"   'move to start position
While ismoving()
Sleep 100
Wend

Code "(Z axis is now zeroed for G55, G56, G57)" 'puts this message in the status bar

Exit Sub