hexagon logo

Get the information from the program visible in Command Mode via VB or C#?

I'm specifically interested in the date and time.​


Attached Files
Parents
  • Well, I haven't had a chance to try this myself using a delegate. Here is an example Pseudo code.

    class Program
    {
        // Define the delegate and event
        public delegate void OnReportPrintStartDelegate(PartProgram PartProg, DateTime eventDateTime);
        public event OnReportPrintStartDelegate OnReportPrintStart;
    
        static void Main(string[] args)
        {
            // Your main program code here...
            dynamic App = Activator.CreateInstance(Type.GetTypeFromProgID("Pcdlrn.Application"));
            dynamic PartProg = App.ActivePartProgram;
    
            // Raise the event and pass the current date and time as an argument
            OnReportPrintStart?.Invoke(PartProg, DateTime.Now);
        }
    }​​
    
  • Yes, your correct. I use the ASSIGN/VAR_SYSTEMDATE=STR(SYSTEMDATE("MM/dd/yyyy")) to get the date on the report using a Trace Field. This way the date that the part was measured on will not change when the measurement routine was automatically saved per serial number. When the saved per serial number measurement routine is opened the report date will still show the date that the part was measured on.

    Maybe use the system date and time when an event is triggered.
Reply
  • Yes, your correct. I use the ASSIGN/VAR_SYSTEMDATE=STR(SYSTEMDATE("MM/dd/yyyy")) to get the date on the report using a Trace Field. This way the date that the part was measured on will not change when the measurement routine was automatically saved per serial number. When the saved per serial number measurement routine is opened the report date will still show the date that the part was measured on.

    Maybe use the system date and time when an event is triggered.
Children
No Data