LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to choose which items are copied when using a custom template?

Solved!
Go to solution

Hi,

 

As the title says, how do I select whether or not an item is copied to a new project when the project is created from a custom template?

 

I've recently created a custom template by following these instructions, as recommended after my last question on the forums:

 

Click

 

The template was created so that I can create multiple versions of a large LabVIEW program with unique names (using the prefix in the project options). It works very well except that a few things aren't copied to the new project even though they're part of the template. The most important "missing" item is for the runtime menu (i.e. an RTM file). Does anyone know why this might be missing? And how to make sure it's included in future?

 

 

Thanks for any help.

0 Kudos
Message 1 of 20
(3,880 Views)

If an item is present within the Project Window of the template source, it should be copied when you create a new instantiation of the template from the project window. I just verified with one of my own project templates that this includes .rtm files. If you are finding this not to be the case (i.e., if your .rtm file is indeed present in the Project Window, and not under Dependencies), then please attach a simple project template (meta data XML and source files) that demonstrates the problem to this thread, and I'll look into it further.

0 Kudos
Message 2 of 20
(3,877 Views)

Thanks for your reply, Darren.

 

Tomorrow I'll check the template source project but I'm pretty sure that the files are there. I didn't think to test it with a simple template... I should have done! I will also try that tomorrow and let you know how it goes.

0 Kudos
Message 3 of 20
(3,874 Views)

Hi Darren,

 

When creating a project with just one VI and a RTM file everything works ok as you said.

 

However, in my actual project the RTM file is inside a library. I have made a very simple project template which replicates this, and like with my actual project, the RTM file is not copied when using Create from Template. Please see the attached files, in the "MenuTest" folder, there is a library called "TestLLB" that contains an RTM file "menuTest.rtm". When I create a project from this template, TestLLB is empty and menuTest.rtm is missing.

 

Is that expected when using a library?

Download All
0 Kudos
Message 4 of 20
(3,849 Views)

Also when the .rtm file is outside the library (i.e. when it is successfully copied to the new project from the template), it is not renamed with a prefix. Is that expected?

0 Kudos
Message 5 of 20
(3,844 Views)

I spent a fair bit of time debugging this today. First off, let me clarify...when I first read your posts, I thought you were talking about actual LabVIEW libraries (files with a .lvlib extension that provide namespacing for VIs). But you were actually talking about LLBs. Just wanted to get the terminology straight for posterity.

 

Now then, as far as my debugging, I actually discovered three separate issues related to project templates containing RTM files:

 

1. RTMs inside LLBs are not copied (as you already knew).

2. RTMs do not get prefixed properly (as you already knew).

3. The linkage between VIs and RTMs does not get updated on project copy. If you have your RTM outside an LLB and you open your TestVI.vi, you'll see that the VI still links to the source RTM file in the [LabVIEW]\ProjectTemplates directory.

 

I have filed CAR 418414 to get these issues addressed in a future LabVIEW release. As a workaround for now, you can implement an "AfterPage2NoUI" custom scripting VI that fixes the file copy, name prefixing, and file linkage issues after the project is created. I have a custom scripting VI that does all of this almost completed...I will try to finish it up and post it to this thread on Monday.

Message 6 of 20
(3,829 Views)

I also don't get an updated link to the RTM in the project copy, so it sounds as if you're getting the same behaviour. I didn't mention this before because I thought it might be a side effect rather than a problem (as there isn't actually a new file to link to when the RTM is inside a LLB). However the link does not update even in the case of the RTM being successfully copied to the new project, i.e. when the file wasn't inside an LLB.

 

Thanks very much for your time, that VI to fix the problem would be greatly appreciated.

 

 

Out of interest, I have a few other questions:

 

1) In LabVIEW does library generally (always?) mean .lvlib?

2) Is there any other name for .llb files, or are they just refered to as LLB?

3) When you say "...get these issues addressed in a future LabVIEW release", do you know if that's likely to be an update to 2012, or would it be in the next version?

0 Kudos
Message 7 of 20
(3,820 Views)

@Orbital wrote:

 

Out of interest, I have a few other questions:

 

1) In LabVIEW does library generally (always?) mean .lvlib?

2) Is there any other name for .llb files, or are they just refered to as LLB?

3) When you say "...get these issues addressed in a future LabVIEW release", do you know if that's likely to be an update to 2012, or would it be in the next version?


1)  & 2) Library "Should" always mean .lvlib.  But .llb's, like stacked sequences, still exist.  They are the baby seals of LabVIEW!  Club them to death when you see them--- it fun and profitable!

 

3) expect to see the fix when you see it.  NI hates to commit to any time line since the future is awfully hard to predict.  I expect that Darren will make good on his statement that a patch will be in place for download from this thread early next week. 


"Should be" isn't "Is" -Jay
Message 8 of 20
(3,810 Views)

Haha, ok. Thanks.

And fair enough, a patch will certainly be enough for me.

0 Kudos
Message 9 of 20
(3,776 Views)
Solution
Accepted by topic author Orbital

Ok, here's the custom scripting VI (saved in LabVIEW 2012) and updated XML that should fix your test project. You can take a look at how I implemented the XML and the scripting VI, then make applicable changes to your actual project.

 

1. Use the attached MenuTest.xml file for your meta data. Notice the new CustomVIMode and CustomVIPath entries.

2. Make a scripting folder next to your source .lvproj, and place the attached PostCopyScripting.vi in it.

 

Once you've done this, your MenuTestProject should be copied over correctly...the RTM will be present in the new LLB, it will have a proper prefix (if specified), and it will have the correct linkage to the VI.

 

Let me know if you have any additional questions or issues.

Message 10 of 20
(3,742 Views)