Hello Guest it is March 29, 2024, 04:00:32 AM

Author Topic: Mach 3 : Screw mapping and auto tool z zero script error.  (Read 609 times)

0 Members and 1 Guest are viewing this topic.

Mach 3 : Screw mapping and auto tool z zero script error.
« on: April 06, 2022, 11:37:45 AM »
Hi everyone,

I want to use screw mapping function on Mach 3, but then I face a problem,when I make a mapped curve for X axis (actually that's the only axis I want to screw map) - auto tool z zero script doesn't work as it should anymore.. In the beginning of auto-zero operation everything is fine -  tool moves to home position and then awkward things starts : when tool starts to go down (z axis) it simultaneously moves x axis away too from its home position (my tool probe is in x/y home position).  Why is this happening? X/Y should stay at home position as it always was, but screw mapping somehow messes things.

Can anybody light a fire for me?

My auto tool z zero script looks like that : Dim ZOFFSET, ZTOP, ZBOTTOM, ZGODOWN, ZABS, ZUPFINE, Z_SAFE
Dim ToolLen
Dim Tool
Dim SENS_Z, SENS_X, SENS_Y, Z_LIFT, Z_PARK, MAX_DTRAVEL
Dim SPD_FAST, SPD_FINE

' -----------------------------------------------------
' Configuration parameters
' -----------------------------------------------------
SENS_Z = -92.95   ' Sensor Z position
Z_SAFE = -30   ' Safe Z above sensor (for rapid move)
SENS_X = 0   ' Sensor X position
SENS_Y = 0   ' Sensor Y position
MAX_DTRAVEL = 400 ' Max down travel
SPD_FAST = 911
SPD_FINE = 200   ' Fast and fine speeds
Z_LIFT = 1.5   ' Z lift for fine probing
Z_PARK = -5    ' Park after probe absolute Z position
' -----------------------------------------------------

Message( "Tool measuring in progress" )
If GetOEMLed(807) Then
Message( "TC ERROR: X Axis not referenced!" )
End
End If
If GetOEMLed(808) Then
Message( "TC ERROR: Y Axis not referenced!" )
End
End If
If GetOEMLed(809) Then
Message( "TC ERROR: Z Axis not referenced!" )
End
End If
If GetOEMLed(825) Then
Message( "TC ERROR: Measuring aborted" )
End
End If
If GetOEMLed(11) Then
Message( "TC ERROR: Turn off spindle" )
End
End If

Tool = GetDRO(24)   ' Get current tool index
' Tool 0 can't be measured
If(Tool = 0) Then
Message( "TC INFO: Tool 0 can't be measured " )
End
End If

WaitForMove
Code("G43T0")
Code("G43H0")    ' turn off tool lenght compensation
WaitForMove

' Move to PARK
Code("G0G53 Z" & Z_PARK)
WaitForMove
' Move to XY position of tool correction sensor
'   Code("G0G53 X" & SENS_X & " Y" & SENS_Y)
Code("G0G53 X" & SENS_X)
Code("G0G53 Y" & SENS_Y)
WaitForMove
' Get actual Z offset
ZOFFSET = GetOEMDRO(49)
' Rapid go down to safe distance above sensor
Code("G0G53 Z" & Z_SAFE)
WaitForMove

' Probe
ZTOP = GetDRO(2) ' actual Z position
ZGODOWN = ZTOP - MAX_DTRAVEL ' max down travel
Code("G31 Z" & ZGODOWN & "f" & SPD_FAST)
WaitForMove
ZUPFINE = GetOEMDRO(85) + Z_LIFT
Code("G1G53 Z" & ZUPFINE & "f" & SPD_FAST) ' go up Z_LIFT
WaitForMove
' fine probe
Code("G31 Z" & ZGODOWN & "f" & SPD_FINE)
WaitForMove
ZBOTTOM = GetVar(2002) 'get probe activation point

' Lift Z to abs park position
Sleep(50)
Code("G0G53 Z" & Z_PARK)
WaitForMove

ZABS = ZBOTTOM + ZOFFSET
ToolLen = -(SENS_Z - ZABS)
WaitForMove
SetOEMDRO(42, ToolLen)
Code("G43T" & Tool)   ' G43 to sync value in system
Code("G43H" & Tool)   ' G43 to sync value in system
WaitForMove
Message ("Z Value : " & ToolLen)
' -----------------------------------------------------------------------------
Sub WaitForMove ()
While IsMoving()
Sleep(15)
Wend
End Sub     
Message( "Not Yet Implemented" )