10-08-2018 02:23 AM
Is there anyway to create a Enum which calls a .NET assembly method at the instant that is set at LabVIEW's Diagram Block? Just as VISA do to show Serial Ports and select one before run,
10-08-2018 05:48 AM
If you can enumerate the values that you wish your Enum to take, you can use LabVIEW Scripting to create an Enum (whose name you choose) that will take on those Values. Scripting is, by default, not enabled -- you need to go into Tools, Options, VI Server and enable it there. You can find Tutorials and Examples by doing a Web search for VI Scripting.
Bob Schor
10-08-2018 06:03 AM
No scripting required, IIRC. Strings[] is a normal VI Server Enum property. The Enum must be idle though, so you can only set the strings if the enum is in a idle VI, or if it's a control that's not used in a running VI..
10-08-2018 07:48 PM
Thanks for your response.
What I'm looking for is more like Visa Resource Constant do, I mean, an element that, in moment I set it in the Diagram Block, displays a list, just like a Enum, but the elements on the list have been obtained from a method , and I can select one before run my program.
The problem is that, as I know, if I use LabVIEW scripting, my procedure should be, open my VI where the list will be created and run another one where is the program that will create my list on the first VI, and I will need to do that procedure each time I want to work with that constant.
So.. is this possible on LabVIEW?
10-09-2018 03:02 AM
@Rodmen wrote:
What I'm looking for is more like Visa Resource Constant do, I mean, an element that, in moment I set it in the Diagram Block, displays a list, just like a Enum, but the elements on the list have been obtained from a method , and I can select one before run my program.
Where does .NET fit in?
Where would this Enum get it's values from?
@Rodmen wrote:
The problem is that, as I know, if I use LabVIEW scripting, my procedure should be, open my VI where the list will be created and run another one where is the program that will create my list on the first VI, and I will need to do that procedure each time I want to work with that constant.
Well, that depends on the situation.
Another scheme would be to create (type def'ed) enums for all values in a .NET assembly once. Then use the appropriate enum when the function is used.
@Rodmen wrote:
So.. is this possible on LabVIEW?
Short answer: no.
Slightly longer answer: Only with an XNode or maybe an Express VI. I wouldn't recommend XNodes, they require (mostly undocumented) advanced scripting. No experience with Express VIs, but most of us don't even like to use them, let alone create them.
I'd go for a workaround...