Can you use G53? G53 can send the axis back to home position in machine coordinates. btnRefX just calls mc.mcAxisHome(inst, 0) --0 is the X axis id
G53 X0.0
although, try this instead....it would make me feel better, haha
G53 Z0.0
G53 X0.0
If you must "Re-home" the axis and not just send the axis back to home position (machine coordinates) then you would have to pause the run, execute mc.mcAxisHome(inst,0), then return and restart the run (similar to the m6 Tool Change macro) We can code this so it is automated like you wish. I would just have to work on it....I have an idea, to be continued...