So I'm trying to write a simple VB script to home my gantry (CNC plasma). I'm new to Mach and scripting for it, but not new to CNC or programming. I've added a script button to my screenset, name it "Homing Cycle". Here's the sudo logic of what I'd like it to do:
1. Home Z-Axis
2. Set Z machine position (G53) to 1.000
3. Pull off limit switch to Z0 (G53)
4. Home X-Axis (slaved with A, A reversed motion)
5. Set X machine position (G53) to -1.000
6. Pull off limit switch to X0 (G53)
7. Home Y-Axis
8. Set Y machine position (G53) to -1.000
9. Pull off limit switch to Y0 (G53)
Here's my VB. It mostly works, but doesn't execute the "G0 X0" for some reason?
DoButton( 24 ) 'Z Home Axis
While IsMoving()
Wend
SetOEMDRO(802,1)
Code "G0 Z0"
While IsMoving()
Wend
Sleep 1000
RefCombination( 9 ) 'X + A Home
While IsMoving()
Wend
SetOEMDRO(800,-1)
Code "G0 X0"
While IsMoving()
Wend
Sleep 1000
DoButton( 23 ) 'Y Home Axis
While IsMoving()
Wend
SetOEMDRO(801,-1)
Code "G0 X0 Y0"
While IsMoving()
Wend
Sleep 1000
Any help would be great! Thanks very much!