07-23-2013 08:33 AM
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.
Solved! Go to Solution.
07-30-2013 07:53 PM
Hello RVallieu,
Could you clarify what your question is? Is it possible to provide some sample code?
07-30-2013 10:25 PM - edited 07-30-2013 10:28 PM
I'm sure it can't be this easy:
07-30-2013 10:32 PM
Oops, this doesn't add another poly.
07-30-2013 10:33 PM
But this does:
07-31-2013 03:39 PM - edited 07-31-2013 03:54 PM
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.
08-01-2013 12:53 PM
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.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
08-01-2013 01:03 PM
Thanks, Hooovahh. I forgot about Ton's poly tool.
08-01-2013 04:13 PM
Similar to what I came up with. Ah well! I gained more Scripting Experience and will continue to use mine.