LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Project right click menu

Solved!
Go to solution

 

I want to create a script which creates accessors for DVRs. One of the issues which i have is the need to navigate to cluster of the private data. Then i can right click it and create required VIs using my plugin (DVR helper). It works similar to built in Labview feature "Create Accessors..."

I wonder if there is a way to use plugin from the project window by simply right clicking on a class. Similar to how GOOP and LUT plugins work (see images below). 

So the question is: how to add custom menus to the right lick action in the project window?

 

AlexanderKhodarev_3-1576526934297.png

 

AlexanderKhodarev_0-1576526769419.png

www.xinstruments.com - Custom Software for Industrial Automation

www.hdrconverter.com - Picture processing made easy

0 Kudos
Message 1 of 10
(4,943 Views)
Solution
Accepted by topic author AlexanderKhodarev

You have to write a project provider:

 

https://forums.ni.com/t5/Developer-Center-Resources/Customize-the-LabVIEW-Project-Explorer-Using-the...

 

In my opinion, project providers are more trouble than they're worth. I don't recommend pursuing this path. Instead, consider providing your utilities in the LabVIEW pull-down menus. I discuss this topic and more in the following presentation: http://bit.ly/dnattlvhooks

 

 

Message 2 of 10
(4,920 Views)

Yes, currently you need to use the Project Provider Framework. Start here: https://forums.ni.com/t5/LabVIEW-Project-Providers/gp-p/bymqyodmkc?profile.language=en.

 

It is a little involved but doable if you have the motivation. It does come with a caveat of "it might break something" but has been used extensively enough that the community has enough experience to point out the pitfalls.

0 Kudos
Message 3 of 10
(4,914 Views)

thank you.

Another question: is there a way to get references to the controls contained within DVR? 

Currently i have a cluster control called data (for each class i use) from which i create DVR. When i right click on DVR i search for the Data.ctl and obtain references to it's components. Then i create all user selected accessors to the components of this cluster. Is it possible to get references to controls contained in DVR without having a specific ctl file converted into it?

www.xinstruments.com - Custom Software for Industrial Automation

www.hdrconverter.com - Picture processing made easy

0 Kudos
Message 4 of 10
(4,876 Views)

@AlexanderKhodarev wrote:

thank you.

Is it possible to get references to controls contained in DVR without having a specific ctl file converted into it?


I don't think you can get references to individual elements. The Element property returns an error when getting the value. This makes sense, but it prevents us from getting the data type of the element.

 

You can get\set the element as one. Get the value of the reference, and then use NI_Data Type.lvlib:Get Refnum Information.vi to get information about the variant.

0 Kudos
Message 5 of 10
(4,783 Views)

wiebe@CARYA wrote:

You can get\set the element as one. Get the value of the reference, and then use NI_Data Type.lvlib:Get Refnum Information.vi to get information about the variant.


Personally I would traverse instead of doing the variant gymnastics.

 

TraverseDVR.png

Message 6 of 10
(4,768 Views)

@Darin.K wrote:

wiebe@CARYA wrote:

You can get\set the element as one. Get the value of the reference, and then use NI_Data Type.lvlib:Get Refnum Information.vi to get information about the variant.


Personally I would traverse instead of doing the variant gymnastics.

 

TraverseDVR.png


Guess that depends on how you want to use the information. I think for example that the value\variant trick would work in executables, where the traversing won't. Not sure when I'd need that though... And if you prefer traversal gymnastics over variant gymnastics 😄

 

Nevertheless, neat trick. Wouldn't have expected that to work, and didn't cross my mind.

 

For reference:

DVR Elements.PNG

0 Kudos
Message 7 of 10
(4,699 Views)

Thank you Darren and Darin K.

i've managed to make the plugin to create accessors for DVRs. Works similar to how native "Create Accessor..." works. Plan is to post this on the plugin forum after few weeks of evaluation.

AlexanderKhodarev_0-1576815564211.png

select data memebrs

AlexanderKhodarev_1-1576815585162.png

create accessors (it also saves them automatically and even creates icon with text :))

AlexanderKhodarev_2-1576815603591.png

AlexanderKhodarev_3-1576815614244.png

www.xinstruments.com - Custom Software for Industrial Automation

www.hdrconverter.com - Picture processing made easy

0 Kudos
Message 8 of 10
(4,581 Views)

A couple of quick points:

 

(1)  As far as I know, the two error outputs on the IPES will always throw the same error, no need to string the inside one out and merge it.

 

(2)  If you use Property Nodes for the accessors they will automagically accept class objects or DVRs.  I am still so uptight that I insist on creating icons even if they will never see the light of day, so this tool could still be useful even in that scenario.

0 Kudos
Message 9 of 10
(4,573 Views)

property nodes indeed accept DVRs of a class but not class with DVR unless you specifically code it to do so.

www.xinstruments.com - Custom Software for Industrial Automation

www.hdrconverter.com - Picture processing made easy

0 Kudos
Message 10 of 10
(4,534 Views)