LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

scripting - modifying existing polymorpic vi - dependencies issue

Solved!
Go to solution

I wrote a nice little tool using scripting to make it less tedious to create Polymorphic VIs for my libraries and functional global/action engine wrappers to make one interface for the functionality of the "object/data".  I hated having to click "Edit Name" for each individual VI selected, and hated not being able to add more than one VI at a time to the list.

 

I got that base create working beautifully, even setting the parameters such as "Show Polymorhpic VI Icon versus Instance Icon" working properly.

 

What is confounding me now is trying to add another VI to the list for an already created Polymorphic VI.  Opening the reference to the Poly is no issue, adding to the list of VIs is not an issue apparently - the problem comes when I try to Import Strings for the VI to modify the Menu and Selector Strings - the String file is formatted perfectly fine, but when I check the VI it is not using the settings as imported from the String File - when I used the Invoke Method of PolyVI - Get VI Dependencies and checl the Dependency Paths - the path returned for the newly added object subVI is the one for the previous VI - this seems to confound with the settings loaded by the Import Strings function.

 

There does not appear to be a way to modify the dependencies for the polymorhpic VI, only the Get is exposed....

 

What I am doing is taking a reference to the VI opened and casting it to Polymorphic, then using the same scripting node "New VI Object" to add the new VI to the Poly VI - the same way the original VI is built.  The only difference is that for a new VI I use the scripting node "New VI" to create the Poly VI  reference and Cast it as Polymorphic.  Using the Export and Import strings works perfectly to modify the Menu and Selector names in that instance.

 

I don't really expect an answer to be forthcoming as this is kind of a niche area - just thought I would throw it out there.  I can always use the built in Polymorhic VI editor to add new VIs to the list.

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 1 of 9
(3,015 Views)

Hello RVallieu,

Could you clarify what your question is? Is it possible to provide some sample code?

Wan L
Applications Engineer
National Instruments
http://www.ni.com/support
0 Kudos
Message 2 of 9
(2,972 Views)

I'm sure it can't be this easy:

main.png

0 Kudos
Message 3 of 9
(2,963 Views)

Oops, this doesn't add another poly.

0 Kudos
Message 4 of 9
(2,960 Views)
Solution
Accepted by topic author RVallieu

But this does:

main.png

Message 5 of 9
(2,959 Views)

Huh - didn't know about the instance info property.

 

I was trying the "New VI Object" which is how I was adding the first round of VI's to the new Polymorphic VI when first created.  I will try this and let you know.

 

EDIT:

 

Worked like a charm - would have made editing the Menu and Selector strings easier than what I ended up doing too.  THANKS!

 

I'm a happy camper now - used my tool several times to make a cohesive single "VI" for interfacing with module code within projects.

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
Message 6 of 9
(2,936 Views)

So I haven't personally used it yet but over on LAVA there is a Polymorphic VI editor that looks like it is worlds better then the one build into LabVIEW.

 

http://lavag.org/files/file/136-polymorphic-vi-editor-v101-lv2011/

 

Using Polymorphic VIs is the only sanctioned NI way to make a VI handle multple data types.  And the editor they provide is so awful when you have more then a few types.

Message 7 of 9
(2,914 Views)

Thanks, Hooovahh. I forgot about Ton's poly tool.

0 Kudos
Message 8 of 9
(2,910 Views)

Similar to what I came up with.  Ah well!  I gained more Scripting Experience and will continue to use mine.

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
0 Kudos
Message 9 of 9
(2,903 Views)