LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I create a VI template (.vit) with subVIS that are also templates?

I would like to create a VI template (.vit) that is composed of subVIS that are also templates. Thus, when the top level template is dropped onto a diagram, several unsaved VIs are generated: one for the top level and one for each of the subVIs. I have attempted to create this type of "compound" template, but the subVIs do not come out as new, unsaved VIs. They refer back to the (.vit) file.

Is this even possible, or is there some trick that I am missing? I have successfully created VI templates that contain CONTROL templates and these both come out as new, unsaved objects, but it doesn't seem to work for subVIs.
0 Kudos
Message 1 of 6
(4,083 Views)
Which version of LabVIEW are you using? With 6.0.2 I can create a Top.vit calling a Sub.vit. When I insert Top.vit in a diagram, a new Top and Sub VIs are created. However, if you drag Top.vit icon and drop it on a diagram, new instances are not created because instances are not created while the template is in memory (and this is the way to drop templates on diagrams). Close all templates front panels and insert them (a new instance) on a diagram using "Select a VI..." menu.


LabVIEW, C'est LabVIEW

Message 2 of 6
(4,083 Views)
I have been working in 6.1, but I recently tried the same test in 6.0.2 with the same result. I've attached an example that displays the problem. When I drop "top level.vi" on a diagram, I get a new top level VI and a new control, but not the subVIs. I wonder if I am not adding the subVI templates to the top level template in the correct manner.
0 Kudos
Message 3 of 6
(4,083 Views)
You are right, Chris,
There is a problem when you have more than one template on the diagram. In your example, the control is instanciated but if you rewrite Top Level.vi dropping a subVI first, the VI will be instanciated and the control and the other subVI won't. Submit that behavior to NI Support.


LabVIEW, C'est LabVIEW

0 Kudos
Message 4 of 6
(4,083 Views)
Thanks for looking into this, Jean-Pierre. It appears that currently only the first template (vit or ctt) that you drop into a template will be instantiated. The rest appear as templates. I'll contact support about this.

I created another example that is 4 levels deep (top level > subVI1 > subVI2 > my_enum) but where each VI only calls ONE subVI. This works fine. So having several levels is not the problem, having more than a single subVI template is.
0 Kudos
Message 5 of 6
(4,083 Views)
Chris,

to create a renamed set of VI from a template set you might consider to use the Rename utility available at
http://www.mooregoodideas.com/Downloads/Downloads.htm#Rename
Links between callers and callees are updated in the process.

About the template subVIs: what should LabVIEW do if there are two copies of the same template on a diagram? Create one (the same on two node) or two new instances?


LabVIEW, C'est LabVIEW

0 Kudos
Message 6 of 6
(4,083 Views)