ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW APIs Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Scripting with polymorphic VIs

Hi,

I'm trying to programmatically add VIs to a polymorphic VI but cannot find any method or property that would let me do that.

I would expect there to be a property that contains children of the polymorphic VI and a method to add VIs to it, but cannot find anything like that. I would also like to set the short and long names of the VIs in the polymorphic VI as well, since that is a tedious job that is very error prone when doing manually.

Can anyone show me how that can be done?

Thanks a lot!!

Joseph

0 Kudos
Message 1 of 13
(12,033 Views)

Not sure it has exactly what you want but take a look at this example on LAVAcr.

Hope this helps


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 2 of 13
(8,452 Views)

Merci beaucoup!! C'est ce qu'il me faut pour commencer.

Thanks! That's what I needed to start with.

0 Kudos
Message 3 of 13
(8,452 Views)

I can now add VIs to a polymorphic VI.

Is there a way to change the properties of the polymorphic VI (adapt to type, show selector, which icon to show...)?

Can I change the selector name of each VI contained in a polymorphic VI?

The link from lavacr does not do these things.

Thanks!

Joseph

0 Kudos
Message 4 of 13
(8,452 Views)

You need to activate scripting and make sure you have a polymorphic VI type reference, if you activate that you get the following properties:

PolyProps.png

InstanceInfo will show the information about every VI.

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 5 of 13
(8,452 Views)

Hey,

thanks a lot. Those were the properties I was looking for. I used InstanceInfo as write node and added the paths with selector and menu names. It worked like a charm, and it's easier to manipulate than the previous solution.

Joseph

0 Kudos
Message 6 of 13
(8,452 Views)

TCPlomp,

I can't seem to find the AdaptToInputs using LabView 2014.  It might have something to do with selecting the polymorphic VI type reference?  Any thoughts?

THANKS!!!

polymorphic_Scripting.png

0 Kudos
Message 7 of 13
(8,452 Views)

Here's a 2014 snippet.  You do need to have the PolymorphicVI class not just VI.

Polymorphic VI Properties.png

0 Kudos
Message 8 of 13
(8,452 Views)

How do I find it (How do I drop that onto the block diagram)?  When I connect a property node to the "new VI" scripting command I can't find PolymorphicVI as an option.

Is it considered on object of a Polymorphic VI?

Thanks!

polymorphic_vi_Refnum_search.png

0 Kudos
Message 9 of 13
(8,452 Views)

You need to cast the object (use To More Specific Class) to a PolymorphicVI.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 10 of 13
(8,452 Views)