Import a VI Snippet (*.png) image programmatically using pure LabVIEW code (No external dlls or dependencies).
Pastes this VI Snippet ("..\basic.png"):
Programmatically into an existing or new VI:
How to Use
1. Open the "Import VI Snippet.llb:Import VI Snippet Example.vi"
2. Enter the "VI Snippet Path (*.png)"
3. Optional, enter the "Drop Position" in pixels where the code should be positioned on the block diagram
4. Run the VI
The VI Snippet code will import into a new VI.
VI Snippets are no more than customPNG data chunksthat contain the binary VI file. The library saves and loads the "niVI" chuck to the clipboard (within the context of the block diagram) and then pastes the code to the destination VI specified.
VI Snippet PNG Chunks:
"IHDR": PNG header information
"IDAT": PNG image data
"niVI": LabVIEW VI code<< this is the secret sauce
"tEXt": LabVIEW VI Snippet help text
E.g. "National Instruments Software This image contains an embedded VI File. For more details visit ni.com/info and enter 'ex6a7h' "
"IEND": PNG end of file
Under the hood, this library does the following:
Read the VI Snippet PNG chunks
Save the "niVI" data chunk to a temporary VI file (*.vi)
Load the temporary VI using VI Server
Copy all Block Diagram content to the clipboard (See below)
Paste the content to the destination block diagram
Delete the temporary VI.
Note: This uses VI Scripting to make a selection of all block diagram objects (i.e. decorations, nodes, sub VIs, wires, etc.) and copys the GObjects to the clipboard in the context of the block diagram. This is a workarround due to the inconsistent nature of the "Place object on cursor" IDE method.