here a simple sxript for X
'simple X-center script
Sub Main()
SetOEMDro(800,0)
'do the X- probe
Message ("probe X- ")
Code "G31 X-100 F150"
While IsMoving()
x = GetOEMDRO(800) 'X actpos
If x <= -100 Then
DoOEMButton(1003) 'Stop too far no probe hit
MsgBox ("Probe X- canceled , no probe hit!" )
Exit Sub
End If
Wend
'get the exact probepos
ProbeX- = GetVar(2000)
'do the X+ probe
Message ("probe X+ ")
Code "G31 X200 F150"
While IsMoving()
x = GetOEMDRO(800) 'X actpos
If x >= 200 Then
DoOEMButton(1003) 'Stop too far no probe hit
MsgBox ("Probe X+ canceled , no probe hit!" )
Exit Sub
End If
Wend
'get the exact probepos
ProbeX+ = GetVar(2000)
'goto the center
middle = ProbeX- + ((ProbeX+ - ProbeX-)/2)
Code "G90 G01 Y" + CStr(middle)
SetOEMDro(800,0)
End Sub
be careful, not tested, just written down.
z-axis has to be in probe hight.