LabVIEW: Creating Custom Templates and Sample Projects

The new ‘Create Project’ feature added to LabVIEW 2012 is great and I use it a lot when starting a program. However, I found myself making common changes to the templates before I started writing a program. The main changes were removing the ‘Something’ buttons and events. This isn’t a lot of work but does take time and becomes rather tedious.
One solution is to use the Create Project feature with a custom template. It is rather easy to set up and works really well after getting over a few minor hurdles.
I started off with creating a new QMH project from the default template. I made a few changes to the project and then saved the project how I wanted the template to work.
Some of the changes that I made were:
  • Removing the Something and Something Else buttons, events and cases
  • Changed the queue message from a String to a Type Def Enum. This makes the Consumer case a lot easier to set up and eliminates spelling mistakes
  • Added a case to read in a configuration XML file
  • Replaced constants with variable constants
  • Remove the Stop button to use the ‘X’ to stop the program


Once you have the template set up, save the project and close it. Navigate to the ‘LabVIEW Data’ folder in ‘My Documents’. Inside this folder, create new folders with the following structure. 
Place your template into the Source folder. Make sure that Auto Populating Folders is DISABLED in the .lvproj. This caused me a lot of troubles getting set up.
The next thing to do is create an xml file in the MetaData folder. Call this file TemplateMetaData.xml. I used the default xml file as a template to get started. This is what my file looks like:

To get an explanation on the different keywords, have a look at this white paper from NI.
Once you have the xml file saved in the MetaData folder and the template project in the Source folder, you should be ready to go.

As can be seen from above, my custom project is now added to the Create Project wizard. Just follow the normal wizard to create a new project and get programming right away.
The main problem that I ran into was setting my folders to auto populate in the template. Once I switched that off everything ran smoothly.
Have fun creating new templates and projects.