Here is a snip of a tool changer so you can see how I formatted the strings
--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))
I am going to wait for the sun and look for dust...