LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Refresh Dependencies in the project window programmatically?

Solved!
Go to solution

In a newly created project window (created at runtime, filled with top level VIs), the Dependencies folder is empty.

How to Refresh the folder programmatically?  i.e. mimic select Refresh on the right click menu.

 

image.png

George Zou
0 Kudos
Message 1 of 10
(224 Views)
Solution
Accepted by zou

Hi zou,

 

Class TargetItem has a method "Refresh Dependencies":

 

raphschru_0-1750767757980.png

 

Regards,

Raphaël.

Message 2 of 10
(179 Views)

You can also just mass compile your code.

Tim
GHSP
Message 3 of 10
(167 Views)

@aeastet wrote:

You can also just mass compile your code.


Seems a bit excessive if you only added a file to the project programmatically.

 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 4 of 10
(141 Views)

@raphschru wrote:

Hi zou,

 

Class TargetItem has a method "Refresh Dependencies":

 

Regards,

Raphaël.


Thanks everyone.  Somehow I missed My Computer level.

 

Now I need to filter out NI VIs, such as DAQmx, niDMM, niScope, etc.

What is the best way?

IsSystemVI doesn't work.

 

George Zou
0 Kudos
Message 5 of 10
(126 Views)

@zou wrote:

@raphschru wrote:

Hi zou,

 

Class TargetItem has a method "Refresh Dependencies":

 

Regards,

Raphaël.


Thanks everyone.  Somehow I missed My Computer level.

 

Now I need to filter out NI VIs, such as DAQmx, niDMM, niScope, etc.

What is the best way?

IsSystemVI doesn't work.

 


I would do it by path.  Anything in vi.lib, or anything in instr.lib in a list of defined directories (or possibly just "instr.lib\ni*", if you feel confident that you won't be creating your own directories starting with "ni" in instr.lib.

 

Another potential option is if you use source control, you could only include files contained in source-controlled directories.  Start with the current path, and keep going up until you find a ".git" or ".svn" in the folder or you reach the top level.

Message 6 of 10
(111 Views)
Solution
Accepted by zou

@zou wrote:
Now I need to filter out NI VIs, such as DAQmx, niDMM, niScope, etc.

What is the best way?

IsSystemVI doesn't work.


Filter out NI VIs from what? Do you have an initial list?

 

If you have a list of:

 - File paths ➡️ Check if each path is relative to vi.lib's path.

 - Project item refnums ➡️ Check if property "Path" is relative to vi.lib's path.

 - VI refnums ➡️ Check if property "VI Path" is relative to vi.lib's path.

 

You can also recursively read property "Owned Items[]" starting from your target's Dependencies item, then skip when you encounter the virtual folder "vi.lib".

 

Regards,

Raphaël.

Message 7 of 10
(110 Views)

@raphschru wrote:

@zou wrote:
Now I need to filter out NI VIs, such as DAQmx, niDMM, niScope, etc.

What is the best way?

IsSystemVI doesn't work.


Filter out NI VIs from what? Do you have an initial list?

 

If you have a list of:

 - File paths ➡️ Check if each path is relative to vi.lib's path.

 - Project item refnums ➡️ Check if property "Path" is relative to vi.lib's path.

 - VI refnums ➡️ Check if property "VI Path" is relative to vi.lib's path.

 

You can also recursively read property "Owned Items[]" starting from your target's Dependencies item, then skip when you encounter the virtual folder "vi.lib".

 

Regards,

Raphaël.


I use Get All Descendants to get a list of VIs under Dependencies.

Compare path is slow.  Compare Two Paths.vi is not even Reentrant.

 

George Zou
0 Kudos
Message 8 of 10
(102 Views)

If speed is really a concern for path comparison:

 

Is Path in vi_lib.png

0 Kudos
Message 9 of 10
(95 Views)

OwnedItems[] plus file extension is better.

 

George Zou
0 Kudos
Message 10 of 10
(87 Views)