Hi,
I'm not capable with your method.
But I have some news .. !!
I did it, it's improvable, but it works!
if I can make improvements I warn you!
in any case, I thank you as always for your help!
--Remember Position
RememberPosition()
--One way
local inst = mc.mcGetInstance() -- Get the instance of Mach4
local xset = mc.mcAxisGetMachinePos(inst, 0) -- Get current Machine Coordinates
-- local yset = mc.mcAxisGetMachinePos(inst, 1) -- Get current Machine Coordinates
local zset = mc.mcAxisGetMachinePos(inst, 2) -- Get current Machine Coordinates
xval = tostring(xset)
-- yval = tostring(yset)
zval = tostring(zset)
mc.mcProfileWriteString(inst, "RememberPos", "XRemem", xval) --Create a register and write the machine coordinates to it
-- mc.mcProfileWriteString(inst, "RememberPos", "YRemem", yval) --Create a register and write the machine coordinates to it
mc.mcProfileWriteString(inst, "RememberPos", "ZRemem", zval) --Create a register and write the machine coordinates to it
-- Return To Position
ReturnToPosition()
local inst = mc.mcGetInstance() -- Get the instance of Mach4
local xrememval = mc.mcProfileGetString(inst, "RememberPos", "XRemem", "NotFound") -- Get the register Value
--local yrememval = mc.mcProfileGetString(inst, "RememberPos", "YRemem", "NotFound") -- Get the register Value
local zrememval = mc.mcProfileGetString(inst, "RememberPos", "ZRemem", "NotFound") -- Get the register Value
mc.mcCntlMdiExecute(inst, "G00 G53 Z0.0000 \n G00 G53 X" .. xrememval .. "\n G00 G53 Y" .. yrememval .. "\n G00 G53 Z" .. zrememval)