Hello Guest it is May 15, 2021, 02:33:15 PM

Author Topic: Using G54-G59 in macro?  (Read 161 times)

0 Members and 1 Guest are viewing this topic.

Using G54-G59 in macro?
« on: September 13, 2020, 06:06:56 PM »
I have a very simple macro to position my router above the touchplate  that relies on offsets saved in fixture 6 (G59):
Code: [Select]
code ("G59")
code (G0 x0 y0 z0)
code ("G54")
If I type this code manually it works fine. But in the macro the change of fixture offset doesn't seem to get recognized and the machine moves to the origin of the current fixture offset (usually G54). How do I make this work?

Bonus credit - how to a read the save and restore fixture current when the macro starts instead of relying on it's being G54?

Thanks
Re: Using G54-G59 in macro?
« Reply #1 on: September 13, 2020, 06:43:43 PM »
Answered half of my question -
I forgot that the motion code call would return before the move completed, so the offset is reset to G54 before the move completes.
The correct code is
Code: [Select]
code ("G59")
code (G0 x0 y0 z0)
while (IsMoving())
    sleep(100)
wend
code ("G54")

I'd still be interested in learning how to save and restore the current fixture setting.

Offline TPS

*
  •  2,134 2,134
    • View Profile
Re: Using G54-G59 in macro?
« Reply #2 on: September 14, 2020, 01:01:38 AM »
with:

Code: [Select]
actwo = GetOEMDro(46)

you can read the actual selected workoffset.

and with:
Code: [Select]
SetOEMDro(46,actwo)

you can restore it.
« Last Edit: September 14, 2020, 01:04:52 AM by TPS »
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: Using G54-G59 in macro?
« Reply #3 on: September 14, 2020, 09:09:50 AM »
thanks - that's the info I needed.