03-21-2012 07:57 AM
In a LV project, you can right-click the project itself in Project Explorer and select "Find Items with No Callers". This feature, incidentally, is a bit crude as of now, because of the lack of features when the screen pops up with the results. More on that later. However, what I want to be able to do is to perform this action programmatically using VI Scripting. I can open a reference to the project by climbing up out of a Current VI's Path call as follows
However, when I slap on an Invoke Node with the Project.ActiveProject output as the reference input, the "Find Items with No Callers" is not available. I was under the impression that with LV Scripting, all right-click menus can essentially be called programmatically. Is this not the case? Is there a way to do what I want? The Property Node doesn't fare any better in terms of getting me what I want.
The end goal for me is to prune legacy code out of the project so as to simplify things a bit. However, I've found the "Find Items with No Callers" to be a bit unhelpful for the following reasons:
1. The results are not sortable in any way.
2. The window that opens has the focus and cannot be minimized.
3. There are many results that come from vi.lib - this makes no sense to me. This right-click option should only return VI's in the project's directory structure on disk that are not called by any other VI.
I realize these things have been said before, but nothing has been said recently.
So, I wanted to wrap this "Find Items with No Callers" around a bit of code that would make it more useful.
Ideas?
03-21-2012 08:10 AM
Find:Items with No Callers is a property of project items, not the project itself. You can find such things using the Class Browser (View»Class Browser or Ctrl-Shift-B). You will need to iterate through your project items, but this will also let you skip such things as the dependency folder.
03-21-2012 11:36 AM - edited 03-21-2012 11:37 AM
Almost sounds like you want to develop what can be done with a source distribution.
Create source distribution and include the top-level and dynamic VIs in ti along with any support files you need.
Configure it to preserve the hiarchy and point at a new folder.
When the SD is built it will pick-up all of the VI's and called sub-VI and relink them in the new location. Anything not used will be left behind.
Copy the proj file to the new location and you should only find stuff that is used in the new folder.
Ben
PS Just notice this is a Physics only thread so far. BTW My wife graduated from Grove City
03-21-2012 12:14 PM
Ben: how does your procedure change, if at all, for a real-time project? Perhaps I should have mentioned up front that this was a real-time project with a cRIO controller and EtherCat expansion chassis.
03-21-2012 12:24 PM
As long as you have the top lveles of all in the SD, it should work fine.
You WILL of course backup everthing BEFORE you test it out.
BTW: This has been a physics only thread.
Ben
03-21-2012 12:30 PM
Ben,
So do I do a SD under the RT target? Or do I do a regular one under the project?
If by "physics-only" you mean all the posters are physicists, that's interesting. So DFGray is a physicist?
When did your wife graduate from Grove City College?
03-21-2012 12:35 PM
Down at the bottom where the builds are located.
She graduated about 1983 I think.
Yes DF is also a member of Sigma Pi Sigma but he actually participates while I just give them cash.
Ben
03-21-2012 12:44 PM
Sorry, I'm still not following. Should I do the build specification under Option A or Option B (See attached screenshot.)
03-21-2012 12:51 PM
Sorry!
I have to confess I have not been working with the RT targets lately since my co-workers get to play with those, so I would suggest you do a SD for each.
It may be possible to do just one but that could goof with some linking differences for the two targets.
Please report back if you find anything to indicate that approach is not working. That is how we keep up on the tricks and techniques as they change for LV.
Take care,
Ben
03-21-2012 01:18 PM
Ben,
Thanks for that. As for backup, I have TortoiseSVN, so I'm all set.
DFGray, I'm having trouble opening references to ProjectItems. How can I do that?