Navigating from a Node to a Wire Using VI Scripting

Requires: VI Scripting

You navigate from a node to a wire any time that you use a reference to a node to obtain a reference to a connected wire. Navigating from a node to a wire is a navigation subtask that you can combine with other navigation subtasks to accomplish larger navigation goals. Refer to the navigation overview to learn more about how navigating from a node to a wire interacts with other navigation tasks.

What to Use

This VI Scripting task requires the following objects:

Node:Terminals[] Visible Terminal Indexes Index Array Terminal:Connected Wire Close Reference
 Add  Find
 Add  Find
 Add  Find
 Add  Find

What to Do

Before you start: Open the Navigating Nodes and Wires VI in the labview\examples\Application Control\VI Scripting\Finding and Modifying Objects directory for an example that illustrates each step of the following procedure.

 Open Example

Expand the procedure for more information about this specific example.

  1. Obtain a reference to a node.

    Example Details

    In the example, the scripting VI uses the Traverse for GObjects VI to obtain references to all the Function nodes in the target VI. The Case structure checks the style of each Function node so that navigation continues only from the Function nodes whose style is One Button Dialog.

  2. Use the Node:Terminals[] property to obtain references to the terminals of the node.

    Example Details

    In the example, the Node:Terminals[] property appears as Function:Terminals[] because the reference is a Function reference. Because Function is a subclass of Node, Function inherits the Terminals[] property of Node.

  3. Refer to the Context Help window of the node to identify the terminal index of the terminal that connects the node to the destination wire.

    You must display additional VI scripting information in the Context Help window to cause the connector pane in the Context Help window to display a bracketed number next to each terminal. This number represents the index in the Terminals[] array where the reference to the corresponding terminal is stored.

    Example Details

    In the example, the scripting VI requires the index of the button name input of the One Button Dialog function. According to the Context Help window for the One Button Dialog function, the index for that input terminal is 1.

  4. Use the Index Array function with the desired terminal index to obtain a reference to the desired terminal in the Terminals[] array.
  5. Use the Terminal:Connected Wire property of the returned terminal reference to obtain a reference to the wire connected to that terminal.
  6. Use the returned wire reference to either modify the wire or to continue navigating.

    Example Details

    In the example, the scripting VI uses the wire reference to continue navigating from a wire to a node by using the Wire:Terminals[] property of the wire.

  7. Use the Close Reference function to close the node reference, the terminal reference, and the wire reference when you are finished using them.

Caveats and Recommendations

Additional Examples

Refer to the Navigation Overview VI in the labview\examples\Application Control\VI Scripting\Finding and Modifying Objects directory for a complete navigation example that includes navigating from a node to a wire and navigating across a structure.

 Open example  Find related examples