Requires: VI Scripting
You navigate from a wire to a node any time that you use a wire reference to obtain a reference to a node that it connects to. Navigating from a wire to a connected node is a navigation subtask that you can combine with other navigation subtasks to accomplish larger navigation goals. Refer to navigation overview to learn more about how navigating from a wire to a node interacts with other navigation tasks.
This VI Scripting task requires the following objects:
|Wire:Terminals||Index Array||Terminal:Owner||Close Reference|
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. Note that this example also illustrates the procedure for navigating from a node to a wire.
Expand the procedure for more information about this specific example.
When navigating from a wire to a node, you most commonly obtain the wire reference as the result of previous navigation.
In the example, the scripting VI obtains the initial wire reference by navigating from the One Button Dialog function to the wire connected to the button name input of that function.
In some navigation tasks, you might be interested in only one terminal of the wire. In other navigation tasks, you might be interested in inspecting or navigating across all the terminals of the wire.
In the example, the scripting VI requires only the source terminal of the wire.
The first element in the Terminals array is always a reference to the source terminal of the wire. If the wire connects only two terminals, the second element in the array is a reference to the sink terminal of the wire. If the wire has multiple sink terminals, the array stores them in random order beginning at index 1 of the array.
When a wire has multiple sink terminals, you can use a For Loop to iterate across each terminal reference in the array. Repeat step 5 for each terminal reference.
In the example, the scripting VI requires a reference only to the source terminal of the wire. Because the source terminal is always stored at the beginning of the Terminals array of a wire, the scripting VI uses the Index Array function to obtain a reference to the terminal at index 0 of the Terminals array.
In the example, the scripting VI can modify the returned node only if it is a string constant. Thus, the scripting VI tries to cast the reference to a string constant. The Case structure determines whether the To More Specific Class function returns an error and therefore whether the referenced object is a string constant.
In the example, the scripting VI edits the node rather than using it to continue navigating. The scripting VI sets the value of the node, a string constant, to Okay! by using the StringConstant:Value property.
Refer to the Navigation Overview VI in the labview\examples\VIScripting\Application Control\VI Scripting\Finding and Modifying Objects directory for a complete navigation example that includes navigating from a node to a wire.