Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

Anatomy of a VI and Common VI Objects

LabVIEW 2013 Help

Edition Date: June 2013

Part Number: 371361K-01

»View Product Info

In order to create or modify a VI using VI Scripting, you must understand how the objects that compose a VI relate both to the VI Server class hierarchy and to nearby objects. This topic presents the following three essential types of information about several common VI objects in order to facilitate a variety of use cases.

  • The Anatomy of VIs and Common VI Objects
    The images in this topic illustrate different types of objects that you can manipulate with VI Scripting as well as some of their parts and interrelationships. For example, a For Loop is a common VI object that contains many parts. If you want to create a new wire that enters a For Loop, you must interact with several of these parts: the loop itself, a loop tunnel, and the outer and inner terminals of the loop tunnel. By exploring the anatomies of a For Loop and other common VI objects, you can identify all the object elements that a specific scripting action might touch.

  • The VI Server Class of Common VI Objects
    Several scripting functions require you to specify the class of the object with which you want to interact. The Class Hierarchy column of each anatomy table in this topic provides the class information for the objects within the associated diagram. Use a class specifier constant to pass this information to a function or VI.
    Use the information in the Class Hierarchy column to specify a class in the following tasks:
    • Creating a new object with the New VI Object function
    • Obtaining a reference to a pre-existing object with the Open VI Object Reference function
    • Searching for instances of a specific class of object with the Traverse for GObjects VI
    • Downcasting a reference with the To More Specific Class function
    • Identifying what properties and methods in the VI Server class hierarchy are available for a specific object

  • Properties that Return a Reference to Specific Instances of Common VI Objects
    Some scripting activities require you to use a reference to one object to obtain references to other objects. In these cases, you must know which properties of the original object return the desired references. The Returns the Object Reference column of each anatomy table provides this property information using the notation of Object Type:Property. For example, the ForLoop:Loop Count notation indicates that you are calling the Loop Count property on a reference to a ForLoop object. To do this, you must first obtain a reference to a For Loop. Then you can wire the ForLoop reference to a Property Node and select the Loop Count property for that Property Node.
    Use the information in the Returns the Object Reference columns to obtain the references required in the following tasks:
    • Navigating a VI
    • Editing VIs
    • Creating connections among new VI objects

Block Diagram Anatomy

The following image illustrates several common block diagram objects you can create or modify with VI Scripting.

1 Control/Indicator Terminal 4 Wire 7 SubVI
2 Numeric Constant 5 Increment Function 8 Top Level Diagram
3 Local Variable 6 Compound Arithmetic Function 9 Block Diagram Comment

The following table lists the classes and properties you can use to obtain references to the objects in the previous image.

Class Hierarchy Returns the Object Reference
1 GObject»Terminal»ControlTerminal Control:Terminal, Diagram:All Objects[]
2 GObject»Constant»NumericConstant Diagram:All Objects[]
3 GObject»Node»Local Control:Local Variables[]
4 GObject»Wire Terminal:Connected Wire, Diagram:Wires[]
5 GObject»Node»Function Diagram:Nodes[], Diagram:All Objects[]
6 GObject»Node»GrowableFunction»CompoundArithmetic Diagram:Nodes[], Diagram:All Objects[]
7 GObject»Node»SubVI Diagram:SubVIs[], Diagram:Nodes[], Diagram:All Objects[]
8 GObject»AbstractDiagram»Diagram»TopLevelDiagram VI:Block Diagram
9 GObject»Decoration»Text Diagram:Decorations[], Diagram:All Objects[]

Front Panel Anatomy

The following image illustrates some common front panel objects.

1 Control/Indicator 2 Front Panel

The following table lists the classes and properties you can use to obtain references to the objects in the previous image.

Class Hierarchy Returns the Object Reference
1 GObject»Control»Numeric Panel:Controls[], ControlTerminal:Control
2 GObject»Panel VI:Front Panel

Case Structure Anatomy

The following image illustrates the various objects that compose a Case structure.

1 Terminal 4 Selector Tunnel 7 Case Structure
2 Tunnel 5 Selector Label
3 Inner Terminal 6 Diagram

The following table lists the classes and properties you can use to obtain references to the objects in the previous image.

Class Hierarchy Returns the Object Reference
1 GObject»Terminal»OuterTerminal Tunnel:Outside Terminal
2 GObject»Tunnel Structure:Tunnels[]
3 GObject»Terminal»InnerTerminal Tunnel:Inside Terminals[]
4 GObject»Tunnel»ConditionalTunnel»SelectorTunnel Structure:Tunnels[], CaseStructure:Selector
5 N/A CaseStructure:Frame Names*
6 GObject»AbstractDiagram»Diagram Structure:Diagrams[], MultiFrameStructure:Frames[]
7 GObject»Node»Structure»MultiFrameStructure»CaseStructure Diagram:All Objects[], Diagram:Nodes[]

