I've been working on the same thing this week. Here is my version. Runs from a button.
'Code to test gcode travel limits
'John Champlain - June 20, 2010
'
' Save current XYZ positions
CurrX = GetDRO(0)
CurrY = GetDRO(1)
CurrZ = GetDRO(2)
CurrFeed = GetOemDRO(818)
SafeZ = GetOEMDRO(54)
'
'
Dim Msg, Num ' Declare variables.
Title$ = "Check Extents"
Prompt$ = "Enter Feedrate"
Default$ = ""
x% = 75
Y% =200
Num$ = InputBox(Prompt$, Title$, Default$,X%,Y%) ' Get user input.
'
' Get gcode travel limits
XMin = GetOEMDRO (4)
XMax = GetOEMDRO(10)
YMin = GetOEMDRO(5)
YMax = GetOEMDRO(11)
' Test travel limits
' Move one axis at a time
'
Code "F" & num ' set feedrate
'
'
Code "G1 Z" & SafeZ 'move Z to safe height
While IsMoving ()
Wend
Code "G1 X" & XMin & "Y" & YMin 'move to minimum XY position
While IsMoving ()
Wend
Code "G1 Y" & YMax 'move to maximum Y position
While IsMoving ()
Wend
Code "G1 X" & XMax 'move to maximum X position
While IsMoving ()
Wend
Code "G1 Y" & YMin 'move to minimum Y position
While IsMoving ()
Wend
Code "G1 X" & XMin 'move to minimum X position
While IsMoving ()
Wend
'
' Reset to original settings
Code "G1 X" & CurrX & "Y" & CurrY 'reset X
While IsMoving ()
Wend
Code "G1 Z" & CurrZ 'reset Z
While IsMoving ()
Wend
Code "F" & CurrFeed
Code "(Done)"
Regards All,
John Champlain