Example Code

Export Built In Function Palette Icon Images

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

    Operating System

  • Windows

    Programming Language

  • .NET
  • LabVIEW G

Code and Documents

Attachment

Description

Update: See Built In Function Palette Icons from Item Path for the exported function palette icons.

 

Export all function palette icon images including the BUILT_IN_FUNC_XXXX items to png files.

 

 

This uses a combination of the App:Palette:Get Palette Menu Items invoke node and Read Palette.vi to export the Windows Metadata File (*.wmf) image vector files, then uses .NET System.Drawing.Image to export the wmf files to png for each icon. This was necessary because the App:Palette:Get Palette Icon method does not return the correct icon image for some BUILT_IN_FUNC_xxxx_x_x items. Lastly, all png images are stored as 24-bit with 0xF0F0F0 masks applied.

 

Built in palette items are exported with the built in palette item path (i.e. "BUILT_IN_FUNC_1054_0_4_Function") plus the palette item display name (i.e. "Absolute Value") separated by a period. Special characters in the palette item display names are removed "[^A-Za-z0-9_- ]" to avoid invalid file names.

E.g. Absolute Value -> "BUILT_IN_FUNC_1054_0_4_Function.Absolute Value.png"

 

 

 

 

How to Use

Export Function Palette Icons.vi:

Set the Output PNG Directory where the png images will be exported and optionally enable Export Non-Built In VIs? to include all VIs or only the built in icon images, then run the VI.

 

 

 

Get Palette PNG Icon.vi:

Set the PNG Icon Directory where the png images are exported, pass in the palette Item Path from a Palette Read.vi to fetch the palette item icon image data.

 

 

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

Contributors