Hello Guest it is April 18, 2024, 09:42:09 PM

Author Topic: Added a Part Runtime to file ops tab  (Read 4414 times)

0 Members and 1 Guest are viewing this topic.

Added a Part Runtime to file ops tab
« on: August 04, 2014, 08:30:00 PM »
Add this code to PLC script.
Code: [Select]
if (inCycle == 1) then 
    local s  = mc.mcCtrlGetRunTime(inst)/10;
    local time = string.format("%.2d:%.2d:%.2d", s/3600, s/60%60, s%60);
    scr.SetProperty('lblTime','Label',  tostring(time));
end
Then add this code to the reset button so it zero's out on a reset.
Code: [Select]
scr.SetProperty('lblTime','Label',  "00:00:00");

You will need a label on the screen so you have a place to put the text.
I copied the text just above it then just added a label for the time value.
I plan on looking to see how the M30 gets processed so I can add a parts counter and accumulated time of all the parts.

Glenn
Re: Added a Part Runtime to file ops tab
« Reply #1 on: August 01, 2015, 01:32:54 PM »
great keep us posted... am wanting to add the same featurs but I'm having a lot of trouble figuring out Lua.
Hit the e-stop! Hit the e-stop!
Re: Added a Part Runtime to file ops tab
« Reply #2 on: March 13, 2016, 09:43:51 AM »
Hi,
Sorry that i have to reopen this topic, but i don´t get the Runtime Counter to work :( i have added the scripts to the PLC and the Reset button as above mentioned.
But how do i get the Readings to the Textbox? I don´t have any knowledge in Programming.