This topic requires a thorough understanding of process models and how you use them.

Applications typically display the entry points the process model defines as menu items or buttons the user can select.

Obtaining the Process Model Sequence File

Complete the following steps to first obtain the process model sequence file to determine which process model entry points apply to a given situation.

  1. If you are displaying an execution, call the Execution.GetSequenceFile method of the execution and then call the SequenceFile.GetModelSequenceFile method on the sequence file the Execution.GetSequenceFile method returns.

    If the SequenceFile.GetModelSequenceFile method returns a NULL reference, continue to step 3. The sequence file the Execution.GetSequenceFile method returns is the client sequence file.

  2. If you are displaying a sequence file, call the SequenceFile.GetModelSequenceFile method on the sequence file.

    If the SequenceFile.GetModelSequenceFile method returns a NULL reference, continue to step 3. The sequence file you display is the client sequence file.

  3. If you are not displaying a sequence file or an execution, or if the execution or sequence file does not specify a model sequence file, call the Engine.GetStationModelSequenceFile method.

    If the Engine.GetStationModelSequenceFile method returns a NULL reference, no model sequence file currently applies. Otherwise, the Engine.GetStationModelSequenceFile method returns the applicable model sequence file. In this case, no client sequence file exists.

Obtaining the Applicable Entry Point Sequences

If no model sequence file applies to the current context in the user interface, no entry points currently apply. If a model sequence file does apply, you can determine which, if any, sequences in the file are entry points and whether they apply by enumerating all the sequences in the model sequence file. First, obtain the number of sequences from the SequenceFile.NumSequences property of the model sequence file. Then, obtain each individual sequence using the SequenceFile.GetSequence method. To obtain each sequence, pass indices 0 through (NumSequences – 1). Complete the following steps to determine if each sequence is an applicable entry point.

  1. Is the Type property of the sequence equal to the value of the SeqType_CfgEntryPoint enumeration? If so, continue to step 5. If not, continue to step 2.
  2. Is the Type property of the sequence equal to the value of the SeqType_ExeEntryPoint enumeration? If so, continue to step 3. If not, this sequence is not an applicable entry point.
  3. Did you obtain the model sequence file from a client sequence file? If so, continue to step 4. If not, this sequence is not an applicable entry point. Notice that the latter case applies when you obtain the model sequence file by calling the Engine.GetStationModelSequenceFile method.
  4. Does the client sequence file from which you obtained the model sequence file contain a sequence called MainSequence? If so, continue to step 5. If not, this sequence is not an applicable entry point.
  5. If the Sequence.ShowEntryPointForEditorOnly property is False or the application is a sequence editor, continue to step 6. If the Sequence.ShowEntryPointForEditorOnly property of the sequence is True and the application is not a sequence editor, this sequence is not an applicable entry point.
  6. If the Sequence.ShowEntryPointForExeWindow property of the sequence is True and you are displaying an Execution window, this sequence is an applicable entry point. Add it to the list of entry point sequences. If not, continue to step 7.
  7. If the Sequence.ShowEntryPointForFileWindow property of the sequence is True and you are displaying a sequence file, this sequence is an applicable entry point. Add it to the list of entry point sequences. If not, continue to step 8.
  8. If the Sequence.ShowEntryPointForAllWindows property of the sequence is True, this sequence is an applicable entry point. Add it to the list of entry point sequences. If not, this sequence is not an applicable entry point.

You now have a list of applicable entry point sequences. The next step is to create the menu items and/or command buttons that allow the user to create executions from the entry points.

Creating the Menu Items

When creating an entry point, you must determine which menu or submenu in which to place it. You can place entry points by type, such as putting entry points of the SeqType_CfgEntryPoint type in the Configure menu and entry points of the SeqType_ExeEntryPoint type in the Execute menu, or you can use the Sequence.GetEntryPointMenuFromHint method of the entry point sequence. If the Sequence.GetEntryPointMenuFromHint method cannot find a menu that matches any of the menu hints for the entry point, place the entry point menu item by type.

After you determine the location of the menu item, obtain the string to display for the menu item by calling the Sequence.EvalEntryPointNameExpressionEx method of the entry point sequence. Pass a reference to the client sequence file as the parameter to the method, or pass a NULL reference if no client sequence file exists. Similarly, call the Sequence.EvalEntryPointEnabledExpressionEx method to determine whether to enable the menu item.

Note In addition to checking the value the Sequence.EvalEntryPointEnabledExpression method returns, you might also want to check certain user privileges, such as Priv_Execute or Priv_RunAnySequence.

Executing an Entry Point

Consider the following situations for executing an entry point. If a client sequence file exists, you must first create an EditArgs object by calling the Engine.NewEditArgs method. Use the EditArgs object to specify which TestStand objects the user selects in the application. If the client sequence file is from an execution, call the EditArgs.SetSelectedExecution method of the newly created EditArgs object and pass a reference to the execution. If the client sequence file is from a Sequence File window, call the EditArgs.SetSelectedSequenceFile method and then call the EditArgs.AddSelectedSequence method and the EditArgs.AddSelectedStep method to add any currently selected steps and sequences.

Pass the following parameters as arguments to the Engine.NewExecution method:

Parameter Name What to Pass
sequenceFileParam A reference to the client sequence file, or a NULL reference if no client sequence file exists. Depending on the application development environment you use, pass 0 or the Nothing keyword to indicate a NULL reference.
sequenceNameParam The value of the Sequence.Name property of the entry point sequence.
processModelParam A reference to the model sequence file.
breakAtFirstStep False.
executionTypeMaskParam If the value of the Sequence.EntryPointInitiallyHidden property of the entry point sequence is True, pass the value of the ExecTypeMask_InitiallyHidden constant. Otherwise, pass the ExecTypeMask_Normal constant.
sequenceArgsParam[Optional] Leave this parameter unspecified.
editArgsParam[Optional] Specify this parameter only if a client sequence file exists. Pass a reference to the EditArgs object you create according to the instructions earlier in this section.
InteractiveArgsParam[Optional] Specify this parameter only if you want to create an interactive execution.