Added in a parts counter by adding in a increment for the #3901 in the M30 macro then in the PLC script added in a if statement so the count updates.
in M30 function of the M30 macro
local var = mc.mcCntlGetPoundVar(inst, 3901);
mc.mcCntlSetPoundVar(inst, 3901, var + 1);
In PLC script
elseif (inCycle ==0 and machStateOld ~= machstate) then
local var = mc.mcCntlGetPoundVar(inst, 3901);
scr.SetProperty('lblPartsCnt','Label',tostring(var));
end
Glenn