From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Create Cluster (Scripting) Using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

This VI will create a cluster out of selected controls in the user VI

 

Description

Scripting in LabVIEW gives you an access to a great deal of options for controlling and modifying LabVIEW code. VI Scripting enables users to write a LabVIEW program that can generate and inspect LabVIEW code. It exposes many additional VI Server classes, properties, and methods. It allows you to create new VIs, Front Panel controls, Block Diagram objects and wires as well as traverse diagram object hierarchies and modify code. In this example, a given script will take all the user VI selected controls and bundle them into a cluster. The user need to make sure to select the controls he wants clustered, while specifying the VI he is currently editing, so that the script knows which VI to reference.

For more information on scripting see the Developer Zone Community: LabVIEW Scripting.

 

Requirements

LabVIEW Full Development System 2012 or compatible

  

Steps to Implement or Execute Code

  1. Select the controls you want clustered
  2. Specify the VI you are currently editing by providing VI Path
  3. Run the VI

 

Additional Information or References

VI Block Diagram

Create Cluster BD 1.jpg

 

Create Cluster BD 2.jpg

In order to create your own scripts, start here.

 

**This document has been updated to meet the current required format for the NI Code Exchange. **

 

Regards,
Dan King

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.