Greetings,
I'm trying to figure out how to automatically set work coordinates to zero after sending the spindle to a specific set of coords after the machine homes by inserting 2 lines in the home all section of ScreenScript.lua.
Ex: Press "Home X Y Z Axis" button --> Machine homes --> moves to some pre-set coordinates --> Zero's X Y Z WORK coordinates.
As you can see I added the following lines:
mc.mcCntlMdiExecute(inst, "G53 X12.4129 Y433.9433") -- This line works
mc.mcCntlMdiExecute(inst, "G92 X0 Y0") --This line doesn't work
G53 works as expected but G92 does not and the XYZ work coordinates do not change to zero.
If I run the G53 and G92 commands directly in the MDI window they both work as expected.
Any ideas why and how I can get this to work?
Thanks!
---------------------------------------------------------------
-- Ref All Home() function.
---------------------------------------------------------------
function RefAllHome()
local inst = mc.mcGetInstance("Screen load script, RefAllHome()")
local valEnable = mc.mcProfileGetInt(inst, "AvidCNC_Profile", "iConfigEnableSoftLimitsAfterHomed", 1)
local valSimHome = mc.mcProfileGetInt(inst, "AvidCNC_Profile", "iConfigHomeXYSimultaneously", 0)
local valCustomHoming = mc.mcProfileGetInt(inst, "AvidCNC_Profile", "iConfigCustHomingEnabled", 0)
local msg = ""
mc.mcAxisDerefAll(inst) --Just to turn off all ref leds
mc.mcAxisHomeAll(inst)
coroutine.yield() --yield coroutine so we can do the following after motion stops
if (valEnable == 1) then
pf.EnableSoftLimits()
msg = "Homing of machine is complete. Soft limits will now be enabled."
else
msg = "Homing of machine is complete."
end
wx.wxMessageBox(msg, "Homing")
mc.mcCntlMdiExecute(inst, "G53 X12.4129 Y433.9433")
mc.mcCntlMdiExecute(inst, "G92 X0 Y0")
end