Greetings,
I am running 3 machines in my shop with csmio products. And I would like to implement auto tool zero on my machines.
Currently, I am using win10, the most stable Mach3 version recommended on the CSLAB website.
Yesterday I tried to implement the tool length sensor on one of them. But as soon as the tool touches the probe I get this error:
Error on line 107 - Internal error <WaitForMove>
If i rune the HiddenScript.m1s-mach3 VB script editor and set the run command I get the hit probe ok and the value. But as soon as I close the window and push the button auto tool zero I get the error above. Can somebody tell me what I'm doing wrong?
here is the code that I'm using from cs lab website.
' Auto tool length - CS-Lab s.c.
' v1.2
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 = 40 ' Sensor/Table offset
Z_SAFE = -65 ' Safe Z above sensor (for rapid move)
SENS_X = -0.900 ' Sensor X position
SENS_Y = 37.500 ' Sensor Y position
MAX_DTRAVEL = 140 ' Max down travel
SPD_FAST = 800
SPD_FINE = 100 ' Fast and fine speeds
Z_LIFT = 1.5 ' Z lift for fine probing
Z_PARK = 0 ' Park after probe (absolute Z position)
' -----------------------------------------------------
Message( "Tool length probing started." )
' turn off machine coordinates (mach bug)
If GetOEMLed(16) Then
DoOEMButton(256)
End If
' check axes for reference
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
' Probe signal should be inactive before starting probing
If GetOEMLed(825) Then
Message( "TC ERROR: Probe input is active! Probing failed." )
End
End If
' Check spindle
If GetOEMLed(11) Then
Message( "TC ERROR: Turn off spindle for probing. Probing failed." )
End
End If
Tool = GetDRO(24) ' Get current tool index
' Tool 0 can't be probed
If(Tool = 0) Then
Message( "TC INFO: Tool '0' can't be probed." )
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)
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
Code("G0G53 Z" & Z_PARK)
WaitForMove
ZABS = ZBOTTOM + ZOFFSET
ToolLen = ZABS - SENS_Z
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
Thanks in advance.
best regards
