05-30-2019 02:21 AM - edited 05-30-2019 02:24 AM
Hi
I'm pretty new to LabVIEW, so I hope you'll pardon me if this is a stupid question.
Problem background:
I have to interface with a .NET shared library. So far I can manually create VIs making calls in that library, it works, it's stable, I'm happy. But since that library is automatically generated and contains many .Net classes that need interfacing , coding all matching VIs manually for is not an option. Hence my interest for VI scripting.
Problem:
I followed NI's VI scripting tutorial, it's quite fun but it only covers very basic stuff and there a few a aspects i don't fully understand. How are we supposed to find out which parameter to feed to "new VI object " ? here is a example, if I want to create a "invoke node(.NET)" (from Connectivity/.NET palette), what am I supposed to choose for "VI object class" and "object style" ?
So far the closest thing to "invoke node (.NET)" I managed to create is "Invoke node" from programming/application control palette.
help!
05-31-2019 02:42 AM
Hi,
the create new object function returns a reference to the new invoke node. You can use this reference to edit the invoke node using property and invoke nodes. Note that you will find the properties for invoke nodes only after using "to more specific class" on your new reference.
Regards
05-31-2019 03:03 AM
Actually, I don't need to create a new object, all my objects are automatically allocated within my shared library: I use a "invoke node (.NET)" VI to call a static method in the library that will return an object reference , then I use more "invoke node (.NET)" VIs to interact with this object through that reference.
As I said, interfacing with the shared library is not a problem, it's done and it works as long as I create the VIs manually. But I want to create these VIs programmatically because there are too many of them, so I need a way to programmatically create a "invoke node (.NET)" VI through VI scripting, which I can't figure out.
05-31-2019 03:20 AM
@yoctopuce wrote:
Actually, I don't need to create a new object
[..]
I need a way to programmatically create a "invoke node (.NET)" VI through VI scripting, which I can't figure out.
Your invoke node is a new object. You are creating it by using the "create new object" VI (the first one after the red circle in your picture). This VI has an output "object refnum". Right now aou are only closing this refnum.
What i suggestes meant: wire this refnum to property nodes or invoke nodes to modify the new object (in your case also an "invoke node")
05-31-2019 03:44 AM
Are you implying that "Invoke node" and "Invoke node .NET" are equivalent ?
05-31-2019 04:08 AM
I would guess so as you can simply drag an invoke node from the palette into the BD and use right-click -> select class to switch to .NET. So that is what i would try to achieve with scripting: first create the node then change its settings.
05-31-2019 04:51 AM
Ok I'll give a try and report there.
05-31-2019 07:25 AM
One more detail I missed before: there is a more specific class then the "node" class that you use in your picture.
05-31-2019 11:47 AM
Here's a sample diagram that will create a new VI, drop an Invoke Node on its diagram, change its class, then change the method. I hope this points you in the right direction.
05-31-2019 11:52 AM
Wonderful! Thank you very much!