Hello guys, i am working on this code, for my custom build height presseter. The hardware is good, i checked everything.
But, the macro is producing different results than i would expect, first.. i thought that with G31 the probe would stop when
it hits the copper circle i have connected with a wire, but it doesn't, it's working like a G1, nothing different.
I'll put the code below
Dim preset(2)
preset(0) = -294.4045 'X
preset(1) = -16.6935 'Y
preset(2) = -279 'Z
Dim preset_feed As Integer
preset_feed = 4000
Dim safe_z As Integer
safe_z = -150
If IsSafeZ() Then
SetSafeZ(safe_z)
Else
Call MsgBox("SafeZ desabilitado" & Chr(10) & "Programa será parado", 0, "Alerta")
DoOEMButton(1003)
Exit Sub
End If
Call Preset_Tool()
Function Preset_Tool()
GotoSafeZ()
Code("G53 G0 X" & preset(0) & "Y" & preset(1))
While IsMoving()
Sleep(100)
Wend
Code("G31 Z" & preset(2) & "F" & preset_feed)
While IsMoving()
Sleep(100)
Wend
Dim presseted_tool_z As Double
presseted_tool_z = GetVar(2002)
SetToolParam(1, 2, presseted_tool_z)
GotoSafeZ()
While IsMoving()
Sleep(100)
Wend
End Function
Can anyone point me what i am doing wrong ?