LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scripting a .NET static property node in LabVIEW

Hello all,

 

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....

 

example.JPG

 

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!

Regards,

Kirsten.

0 Kudos
Message 1 of 11
(4,065 Views)

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..

0 Kudos
Message 2 of 11
(4,063 Views)

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.

0 Kudos
Message 3 of 11
(4,050 Views)

Unfortunately I'm unable to build the template VIs since the name of the assembly is not known beforehand. I will keep looking...

0 Kudos
Message 4 of 11
(4,031 Views)

Hi k_tunsen,

 

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.

 

Tim W.

Applications Engineering

National Instruments

http://www.ni.com/support 

0 Kudos
Message 5 of 11
(3,994 Views)

Hello Tim,

 

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!

Kirsten.

 

 

0 Kudos
Message 6 of 11
(3,978 Views)

I've been looking in to more information on general rules for using .NET in LabVIEW. Check out the following resources:

 

Which .NET Features Are Not Supported in LabVIEW?

 

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.

 

Tim W.

Applications Engineering

National Instruments

http://www.ni.com/support 

0 Kudos
Message 7 of 11
(3,963 Views)

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.

Thanks anyway...

0 Kudos
Message 8 of 11
(3,950 Views)

Sorry the functionality you're after isn't supported yet. As I mentioned earlier, the IdeaExchange would be a great place to share your idea.

 

Tim W.

Applications Engineering

National Instruments

http://www.ni.com/support 

0 Kudos
Message 9 of 11
(3,936 Views)

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.Constructor.png

0 Kudos
Message 10 of 11
(3,922 Views)