05-01-2019 06:28 AM
Hi,
I want to get number of VIs count in a project.
I am trying to see VI metrics metioned in following link:
http://www.ni.com/en-in/innovations/white-papers/06/estimating-code-complexity-in-labview.html
I didn't find option in my LabVIEW 2016 PDS 😞 😞
Is there any way to get exact count of total VIs involved in project ?
05-01-2019 06:40 AM - edited 05-01-2019 06:46 AM
You can use VI scripting to find this information. The Project class for a Property Node contains a "MyComputer" property, although if you're on multiple targets you'll need to also recurse through the list of targets.
From that reference, you can find Owned Items, and proceed via other property nodes to check the type (VI, library etc) and then check their owned items if they are containers (like a library).
This is probably more easily accomplished with a more structured set of VIs, perhaps using OOP, but someone might have already written exactly the code you're looking for. Otherwise, it can be done with a shared-clone VI, but you need to be careful for nested libraries, etc. If it isn't a VI or control/typedef or similar, and you want the total number of VIs, you need to keep going.
Edit: If you don't need this programmatically, you might be able to just export the list of files in the project (Project > File Information) and then read that exported list and count the elements (possibly after filtering based on names ending with .vi - this list contains anything in the project, and nothing in dependencies if I'm reading it correctly).
05-01-2019 07:22 AM
There are several ways to do this, depending on what you want to do. At one point, I wanted to get a list of all the VIs in memory, as there were some that weren't shutting down properly and I wanted to locate them (so I'd know what to fix) and also programmatically force them to stop. Here is a little routine that I wrote first that just lists the VIs in memory:
Show All VIs in Memory
Bob Schor
05-01-2019 11:47 PM
I published a free utility that displays the entire project in a single window with up to 42 properties including code complexity. It displays the number of objects displayed and can also show the count separately for VIs, Controls, Typedefs and Strict Typedefs. You can show the project items selectively by 17 object types. It can combine multiple targets or just show My Computer.