Another possible approach is to use the CmachingReport.GetMachiningReports method. It returns an ArrayList of the CMachining class, which has a property called transaction time. This is a cumulative timer representing the actual time from start to finish each time the program starts.
You can calculate the average cycle time for a specific program by dividing TimeTime by the NumberOfWork property. Performing this method will give you some flexibility in case the application is not running or you do not want to poll.
source share