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

Edit: logged into wrong account.

0 Kudos
Message 11 of 20
(842 Views)

Thanks very much Darren, that worked perfectly for the test project.

 

It has also worked for the actual project that I want to use as a template. There were multiple VIs that used the same RTM file, what would be the best way of finding them programmatically? I tried doing "Open VI Reference" -> "Callers' Names (property node)" but that doesn't seem to work for RTMs. In the end I changed all of the VIs that use the RTM to top level in the LLB, and then I used the "Get Top Level from LLB" (I can't remember the exact name, it's one of the OpenG VIs). That worked fine for me, I was just wondering if there's a better way.

 

Thanks again.

0 Kudos
Message 12 of 20
(837 Views)

@Orbital wrote:

 That worked fine for me, I was just wondering if there's a better way.

 

Thanks again.



convert the LLB's to lvlibs.  That would be the better waySmiley Wink


"Should be" isn't "Is" -Jay
0 Kudos
Message 13 of 20
(829 Views)

@Orbital wrote:

 

There were multiple VIs that used the same RTM file, what would be the best way of finding them programmatically?


You'll notice that in the scripting VI I attached, I use the "Get All Descendents" method of the ProjectItem class to find everything of type "VI". In your test project, there was only one VI. So for your actual use case, you would use the same approach, but then search the resulting array for the VIs you want to relink. Here's how it would work:

 

relinkmultiplevis.png

0 Kudos
Message 14 of 20
(826 Views)

It was getting the VI names programmatically that I was trying to do, e.g. for the code in your last post: a way to obtain the list of VIs in your array of strings without having to write them out manually.

 

I found one way of doing it using the project:

 

RTM ref from project.png

 

 

But I was wondering if it is possible without going via the project, something like the "Callers'" property node (see below), but that works for RTMs.

 

reference.png

 

 

Basically I can't figure out how to open a reference to an RTM without going through a project. Is it possible? This isn't really related to the original question anymore, your script worked great for fixing the template problem, I was just interested if this is possible.

 

Thanks for all of your help, it's been really useful to get the template working for our project.

0 Kudos
Message 15 of 20
(818 Views)

A VI maintains a link to the RTM that it uses, but I don't believe RTMs maintain links to the VIs that use them. So to programmatically obtain the list of VIs (instead of maintaining the static list), you would simply iterate over every VI in the project to see if it links to the RTM, then change its link if it does:

 

relinkrtms.png

Message 16 of 20
(816 Views)

@Darren wrote:

A VI maintains a link to the RTM that it uses, but I don't believe RTMs maintain links to the VIs that use them.


I wasn't sure about how they worked, that makes sense though, thank you.

0 Kudos
Message 17 of 20
(808 Views)

CAR 418414 discussed in this thread was fixed in  LabVIEW 2014.  For a more complete list of bugs fixed in LabVIEW 2014, check the LabVIEW 2014 Bug Fixes. You can download an evaluation copy of LabVIEW 2014 at http://www.ni.com/trylabview/ or if you have an earlier version of LabVIEW installed and an active SSP subscription, you will be able to download the latest version of LabVIEW through NI Update Service.

 

Regards,

 

Jeff Peacock 

 

Product Support Engineer | LabVIEW R&D | National Instruments | Certified LabVIEW Architect 

 

0 Kudos
Message 18 of 20
(785 Views)

Today I am working in LabVIEW 2020 and I have a similar problem. A .rtm file in a lvclass, that's part of a library. When using Save As on a lvproj to clone the entire project, everything but the rtm files are properly cloned and relinked. The issue here is although the clone is fine the original source code gets relinked to the new rtm files!

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 19 of 20
(64 Views)

I can't reproduce this in LV 2024 Q1. I wonder if it was a bug that got fixed?

0 Kudos
Message 20 of 20
(57 Views)