LabVIEW Add-on Dev Center » Developing a VI-Based API » Including Examples with a VI Package File
Prerequisite: This document assumes the reader is familiar with building packages using JKI's VI Package Manager. For more details, please see Video Tutorial: How to Build Your First LabVIEW Add-on / VI Package
LabVIEW gives developers the ability to incorporate example VIs from their custom toolkits into NI’s Example Finder tool. This is done by generating a .bin3 file that LabVIEW Example Finder indexes to associate example VIs with a category and various keywords. This file can be incorporated into a VI Package and deployed to the correct directory automatically. Below are the steps to include an example .bin3 file in a VI Package.
In order to generate a .bin3 file currently, the example VIs must be installed in LabVIEW before running the preparation tool. Threrefore, the first step is to build a package as normal including your example VIs. In VI Package Manager, select the example VIs, or the example folder, and change the destination to Examples. Build this package.
Now use VIPM to install this package into your local LabVIEW installation. Verify that your examples have been installed to <LabVIEW>\examples\<Company>\<Product>\.
Note: You can also manually copy the examples to the <LabVIEW>\examples folder, but the example VIs will still link to the source directory VIs. For this reason, we recommend creating a package to ensure the example VIs link to the VI source code under vi.lib
Open LabVIEW and select Tools->Prepare Example VIs for NI Example Finder…
Select the start directory as the <LabVIEW directory>\examples\<Company>\<Product>\. Your example VIs should appear in the left column. For each example VI:
This process saves the documentation information inside each individual VI in the examples folder. The Build Data File tab will allow you to build a bin3 file from this information. Clicking on this tab will show two path input boxes. The first is the directory location you would like to store the generated bin3 file to. This can be your development folder, either under Examples or its own folder. Point the second input box to your example directory under LabVIEW as shown below. Click Build File to create the bin3 file.
At this point, you can now build your package with examples as described below. There is one point to keep in mind: the documentation details are saved inside the individual VIs located in the LabVIEW directory, not the VIs in your source code directory. If you wish to keep the details for future modification, you will need to copy the VIs from the Example directory under LabVIEW to the Example directory of your source code and re-link to the source code VIs. Either way, the bin3 file will register your example VIs, and the process documented here is the same.
Now that you have the bin3 file and examples ready to go, open VI Package Manager. Open your package project, and in the left menu, click on Destinations. Create a new destination and name it “Example .bin3” or something similar. Select “<LabVIEW>\” as the Base Path, and choose “examples/exbins” for the Subdirectory. Destination Type should be either of the Directory options.
Click on Source File Settings in the left menu. Verify that the examples are configured for the Examples destination. Highlight the bin3 file, uncheck the Use Destination of Parent Folder option, and select the “Example .bin3” (or similar) custom destination that you created earlier. You are now ready to build!
Note: This process will increment the build number by one.
The newly created package will now install the bin3 file in the correct location, and your examples will be searchable by category and keyword in NI Example Finder.
And, can anyone add details to explain how to also include these example VIs in an "Examples" sub-palette of the add-on's main palette so they are easily located by users who are already using the tools in the package?
Thanks for any suggestions.
I had to go through this process for PTP Sequencer, and it's never a smooth path. Actually it's quite frustrating, and usually fails the first few times (due to human error I might add). I would much prefer if VI Package Manager was able to create the bin3 file and place it appropriately into the LabVIEW directory structure alongside the example VIs. Any chance NI will release the IP, confidentially of course, to JKI to allow them to implement this into VIP Builder?
I agree totaly Thoric comment. I spent (lost) 2 hours having this working earlier this week
Just 2 hours?? I think I lost a whole day to this, plus a few hairs! Having to install the VIP file locally to have the examples present in the correct location is not an option for me, otherwise I risk crosslinking with the source VIs. I have to carefully copy them by hand with the source project closed and make sure I delete them afterwards. I find the "Prepare Example VIs" utility often spends many minutes doing seemingly nothing, just because you clicked an item somewhere. Waiting for that utility is painstaking, and I find it very confusing to use. More often than not the bin3 files are bad. So when you create the complete VIP file and install it on a clean machine to test it, you then find it hasn't worked! So you have to start over (note that each VIP build takes about 15 minutes, and a test install about 10 more!). Maybe there's a quicker way?
Just 2 hours because it was a small modification. Since 2009, I think I lost many hours with this part of the package build process. The thing that drive me crazy is the "Prepare Example VIs "utility. This tool is the best example of bad user experience. Understand the entire process without reading this document is almost impossible.
Maybe the LVTN team could do someting for us for the next LabVIEW version (LV2015 of course
)
My experience was similar to what Thoric & Olivier describe and why I just scrapped the effort. Luckily my packages are currently for internal use only and don't need to meet all the developer requirements.
If not already there, this suggestion should also be posted at VIPM Idea Exchange.
Ditto, ditto and ditto. We've simply stopped shipping examples with our toolsets.
/Steen
I know this would be a big change, but I kind of like it when the examples can be found on the toolkit function palette, of course that is harder when the example itself needs a project, but in that case a project template could be added to the Getting Started window.
Either way, it should be a lot easier to add examples to packages.
This is a very interesting discussion. I've been thinking a lot about adding this capability in VIPM and it's on the roadmap to provide example finder bin3 file generation within VIPM. Fab - NI discourages users from adding examples in the palettes as this does not meet their guidelines.
However, even if VIPM has this capability, built-in at some point (which I'm confident it will). Is the way NI presents examples to us and others looking for them - the best way? I would say no. Why can't I search for examples in quick-drop, for starters? Why not have examples in the palettes? Also, is the example finder the best tool for the job?
Michael Aivaliotis wrote:
Fab - NI discourages users from adding examples in the palettes as this does not meet their guidelines.
Is the way NI presents examples to us and others looking for them - the best way? I would say no. Why can't I search for examples in quick-drop, for starters? Why not have examples in the palettes? Also, is the example finder the best tool for the job?
I agree. Guidelines be damned, the best way is the one that's easiest to use and most intuitive for novices to an API or tool. Putting examples on the palette has always made them simple to find, quick to access, and straightforward for the developer to include. The Example Finder is clunky and slow at best, and having to create these .bin3 files (with more clunky UI tools) evidently creates serious roadblocks to publishing code.
I understand the resistance to the guidelines, but for PTP Sequencer I must abide by the guidelines otherwise it will be rejected from the Tools Network. This includes placing all the functions in the Addon palette folder, which I feel makes it harder to find the toolkit. Most people are used to, and therefore expecting, to find a parent folder right there at the top level. I wish I could disregard this guideline, but one must obey to remain a member of the club.
Thoric wrote:
I wish I could disregard this guideline, but one must obey to remain a member of the club.
I hope the club unquestionably increases sales of PTP Sequencer...otherwise what's the point of membership and increased NRE costs?
David Staab wrote:
Thoric wrote:
I wish I could disregard this guideline, but one must obey to remain a member of the club.I hope the club unquestionably increases sales of PTP Sequencer...otherwise what's the point of membership and increased NRE costs?
PTP Sequencer is free, but we've seen far better footfall through the Tools Network than from our own website. It's been worth it
IMO having examples in the palette could be confusing for LabVIEW beginner. Palette is used to contain VI you need to build your own application. If example are in the palette, you need to first drop the example in your diagram and then double-click on the VI to open its front panel. As far as can see during training session, that's not something usual for new LabVIEW users.
In the other hand, we (SAPHIR support team) often have to advice people that evaluate our toolkits to go to the example Finder to start using our tools. That means the example finder is not a well known tool in LabVIEW.
To add examples in the palette, at least, we should be able to force a front panel open instead of dropping the VI on the diagram (the exact opposite of "place content VI" option).
As a side note, we can't blame NI to have guidelines for the LVTN. We can disagree their content of course but these guidelines ensure minimun consistency with each toolkits available in the LVTN. That should help users to evaluate and adopt any add-on on the LVTN.
The Example Finder is not well known, toolset items added to the Tools menu goes a long time before being discovered, and links in the detailed help file (to open external stuff that helps users get going with your toolset) just aren't discovered by more than a few percent of users either (many do not even read the documentation).
I feel in many situations that having the help with the toolset's functional VIs directly in the palette is the best location, but it takes consideration where to put it (sub-palette design) and how to make it obvious what it is. The current palette options just aren't flexible enough.
I've submitted an idea to the LV Idea Exchange that could be a starting point for some more public discussion on the subject if you're interested in that: http://forums.ni.com/t5/LabVIEW-Idea-Exchange/New-palette-options-Open-VI-and-Run-VI/idi-p/2916416
Cheers,
Steen