Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: bitviper on February 20, 2015, 07:17:47 PM

Title: Save current tool position so I can come back to it?
Post 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?
Title: Re: Save current tool position so I can come back to it?
Post by: Overloaded on February 20, 2015, 07:25:29 PM
There is  "Remember" and "Return" that might be what you want.
OEM 286 & 285 that you could build into a button script.
Russ
Title: Re: Save current tool position so I can come back to it?
Post by: bitviper on February 20, 2015, 07:27:02 PM
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?
Title: Re: Save current tool position so I can come back to it?
Post by: Overloaded on February 20, 2015, 07:29:07 PM
Sure, could be done in a macro, then called with M****
Title: Re: Save current tool position so I can come back to it?
Post by: bitviper on February 20, 2015, 07:30:34 PM
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.
Title: Re: Save current tool position so I can come back to it?
Post by: Overloaded on February 20, 2015, 07:30:54 PM
or, how bout a subroutine, then a return ?
Title: Re: Save current tool position so I can come back to it?
Post by: bitviper on February 20, 2015, 07:31:48 PM
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.
Title: Re: Save current tool position so I can come back to it?
Post by: ger21 on February 20, 2015, 07:51:57 PM
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

Title: Re: Save current tool position so I can come back to it?
Post by: bitviper on February 20, 2015, 07:54:29 PM
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.
Title: Re: Save current tool position so I can come back to it?
Post by: ger21 on February 20, 2015, 07:58:42 PM
They need to go into an M code macro. I was assuming that's where you're "routine" was.
Title: Re: Save current tool position so I can come back to it?
Post by: Overloaded on February 20, 2015, 08:08:09 PM
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)