Hello Guest it is July 17, 2024, 11:35:36 AM

Author Topic: Using G54-G59 in macro?  (Read 1046 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?

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())
code ("G54")

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

Offline TPS

  •  2,508 2,508
Re: Using G54-G59 in macro?
« Reply #2 on: September 14, 2020, 01:01:38 AM »

Code: [Select]
actwo = GetOEMDro(46)

you can read the actual selected workoffset.

and with:
Code: [Select]

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.