Hi

Does anyone have a script that can set use a probe to set your tool table using a probe. I have been trying for a few days now in creating a script to set the ref tool 0 , using a probe height of 24.07mm , and this works ok when then trying to set tools1 or greater its not working as it should and doing sone very random things. I am new to CNC and mach 3 coding anyhelp would be appreciated as Im tearing my hair out .

Code "(Measuring...)"

If GetOemLed (825) <> 0 Then 'Check to see if the probe is already grounded or faulty

Code "(The Sensor Is Active)"

Else

FeedCurrent = GetOemDRO(818)
FeedMeas=500
FeedFine=50
FeedMove=1600

Tool_Number = GetDRO(24) 'Get the tool number
PlateThickness = GetOEMDRO(GauageHeight ) ' Get the Gauage height offset

Code"G91 G31 Z-200 F" &FeedMeas

While (IsMoving())
sleep (100)
Wend

Code"G91 G0 Z+3 F" &FeedMeas

Code"G91 G31 Z-3 F" &FeedFine

While (IsMoving())
sleep (100)
Wend

If Tool_Number = 0 Then

'Call SetOEMDRO(49,GetOEMDRO(1001))
'MsgBox("PlateThickness =" & PlateThickness)
SetDro(2,PlateThickness )

Else
DoOEMButton(1010)
ZProbePos = GetVar(2002)


Call SetDRO(24,Tool_Number)
Call SetoemDRO(42,ZProbePos - PlateThickness )' if I am using tool2,3 etc it all goes wrong
SetOEMDRO(ZAxisMultiFunctionOEMDRONum,ZProbePos - PlateThickness)
'SetDro(2,ZProbePos - PlateThickness )


End If

Code"G91 G0 Z5 F" &FeedMeas
Code "F" &FeedCurrent 'restore starting feed rate
Code "(Measured Z Done)"
Code"G90"
End If

While (IsMoving())
sleep (500)
Wend