Polymorphic VI

From LabVIEW Wiki
Jump to: navigation, search

Polymorphic VI

A polymorphic VI is a VI without any code but can be used to group several normal VIs into one VI. A developer can choose during edit mode which VI should be executed during runtime.

Usage

A polymorphic VI is used to execute the same operation on different file-types or to return different file types

Selection

Selection of a specific VI can be done automatically based on the data-types connected to the in/output terminals of the VI. To show the manual selector, right-click the polymorphic VI icon an a block diagram, select 'Visible Items\Polymorphic VI Selector'

Configuration

The configuration of a polymorphic VI is done by selecting 'Open Polymorphic VI' after a right click on the icon on a block diagram.

Polymorphic Options.png

In the configuration dialog you can edit the Polymorphic VI, add or remove VIs. Alternatively it is possible to show the icon of the instance instead of the icon of the polymorphic VI. It is possible to let the selection be done automatically. The selector can be shown by default.

Configuration of an instance

By using the 'Edit name...' button on the configuration dialog the following dialog opens:

Polymorphic Edit Instance.png

The 'Menu Name' is shown in the selector after an instance is selected. The 'Polymorphic VI Selector Name' you can alter the menu shown by the VI selector. Levels can be made by using a colon (:) as separator.

Limitations

  • All VIs of a polymorphic VI must have the same Connector Pane pattern, or the Polymorphic VI will be broken.
  • Using the polymorphic VI will load all VIs into memory.