What is a VI Snippet?

VI Snippets are a easy way to store, share and reuse small portions of simple LabVIEW code that do not contain any external subVIs. VI Snippets are actually PNG (portable network graphics) image files that have the code for the block diagram embedded in a hidden field in the file.  When a VI Snippet is dragged and dropped onto a block diagram the code is placed on the block diagram.

Using VI Snippets

You can drag the snippet file (*.png) from windows explorer onto a block diagram or even directly from some browsers (such as Microsoft Edge or Google Chrome) onto your diagram.

We will use VI Snippets throughout this web site to display simple code examples.  You can recognize the image is a snippet by the banner with the hand and LabVIEW icon at the top left of the image and the LabVIEW version number at the top right.  You can drop a snippet onto a LabVIEW diagram as long as the snippet was created in the same or an earlier version than the LabVIEW version you are using.

Here are a couple of simple VI snippets that you can try out.  You may need to resize your windows so that the image in the browser and your block diagram are visible at the same time, then just click the snippet and drag it to your block diagram.

This VI will display a sine wave on a waveform chart in a point-by-point manner.

This one will display a sine wave all at once on a waveform graph.

Creating a VI Snippet

To create a VI Snippet, select a portion of your code on the block diagram by dragging a box around it.  Then select the menu option Edit -> Create VI Snippet from Selection.  You will be presented with a file dialog asking for a location to save the snippet as a *.png file.


Print Friendly, PDF & Email