import time import win32api import sys sys.path.append('C:\\Program Files (x86)\\BitifEye\\ValiFrame\\MPhy') # Add the location of the Valiframe dll's to the system path import clr # Import the Common Runtime Library Python module clr.AddReference("ValiFrameRemote") # Create a reference from CLR to the ValiFrameRemote DLL clr.AddReference("VFBase") # Create a reference from CLR to the VFBase DLL clr.AddReference("VFSequence") # Create a reference from CLR to the VFSequence DLL clr.AddReference("VFUserInterface") # Create a reference from CLR to the VFUserInterface DLL from BitifEye.ValiFrame.ValiFrameRemote import * # Import the entire ValiFrameRemote namespace from the DLL from BitifEye.ValiFrame.Base import * # Import the entire Base namespace from the DLL from BitifEye.ValiFrame.Sequence import * # Import the entire Sequence namespace from the DLL from BitifEye.ValiFrame.UserInterface import * # Import the entire UserInterface namespace from the DLL from BitifEye.Controls import * # Import the entire Controls namespace from the DLL def my_LogChanged(logentry): pass def my_StatusChanged(source,status): print('Status Changed: ' + status) def my_ProcedureCompleted(procedure,xmlresult): raw_input('Procedure Completed: ' + procedure + ' ' + xmlresult) def my_DialogPopUp(source, args): #args.Dialog.ShowDialog() #Uncomment to show Valiframe dialog box for all cases msgbox = args.DialogText # Definition for args.DialogType #Member name Value Description #Form 0 General Form if the dialog is not one of the other dialog types #MessageBox 1 Standard Windows.Forms.MessageBox. #ConnectionDialog 2 Connection dialog. The dialog which pops up if a connection change is required. #UserInformationDialog 3 User Information Dialog, which contains a text and one button. #UserDecisionDialog 4 User Decision Dialog, which contains one text and 2 buttons. #InfoDialog 5 Info Dialog, which is the same as the UserInformationDialog (obsolete, will be removed in one of the next releases). if args.DialogType == 0: raw_input('General Form Dialog: '+str(msgbox)) # add actions here..... # args.Dialog.ShowDialog() #Uncomment to show dialog box for this case elif args.DialogType == 1: raw_input('Standard Windows.Forms.MessageBox: '+str(msgbox)) # add actions here..... # args.Dialog.ShowDialog() #Uncomment to show dialog box for this case elif args.DialogType == 2: raw_input('Connection Dialog: '+str(msgbox)) # add actions here..... # args.Dialog.ShowDialog() #Uncomment to show dialog box for this case elif args.DialogType == 3: raw_input('UserInformationDialog: '+str(msgbox)) # add actions here..... # args.Dialog.ShowDialog() #Uncomment to show dialog box for this case elif args.DialogType == 4: raw_input('UserDecisionDialog: '+str(msgbox)) # add actions here..... # args.Dialog.ShowDialog() #Uncomment to show dialog box for this case elif args.DialogType == 5: raw_input('InfoDialog: '+str(msgbox)) # add actions here..... # args.Dialog.ShowDialog() #Uncomment to show dialog box for this case else: raw_input('Message not handled: '+str(msgbox)) my_vf_mipi = ValiFrameRemote() # Creates an instance of the ValiFrameRemote class #register event handlers my_vf_mipi.LogChanged += LogChangedEventHandler(my_LogChanged); my_vf_mipi.StatusChanged += StatusChangedEventHandler(my_StatusChanged); my_vf_mipi.ProcedureCompleted += ProcedureCompletedEventHandler(my_ProcedureCompleted); my_vf_mipi.DialogPopUp += DialogShowEventHandler(my_DialogPopUp); my_vf_mipi.InitApplication("MPhy") # Initialize the application my_vf_mipi.LoadProject("my_MIPI3_proj.vfp") # run procedures synchronously results = my_vf_mipi.RunProcedure(5500000) # run procedures asynchronously my_procedure = [5500000] ## define variable for procedures to execute my_vf_mipi.SelectProcedures(my_procedure) my_vf_mipi.StartRun() while True: time.sleep(2) status = my_vf_mipi.GetActualStatus() if status == 'Complete': break # Unregister the event handlers my_vf_mipi.LogChanged -= LogChangedEventHandler(my_LogChanged); my_vf_mipi.StatusChanged -= StatusChangedEventHandler(my_StatusChanged); my_vf_mipi.ProcedureCompleted -= ProcedureCompletedEventHandler(my_ProcedureCompleted); my_vf_mipi.DialogPopUp -= DialogShowEventHandler(my_DialogPopUp); # close object my_vf_mipi.Finalize()