Table Of Contents

Creating a Command VI Plugin

    Last Modified: April 15, 2020

    Use Command VIs to insert custom menu items in the LabVIEW NXG editor.

    Before you begin, ensure that the LabVIEW NXG Editor Plugin Authoring Tools package is installed.
    1. Create or open a project.
    2. Click File» New» Application and select Editor Plugin as the application sub-type. This application type is required for all VI Editor Plugins. Command VIs created outside of an application with the Editor Plugin sub-type will not function correctly.
    3. In the Application document, click New» Command VI .
    4. Open the Menu view of the Command VI and fill out the following fields:
      • Location — Specifies where in the editor you want your menu items to appear.
      • Label — Specifies the name of the menu item.
      • Submenus — Specifies the submenu you want your menu item to be grouped under.

        Use backslashes to add additional levels of submenus. For example: Submenu1/Submenu2/Test.

      • Weight — Specifies the relative position of the menu item compared to other items in the Add-ons menu or submenu. The weight value must be a number between 0 and 1, where lower numbers indicate a higher position in the menu. It may be helpful to think of it as menu items with a lower weight floating to the top.
    5. Configure the panel and diagram of the Command VI to add the functionality you want to execute when a user selects the menu item.

      Command VIs cannot be inline or recursive but they can include subVIs that are. Additionally, by default, Command VI panels do not appear when a user selects them as a menu item. To show a panel when the menu item is selected, include the following code in your Command VIs.

    6. Click New» Package/Installer to create a new Package (.lvdist) document.
    7. Configure the package document.
      1. In the Files section, add your application.
      2. Set the Destination to Public Add-ons.
      3. Fill out the rest of the document to suit your application.
    8. Click Build.
    9. Locate and install your package.
    10. Restart LabVIEW NXG when prompted. Your Command VI plugin appears in the location you specified.

      The lifetime of your plugin is linked to the project from which it is launched. If you close the project that was active when you launched the plugin, the plugin terminates at the same time. To uncouple the lifetime of your plugin from the lifetime of the project, build your program into an executable that you can call from a Command VI with the System Exec VI.

    11. Distribute the package or installer to end users for them to install using NI Package Manager.

    Recently Viewed Topics