here we have the X-Center without the debug Windows
'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
Sleep(200)
'get the exact probepos
ProbeXNeg = GetVar(2000)
'clear the probe
Code "G91 X2 F150"
While IsMoving()
Sleep(10)
Wend
Code "G90"
'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
Sleep(200)
'get the exact probepos
ProbeXPos = GetVar(2000)
'clear the probe
Code "G91 X-2 F150"
While IsMoving()
Sleep(10)
Wend
Code "G90"
'goto the center
middle = ProbeXNeg + ((ProbeXPos - ProbeXNeg)/2)
Code "G90 G01 X" + CStr(middle)
While IsMoving()
Sleep(10)
Wend
SetOEMDro(800,0)
End Sub
and the y-Center
'simple Y-center script
Sub Main()
SetOEMDro(801,0)
'do the Y- probe
Message ("probe Y- ")
Code "G31 Y-100 F150"
While IsMoving()
y = GetOEMDRO(801) 'Y actpos
If y <= -100 Then
DoOEMButton(1003) 'Stop too far no probe hit
MsgBox ("Probe Y- canceled , no probe hit!" )
Exit Sub
End If
Wend
Sleep(200)
'get the exact probepos
ProbeYNeg = GetVar(2001)
'clear the probe
Code "G91 Y2 F150"
While IsMoving()
Sleep(10)
Wend
Code "G90"
'do the Y+ probe
Message ("probe Y+ ")
Code "G31 Y200 F150"
While IsMoving()
y = GetOEMDRO(801) 'Y actpos
If y >= 200 Then
DoOEMButton(1003) 'Stop too far no probe hit
MsgBox ("Probe Y+ canceled , no probe hit!" )
Exit Sub
End If
Wend
Sleep(200)
'get the exact probepos
ProbeYPos = GetVar(2001)
'clear the probe
Code "G91 Y-2 F150"
While IsMoving()
Sleep(10)
Wend
Code "G90"
'goto the center
middle = ProbeYNeg + ((ProbeYPos - ProbeYNeg)/2)
Code "G90 G01 Y" + CStr(middle)
While IsMoving()
Sleep(10)
Wend
SetOEMDro(801,0)
End Sub
hope i did everthing right