371
Mach4 General Discussion / Re: G28,M47 broke ?
« on: May 07, 2014, 11:43:35 AM »
I call them what you like but the #var and #param are stored in registers.. they are all the same sort of.
Thanks
Brian
Thanks
Brian
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
OK Thanks everyone. I have a few nuggets to chew on now.
function HeadUp()
local inst= mc.mcGetInstance();
--Get the hReg handle of the modbus analog register
local HeadUp = mc.mcRegGetHandle(inst, "modbus0/HeadJogDir");
local HeadOn = mc.mcRegGetHandle(inst, "modbus0/HeadJogOn");
if (HeadUp ~= 0 and HeadOn ~= 0) then
mc.mcRegSetValue(HeadUp, 0);
mc.mcRegSetValue(HeadOn, 1);
end
end
local inst= mc.mcGetInstance();
local Hz = 0;
local HzReg = mc.mcRegGetHandle(inst, "modbus0/Hz");
if (HzReg ~= 0) then
Hz = mc.mcRegGetValue(HzReg);
end
--Drop off the current tool
local code = "G0 G53 Z0.0\n"
code = code .. string.format("G0 G53 X%.4f Y%.4f\n", m_changePos[CurrentTool].x + m_X_Pullout, m_changePos[CurrentTool].y + m_Y_Pullout)
code = code .. string.format("G0 G53 Z%.4f\n", m_ZtoolHeight)
code = code .. string.format("G0 G53 X%.4f Y%.4f\n", m_changePos[CurrentTool].x, m_changePos[CurrentTool].y)
mc.mcCntlGcodeExecute(inst, tostring(code))
--Release tool
mc.mcSignalSetState(unclamp, true);--Unclamp
wx.wxSleep(.75)
--Move to new tool
code = string.format("G0 G53 Z%.4f\n", m_ZtoolHeight + m_PullupDist)
code = code .. string.format("G0 G53 X%.4f Y%.4f", m_changePos[NewTool].x, m_changePos[NewTool].y)
code = code .. string.format("G0 G53 Z%.4f", m_ZtoolHeight)
mc.mcCntlGcodeExecute(inst, tostring(code))
--Clamp tool
mc.mcSignalSetState(unclamp, false);--Unclamp
wx.wxSleep(.75)
mc.mcToolSetCurrent(inst, NewTool)
code = string.format("G0 G53 X%.4f Y%.4f", m_changePos[NewTool].x + m_X_Pullout, m_changePos[NewTool].y + m_Y_Pullout)
code = code .. string.format("G0 G53 Z0.0")
mc.mcCntlGcodeExecute(inst, tostring(code))