* LabVIEW does not provide a reference to the selector label in a Case structure. The CaseStructure:Frame Names property returns an array of strings rather than an array of references to the diagrams associated with different cases. You can use these name strings with the CaseStructure:Get Frame Index method to obtain indexes to specific diagrams within the array returned by the MultiFrameStructure:Frames[] property.

The Structures - Case Structure VI demonstrates how to use VI Scripting to access parts of the Case structure anatomy.

For Loop Anatomy

The following image illustrates the various objects that compose a For Loop.

1 For Loop 5 Outer Terminal 9 Left Shift Register
2 Count Terminal (N) 6 Inner Terminal 10 Right Shift Register
3 Terminal (i) 7 Loop Tunnel 11 Diagram
4 Conditional Terminal 8 Auto-indexing Loop Tunnel

The following table lists the classes and properties you can use to obtain references to the objects in the previous image.

Class Hierarchy Returns the Object Reference
1 GObject»Node»Structure»Loop»ForLoop Diagram:All Objects[], Diagram:Nodes[]
2 GObject»Tunnel ForLoop:Loop Count
3 GObject»Terminal Loop:Loop Counter
4 GObject»Terminal ForLoop:Loop End Ref
5 GObject»Terminal»OuterTerminal Tunnel:Outside Terminal
6 GObject»Terminal»InnerTerminal Tunnel:Inside Terminals[]
7 GObject»Tunnel»LoopTunnel Structure:Tunnels[]
8 GObject»Tunnel»LoopTunnel Structure:Tunnels[], LoopTunnel:Index Mode = 1 (for Auto-indexing)
9 GObject»Tunnel»LeftShiftRegister RightShiftRegister:Left Registers[]
10 GObject»Tunnel»RightShiftRegister Loop:Shift Registers[], LeftShiftRegister:Right Shift Register
11 GObject»AbstractDiagram»Diagram Loop:Diagram, Structure:Diagrams[]

The Structures - For Loop VI demonstrates how to use VI Scripting to access parts of the For Loop anatomy.

Flat Sequence Structure Anatomy

Note  In Flat Sequence structures, you can wire out of the structure from one frame and back into the structure through another frame. This type of data flow distinguishes the Flat Sequence structure from other structures, so that all the VI Server classes are different for the Flat Sequence structure.

The following image illustrates the various objects that compose a Flat Sequence structure.

1 Flat Sequence 4 Flat Sequence Outer Tunnel 7 Flat Sequence Inner Tunnel
2 Flat Sequence Frame 5 Flat Sequence Outer Terminal (of Outer Tunnel) 8 Flat Sequence Left Terminal (of Inner Tunnel)
3 Diagram 6 Flat Sequence Inner Terminal (of Outer Tunnel) 9 Flat Sequence Right Terminal (of Inner Tunnel)

The following table lists the classes and properties you can use to obtain references to the objects in the previous image.

Class Hierarchy Returns the Object Reference
1 GObject»FlatSequence Diagram:All Objects[]
2 Generic»FlatSequenceFrame FlatSequence:Frames[], Diagram:Firing Order[], FlatSequenceOuterTunnel:Frame, FlatSequenceInnerTunnel:Left Frame, FlatSequenceInnerTunnel:Right Frame
3 GObject»AbstractDiagram»Diagram FlatSequenceFrame:Diagram
4 GObject»FlatSequenceOuterTunnel FlatSequenceFrame:Outer Tunnels[]
5 GObject»Terminal FlatSequence:Terminals[], FlatSequenceOuterTunnel:Outer Terminal
6 GObject»Terminal FlatSequenceOuterTunnel:Inner Terminal
7 GObject»FlatSequenceInnerTunnel FlatSequenceFrame:Left Side Inner Tunnels[], FlatSequenceFrame:Right Side Inner Tunnels[]
8 GObject»Terminal FlatSequenceInnerTunnel:Left Terminal
9 GObject»Terminal FlatSequenceInnerTunnel:Right Terminal

The Structures - Flat Sequence Structure VI demonstrates how to use VI Scripting to access parts of the Flat Sequence Structure anatomy.

For Additional Information

This topic highlights some of the most common VI objects. For information about objects not addressed here, consult the following resources:

  • Generic:Class Name - Use this property to discover the class name of any VI object. Then find the class name within the VI Server class hierarchy to identify the entire class hierarchy for the object.
  • VI Server Class Hierarchy - If you know the class of a particular object, the VI Server class hierarchy can tell you properties or methods that provide references to other parts of that object.

 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit