I was playing around with adding timers to my tool sheet, and created a little script that I put in the plc script (at the end) to show me the what current modes I am in.
I needed to find a way to make sure the Tool timer only tracked cut/feed times. So during a run cycle the history gets updated with the current G codes. Helped me in seeing how gcodes are tracked and used.
local inst = mc.mcGetInstance();
if (inCycle == 1) then
mode1 = mc.mcCtrlGetModalGroup(inst,1,'0')
mc.mcCntlSetLastError(inst, "mode1 = G" .. tostring(mode1));
mode2 = mc.mcCtrlGetModalGroup(inst,2,'0')
mc.mcCntlSetLastError(inst, "mode2 = G" .. tostring(mode2));
mode3 = mc.mcCtrlGetModalGroup(inst,3,'0')
mc.mcCntlSetLastError(inst, "mode3 = G" .. tostring(mode3));
mode4 = mc.mcCtrlGetModalGroup(inst,4,'0')
mc.mcCntlSetLastError(inst, "mode4 = G" .. tostring(mode4));
mode5 = mc.mcCtrlGetModalGroup(inst,5,'0')
mc.mcCntlSetLastError(inst, "mode5 = G" .. tostring(mode5));
mode6 = mc.mcCtrlGetModalGroup(inst,6,'0')
mc.mcCntlSetLastError(inst, "mode6 = G" .. tostring(mode6));
mode7 = mc.mcCtrlGetModalGroup(inst,7,'0')
mc.mcCntlSetLastError(inst, "mode7 = G" .. tostring(mode7));
mode8 = mc.mcCtrlGetModalGroup(inst,8,'0')
mc.mcCntlSetLastError(inst, "mode8 = G" .. tostring(mode8));
mode9 = mc.mcCtrlGetModalGroup(inst,9,'0')
mc.mcCntlSetLastError(inst, "mode9 = G" .. tostring(mode9));
mode10 = mc.mcCtrlGetModalGroup(inst,10,'0')
mc.mcCntlSetLastError(inst, "mode10 = G" .. tostring(mode10));
mode11 = mc.mcCtrlGetModalGroup(inst,11,'0')
mc.mcCntlSetLastError(inst, "mode11 = G" .. tostring(mode11));
mode12 = mc.mcCtrlGetModalGroup(inst,12,'0')
mc.mcCntlSetLastError(inst, "mode12 = G" .. tostring(mode12));
mode13 = mc.mcCtrlGetModalGroup(inst,13,'0')
mc.mcCntlSetLastError(inst, "mode13 = G" .. tostring(mode13));
mode14 = mc.mcCtrlGetModalGroup(inst,14,'0')
mc.mcCntlSetLastError(inst, "mode14 = G" .. tostring(mode14));
mode15 = mc.mcCtrlGetModalGroup(inst,15,'0')
mc.mcCntlSetLastError(inst, "mode15 = G" .. tostring(mode15));
end