Hi,
Sequence of events.
Mach4 and Controller are started.
Mill is homed.
DRO's are Zeroed.
Mill is move at the Center of X/Y of Table.
This shows Machine Coordinated Table position exactly correct.
When are shut down Mach4 and Controller are restarted.
Now the Current Position DROs shows the machine position values, but the Machine Coordinated DROs are now Zero requiring to rehome the machine every time?
This code is in the Load Screen Script.
What does it do?
It does not appear to store anything in the machine.ini file or the registry at least the one under Diagnostics.
Should the Machine Coordinates be saved each time Mach4 closes down and then be recalled with the code below at startup showing the Machine Coordinates current position?
Please advise.
Regards,
Mauri.
---------------------------------------------------------------
-- Remember Position function.
---------------------------------------------------------------
function RememberPosition()
local pos = mc.mcAxisGetMachinePos(inst, 0) -- Get current X (0) Machine Coordinates
mc.mcProfileWriteString(inst, "RememberPos", "X", string.format (pos)) --Create a register and write the machine coordinates to it
local pos = mc.mcAxisGetMachinePos(inst, 1) -- Get current Y (1) Machine Coordinates
mc.mcProfileWriteString(inst, "RememberPos", "Y", string.format (pos)) --Create a register and write the machine coordinates to it
local pos = mc.mcAxisGetMachinePos(inst, 2) -- Get current Z (2) Machine Coordinates
mc.mcProfileWriteString(inst, "RememberPos", "Z", string.format (pos)) --Create a register and write the machine coordinates to it
end
---------------------------------------------------------------
-- Return to Position function.
---------------------------------------------------------------
function ReturnToPosition()
local xval = mc.mcProfileGetString(inst, "RememberPos", "X", "NotFound") -- Get the register Value
local yval = mc.mcProfileGetString(inst, "RememberPos", "Y", "NotFound") -- Get the register Value
local zval = mc.mcProfileGetString(inst, "RememberPos", "Z", "NotFound") -- Get the register Value
if(xval == "NotFound")then -- check to see if the register is found
wx.wxMessageBox('Register xval does not exist.\nYou must remember a postion before you can return to it.'); -- If the register does not exist tell us in a message box
elseif (yval == "NotFound")then -- check to see if the register is found
wx.wxMessageBox('Register yval does not exist.\nYou must remember a postion before you can return to it.'); -- If the register does not exist tell us in a message box
elseif (zval == "NotFound")then -- check to see if the register is found
wx.wxMessageBox('Register zval does not exist.\nYou must remember a postion before you can return to it.'); -- If the register does not exist tell us in a message box
else
mc.mcCntlMdiExecute(inst, "G00 G53 Z0.0000 \n G00 G53 X" .. xval .. "\n G00 G53 Y" .. yval .. "\n G00 G53 Z" .. zval)
end
end