I'm using scripting to generate a lot of functions to interface with some third party code in C#.
I have written an intermediate layer in LabVIEW that handles all the calls to .NET properties and methods and via scripting and this intermediate layer I am able to generate >1000 VI's that can be used in our automated tests to interface with the end product.
All goes well so far and I have had good success with the scripting functionality of LabVIEW.
Now I need to interface directly to a static property of a C# DLL via scripting.
Does anybody knows how I can - via scripting - select the proper .NET DLL and select the static property for a .NET property object in the block diagram? I didn't really find an example of how this could be done....
The above image shows what I want to accomplish/create via scripting.
To create this in LabVIEW I place a .NET property on my block diagram, right-click -> select class -> .NET -> browse for the .NET DLL -> select the creatable object from the DLL -> select the static property and wire the ins and outs.
How can something like this be done via scripting? I really don't know how....
I will continue my search and if I succeed also post the code.
Thanks in advance for all your help!
To summarize - via scipting I want to do the "Select Class».NET»Browse »Select Object from Assembly" part...
Putting a property node on the block diagram works, but I cannot figure out how the selection of the object from an assembly works via scripting..
I can't see any way to do it directly. But of the number of DLLs you're using is not too large, you make template VIs and just copy from them.
Unfortunately I'm unable to build the template VIs since the name of the assembly is not known beforehand. I will keep looking...
I am looking in to your issue. Since the functionality you want is not directly supported in LabVIEW, I would suggest posting your idea on the Idea Exchange. Have you looked at Constructor Nodes or the "To .NET Object.vi"? I realize they also suffer from the same lack-of-programmability, however they might offer some additional tools that property nodes don't offer.
Thanks for your suggestion. I've already looked at the constructor nodes or the "To .NET Object.vi". I'm using them in different other parts of my code.
The fact that I'm focusing on the static property node is that the C# assembly requires me to first call this .NET static property in order to get a reference to the 'singleton' object. Once I have this reference I can do everything I want... (instantiate other objects, call methods, properties, ...) It is just the way this assembly was constructed.
Thanks again for your help!
I've been looking in to more information on general rules for using .NET in LabVIEW. Check out the following resources:
Also see "Using .NET with LabVIEW" in the LabVIEW help file (Fundamentals>>Windows Connectivity>>Using .NET with LabVIEW)
It looks like you might have to create a wrapper .NET assembly to get the functionality you want.
Thanks for the answer - but this really is completely beside the point here. I'm not using generics or something like that.
The functionality that I'm using from .NET is supported by LabVIEW. I'm calling a static property of an assembly. As I've shown in the first post - this functionality works if you call it directly from within the LabVIEW environment. The one thing that doesn't work is "scripting this .NET static property". Probably it is not yet supported in LabVIEW. I do not see how I can specify the assembly/class/property via scripting. Maybe a later version of LabVIEW will support this.
Note that if instead of referencing a property node, you reference a constructor (which can feed to a property node), you can specify the .NET object.