Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: titchener on June 09, 2014, 11:28:26 PM

Title: Mach3 tool offset problem
Post by: titchener on June 09, 2014, 11:28:26 PM
I'm running Mach 3.042.040 on a 3 axis mill.

I was having a scary situation where sometimes tool offsets I had set weren't getting applied properly and I figured out what is going on.

If you manually use a screen button select to Tool 0 to set its zero reference, tool offsets are turned off as you can see in the Offsets page.

Clicking on the Auto Tool Zero button when another tool is selected by either a button or in a program will then turn Tool Offsets back on.

However if the tool change is selected in the program and offsets are off from previously manually selecting tool 0, they won't be turned back on by the program selection of a tool so a previously set offset for this tool won't be used.

Is this a bug or was it done by design for some reason?

Was it fixed in later Mach versions and is there a more stable Mach 3 version than the one I'm running?
Title: Re: Mach3 tool offset problem
Post by: ger21 on June 10, 2014, 06:45:40 AM
A default Mach3 installation doesn't have any script in the auto zero button, so you must have added one yourself. It would appear that the script you added is causing the issue, if it only happens when you click the auto zero button.
Title: Re: Mach3 tool offset problem
Post by: titchener on June 10, 2014, 01:54:18 PM
Ger21, thanks for the suggestion.

I've looked at my macros and unless I'm missing something I can't figure out how the tool offset is getting turned off when tool 0 is selected manually and the Autozero button is used on it, here's the macros I'm using:

Auto Tool Zero Macro:

' Macro to set tool offset for currently selected tool
' Assumes tool has been touched down on reference height
' Note tool zero has no offset, used to set zero height.
' All offsets are thus calculated relative to length of tool zero.

Tool_Num = GetDRO (24)

GaugeBlockThick = GetOEMDRO(1002)

XDRO = 0
YDRO = 1
ZDRO = 2

While IsMoving ()
Wend

If Tool_Num <> 0 Then

Z_Offset = GetOEMDRO ( 49 )
Axis_Pos = GetOEMDRO(85)
Tool_Offset = Axis_Pos - Z_Offset - GaugeBlockThick
Call setOEMDRO(42, Tool_Offset)

Else

' G92.2 cancels any applied offset mode
Code "G92.2"
Call SetDRO(ZDRO, GaugeBlockThick)

End if


m6Start.m1s

'Macro for changing tools, this one runs first, M6End.m1s then runs after button tool change button push.
'
'User DRO range from OEM codes 1000 to 1245, grid precision uses 1100, change locs use 1200,1201,1202
'This macro moves the machine to the machine coordinate change location first in Z and then in X.

'Dim Msg1, Msg2

tool = GetSelectedTool()

'Msg1 = "Selected Tool = " & Str(tool)
'MsgBox Msg1

currenttool = GetCurrentTool()

'Msg2 = "Current Tool = " & Str(currenttool)
'MsgBox Msg2

If currenttool = tool Then Stop

xorig = GetToolChangeStart( 0 )

yorig = GetToolChangeStart( 1 )

zorig = GetToolChangeStart( 2 )

xchange = GetUserDRO(1200)

ychange = GetUserDRO(1201)

zchange = GetUserDRO(1202)

MoveYonToolChangeLed = 1104

Code "G00 G53 Z" & zchange

While IsMoving ()
Sleep(10)
Wend

' X move taken out for now
' Code "G00 G53 X" & xchange

' Y move
If GetOEMLED (MoveYonToolChangeLed) Then
   Code "G00 G53 Y" & ychange
End If

While IsMoving ()
Sleep(10)
Wend

SetCurrentTool( tool )


m6End.m1s

'Macro for changing tools, this is second M6End.m1s one that runs after button tool change button push.
'
'User DRO range from OEM codes 1000 to 1245, grid precision uses 1100, change locs use 1200,1201,1202
'This macro moves the x and y of the table back to the original position.

xorig = GetToolChangeStart( 0 )

yorig = GetToolChangeStart( 1 )

zorig = GetToolChangeStart( 2 )

MoveYonToolChangeLed = 1104


' X move taken out for now
' Code "G00 X" & xorig
   
' Y move
If GetOEMLED (MoveYonToolChangeLed) Then
   Code "G00 Y" & yorig
End If

While IsMoving ()
Sleep(10)
Wend