ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Changing a .net constructor node with VI Scripting?

Solved!
Go to solution

I'm trying to make a tool to generate wrappers around a specific .NET dll.

 

I created the node, then tried writing the property Constructor Node Class Name. I got error 1113, "LabVIEW: (Hex 0x459) Internal Error. The external object class was not found."

 

So, I manually made a node then read that property- aha, I need to add ".NET:" to the beginning of the method name; all well and good.

 

So, now I can write the property with that name and it works... until I go to write a different name.

 

Long story short, I seem to be able to write a type to a Constructor Node if I've manually set that node to that type before.

 

In other words, say my .NET assembly has methods A/B/C/D/E. If I manually set my constructor node to Method A, then B, then C, VI scripting lets me change it to A, B, and C, but not D or E. If I manually configure it to method D, now I can change it to A, B, C, and D, but still not E, until I manually configure it to E- then I can do whatever.

 

Any tips on getting this to work? I'm using "Assembly.LoadFrom" then "Assembly.GetTypes" to get a list of all Types. I thought this would pull the whole assembly into memory but it appears I'm not understanding something. 

0 Kudos
Message 1 of 6
(728 Views)

Well, you're ahead of me.  I can't even create a property node for a contructor.

0 Kudos
Message 2 of 6
(654 Views)
Solution
Accepted by BertMcMahan

Hi Bert,

 

What about using private VI Server Application method ".NET > Load Assembly to ObjMgr" prior to scripting the constructor node?

raphschru_0-1778489736781.png

 

See https://forums.ni.com/t5/LabVIEW/Scripting-a-NET-Constructor-Node-in-LabVIEW/m-p/4154118#M1198663

However, I haven't found a way to select a specific constructor implementation.

 

Regards,

Raphaël.

Message 3 of 6
(632 Views)

@paul_a_cardinale wrote:

Well, you're ahead of me.  I can't even create a property node for a contructor.


I "cheated" and just used a VI with one on there already as a template (not a .vit or anything).

 

@raphschru wrote:

Hi Bert,

 

What about using private VI Server Application method ".NET > Load Assembly to ObjMgr" prior to scripting the constructor node?

 

 

See https://forums.ni.com/t5/LabVIEW/Scripting-a-NET-Constructor-Node-in-LabVIEW/m-p/4154118#M1198663

However, I haven't found a way to select a specific constructor implementation.

 

Regards,

Raphaël.



That did it, thanks a ton! I don't have the "which specific constructor do you want" issue so I can't comment there, but after calling the private VI you mentioned I can now set my constructor node to whichever specific constructor I need. Thanks for the tip!

0 Kudos
Message 4 of 6
(593 Views)

Creating the constructor node is easily done:

raphschru_0-1778596400198.png

Message 5 of 6
(543 Views)

@raphschru wrote:

Creating the constructor node is easily done:

raphschru_0-1778596400198.png


Here it is wrapped up in a callable VI.

paul_a_cardinale_0-1778607859341.png

 

Message 6 of 6
(523 Views)