LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scripting Polymorphic VI

I have successfully created a script that creates a number of interop VIs to C# Classes and their methods (with a lot of help from tst & DFGray... Sev had a little in there too). Smiley Happy

 

Now I need to create a script that will create the Polymorphic VI that will wrap all of those.

 

After I get the new polymorphic created, I want to turn on the "Show Selecttor by default", populate the menu name and selector name, but I can't seem to find the "Target Class" of "PolymorphicVI" to go from the Generic VI Reference to get to the more specific class and thus reveal the properties that I should then have available.

 

Any hints as to what the "path" is?

 

Thanks,

Dan

0 Kudos
Message 1 of 12
(2,980 Views)

Sorry....  forgot Darin... some help there too.

0 Kudos
Message 2 of 12
(2,978 Views)

The easiest way to get one is to drop a method or property, select VI»PolyVI as the class, then create a constant from the property or method input.  You should be good to go at that point.

 

The PolyVI reference is a subclass of VI reference, which is a parallel class to generic.  This is why you do not see it on the standard class constants, which starts with generic.

0 Kudos
Message 3 of 12
(2,972 Views)

That was it...  another head slapping moment.  AND I was even doing that (dropping a method and then selecting the class BEFORE wiring) when I was working with the .NET classes that I have been dealing with. For some reason I had it in my head that in scripting you don't (couldn't) do that. 

 

Thanks!!

 

Exactly what I needed. 

0 Kudos
Message 4 of 12
(2,968 Views)

woops...  too excited.  I dropped the property node, selected the PolymorphicVI class, saw that I now had access to the SelectorVisible, but as soon as I hooked the ref in to the VI ref, it changed back to the VI class....  What did I do wrong?

 

0 Kudos
Message 5 of 12
(2,966 Views)

Yup...  so excited, I didn't read all of your post carefully enough.

 

I missed the part about creating the constant ref from the input of the property node...

 

By doing that and THEN downselecting to a more specific class, whaddya know, it works.

 

 

0 Kudos
Message 6 of 12
(2,964 Views)

I can now show the selector!!!  All is good.

 

And I also see where I have access to the Menu Name and Selector Name, so believe it or not, I actually do NOT have a question (at this time 😉 ).

 

I do want to thank everyone who helped with all of my questions last week.

 

THANK YOU!!!

 

Dan

 

 

0 Kudos
Message 7 of 12
(2,937 Views)

Is there a way to get a list of the classes and/or methods available in a dll by pointing to either the dll or the directory that the dll resides in?

 

I feel like I'm putting myself into a catch 22. I want to be able to get a list of all of the classes so that I can create a directory structure for my VIs that I can now create programmatically, but I don't see how I can get that list without having a "seed" vi that already contains a method from the class. The goal is to be able to point to a folder that has one of more dlls in it and get a listing of the class(es) and the method(s) available.

 

Thanks,

Dan

 

 

 

0 Kudos
Message 8 of 12
(2,928 Views)

I think you might have two problems here -

 

  1. Getting a list of the classes in the DLL (although I'm assuming there's some .NET code which can help with that, for instance - http://stackoverflow.com/questions/1315665/c-list-all-classes-in-assembly).
  2. The class, if memory serves, is only represented as a string. If the .NET class is not already in the list (which I believe requires it to be registered in the GAC), it probably cannot be loaded using a path. Unless the constructor node has a special property or method for loading by path, you might have a problem.

Potential solutions:

  1. Save a VI with only the node in it linked to a class. Then see if you can see the class path in the VI's binary data and replace it. This might or might not work.
  2. Automate the browsing action with a program such as AutoIt and control that from LV for each of the classes. I have no idea if that's even possible.

___________________
Try to take over the world!
0 Kudos
Message 9 of 12
(2,920 Views)

LabVIEW ships with some of this functionality.  If you look under Tools»Import»Shared Library (.dll)..., you will find a wizard.  Most of the VIs are in <labview>\resource\importtools\sharedlib.  There may be some code there you can reuse.  I have not done this, so cannot help you if you try.

0 Kudos
Message 10 of 12
(2,906 Views)