Programmatically Create a LabVIEW Palette

Updated Aug 30, 2024

Environment

Software

  • LabVIEW

This article demonstrates how to programmatically create a LabVIEW palette using libraries and packed libraries.
Refer to the relevant section below depending on the type of library you wish to use.

Programmatically Creating a Palette from a Library

  1. First, you should have a LabVIEW library (.lvlib) that contains the VIs that you wish to include in your LabVIEW palette.
    • It is best practice to create Public and Private Virtual Folders with corresponding Access Scope. VIs stored in the Private Virtual Folder will not be exported to the palette.
    • Your file hierarchy on disk should resemble the hierarchy in the project. See the below image as an example.
Project Hierarchy.PNG
 
  1. Using Windows File Explorer, navigate to C:\Program Files (x86)\ National Instruments\LabVIEW <version>\vi.lib.
  2. Create a folder called Example Palette.
Example Palette.PNG
  1. Create a copy of your library and place it inside Example Palette. You should include the Public and Private folders and all of their contents.
Example Palette library.PNG
  1. Download the attached Installer VI and place it inside your project.
Installer VI.PNG
  1. The VI has the following functionality:
    1. It looks inside C:\Program Files (x86)\ National Instruments\LabVIEW <version>\vi.lib for a folder called Example Palette. Within this folder should be your library.
    2. For each public VI in the library, an item is created in your new palette.
    3. The new palette is given the name Example Palette.
    4. A new ExamplePalette.mnu file is created inside C:\Program Files (x86)\ National Instruments\LabVIEW <version>\menus\Categories\Programming. This path defines where the palette will appear in LabVIEW.
    5. The Write Palette VI is used to create the new palette.
    6. An Invoke Node is used to refresh the palette.

Installer.png
Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.

When you run the VI, a palette called Example Palette will be created in the Programming palette.

Example Palette creation.PNG

 

Programmatically Creating a Palette from a Packed Project Library (PPL)

  1. First, you should have a LabVIEW library (.lvlib) that contains the VIs that you wish to include in your LabVIEW palette.
    • It is best practice to create Public and Private Virtual Folders with corresponding Access Scope. VIs stored in the Private Virtual Folder will not be exported to the palette.
    • Your file hierarchy on disk should resemble the hierarchy in the project. See the below image as an example.
Project Hierarchy.PNG
  1. Create a Build Specification for a Packed Library. The LabVIEW library (.lvlib) must be configured as the Top-level Library in the Source Files tab.
Top Level Liv.PNG
  1. Build the Packed Library.
  2. Using Windows File Explorer, navigate to C:\Program Files (x86)\ National Instruments\LabVIEW <version>\vi.lib
  3. Create a folder called PPL Palette.
PPL Palette folder.PNG
  1. Within the PPL Palette folder, place a copy of your Packed Library.
PPL inside PPL Palette.PNG
  1. Download the attached Install PPL Palette VI and place it inside your project.
Install PPL Palette VI.PNG
  1. This VI has the following functionality:
    1. It looks inside C:\Program Files (x86)\ National Instruments\LabVIEW <version>\vi.lib for a folder called PPL Palette. Within this folder should be your Packed Library.
    2. For each public VI in the library, an item is created in your new palette.
    3. The new palette is given the name PPL Palette.
    4. A new PPLPalette.mnu file is created inside C:\Program Files (x86)\ National Instruments\LabVIEW <version>\menus\Categories\Programming. This path defines where the palette will appear in LabVIEW.
    5. The Write Palette VI is used to create the new palette.
    6. An Invoke Node is used to refresh the palette.
PPL Installer.png
Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.

When you run the VI, a palette called Example Palette will be created in the Programming palette.

PPL Palette Creation.PNG

To test the example used in this article:
  1. Download the attached Palette Project 2019.zip file.
  2. Open the Palette Project in LabVIEW.
  3. Build the Packed Library under Build Specifications.
    • Note: ensure you have changed the build path to suit your PC.
  4. Run the Installer or Install PPL Palette VI.