Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: TonyMemphis on May 18, 2020, 11:29:56 PM

Title: Cycle Time Display
Post by: TonyMemphis on May 18, 2020, 11:29:56 PM
I'm using the Avid set...  There is a text box that displays the cycle time.  I managed to find the function in the PLC script that sets the value there if the machEnabled variable is 1.  My issue is that I want to see the cycle time when after the G code is complete, but the value is set to zero before I can see it.  The script only changes the value is the machine is enabled.  I can't figure out how the value gets changed back to zero?  The text box has an event set "On Update Script," but I'm not sure what that means and I can't find it mentioned anywhere. 

If I can figure this out, I may have a text box display the last cycle time and a double click event to clear it to zero or something like that. 

I wish there was some better documentation of this stuff.  I have searched and looked at the help file before I bothered asking.  I appreciate the help.

Any ideas? 

Tony
Title: Re: Cycle Time Display
Post by: bcoop on May 19, 2020, 09:54:31 AM
Tony, on my system, the cycletime textbox maintains the value until i initate a reset or rewind the gcode
has there been any mods to the code ?
can you post your code for the cycletime from the plc script

Code: [Select]
-------------------------------------------------------
--  Cycle time label update
-------------------------------------------------------
--Requires a static text box named "CycleTime" on the screen
if (machEnabled == 1) then
local cycletime = mc.mcCntlGetRunTime(inst, time)
scr.SetProperty("CycleTime", "Label", SecondsToTime(cycletime))
end
Title: Re: Cycle Time Display
Post by: TonyMemphis on May 19, 2020, 10:10:39 PM
Thanks.  My script looks the same.  On my system, when the Gcode is finished, it is rewound and the cycle time is changed to 00:00:00.0.

 I played around with it today.  What I ended up doing is a little crude, but it is working.  In the PLC script, I check to see if the MachEnable variable has changed value.  I added a text box called TonyTime.  If the MachEnable is 1 and the value of the CycleTime label is NOT 00.:00:00.0, then I set the  Label of TonyTime to the same as the CycleTime Label value (I use a variable).  I then added a button that resets TonyTime to 00...   Seems to work. 

I looked at my Gcode files.  I use Vcarve Pro, btw.  There is an M30 at the end which I think does the End and rewind? 

Sorry, I don't have the code on this PC.  Its on the laptop in the shop.   



Tony
Title: Re: Cycle Time Display
Post by: bcoop on May 20, 2020, 08:14:24 AM
well i think you found the issue, the M30 initiate a rewind , not sure where in mach that it resets the cycle time but it does. 
you came up with a good fix for the issue.
Title: Re: Cycle Time Display
Post by: Bill_O on August 04, 2020, 09:25:53 AM
Here is a simple fix to the plc in mach to keep the time until you click on cycle start again.

Code: [Select]
-------------------------------------------------------
--  Cycle time label update
-------------------------------------------------------
--Requires a static text box named "CycleTime" on the screen
if (machEnabled == 1) then
local running = mc.mcCntlIsInCycle(inst)
if (running == 1) then
local cycletime = mc.mcCntlGetRunTime(inst, time)
scr.SetProperty("CycleTime", "Label", SecondsToTime(cycletime))
end
end

Title: Re: Cycle Time Display
Post by: bcoop on August 09, 2020, 08:53:53 PM
Thanks Bill, I will have to try that one out.

Bob