Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: bitviper on February 20, 2015, 07:17:47 PM
-
I'd like to be able to call a routine that moves the mill somewhere and then, when the routine is done, I'd like the mill to return to where it was before the routine was called. Is that possible?
-
There is "Remember" and "Return" that might be what you want.
OEM 286 & 285 that you could build into a button script.
Russ
-
Ah - thanks for the reply but I want to do it automatically in my code. The routine is called many times and I'd have to hang around throughout the job to press that button.
No way to do this in code?
-
Sure, could be done in a macro, then called with M****
-
Ok. I'll look into how to use OEM codes in gcode. Will report back here when I figure it out and have working code.
-
or, how bout a subroutine, then a return ?
-
I do use a subroutine already and it returns to the main program when it is done. Trouble is, the tool doesn't automatically return to where it was before the routine was called.
-
SetVar(1, GetOEMDRO(800))
SetVar(2, GetOEMDRO(801))
SetVar(3, GetOEMDRO(802))
Do Stuff Here
Code "G0 Z" & GetVar(3) ' Move to Previous Z Position
Code "G0 X" & GetVar(1) & " Y" & GetVar(2) ' Move to Previous XY Position
-
Thanks. Are those lines going into my gcode file or in something else? I'm doing a lot of hunting regarding these OEM codes and they refer to VB scripting but I haven't found yet how that relates to the gcode file.
-
They need to go into an M code macro. I was assuming that's where you're "routine" was.
-
Maybe if your routine is in a SUB, use 2 macros.
M111 just before the SUB, then M112 right after the M99 return call.
(thanks to Gerry)