LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Controling a LabVIEW VI from C#

Hello,
 
I'm writing a C# program that calls LabVIEW  VI's using the ActiveX automation interface.
Getting started was quite straightforward (Load a VI, set/get simple parameters, run VI, etc...), but I could not figure out how to pass "clusters" from my C# program to LabVIEW...
The help for the "VirtualInstrument.call" method mentions a cluster should be treated as an array of variants - any example available?
I also noticed a "LabVIEWTypes" assembly that seems to have been created to allow manipulation of waveform data types was available- Did anyone experimented with this already?
...Any information would be appreciated!
Regards
0 Kudos
Message 1 of 2
(2,316 Views)

I could figure it out ...

In .NET, there are no variants anymore - everything derives from "object" and so we need to create an array of object - each object in this array being a "field" of our cluster.

Let's consider a cluster that contains 3 numeric (double), we would control it from C# in the following manner :

//settings cluster [cluster = array of objects]

object[] myCluster;

//declare settings "cluster"

myCluster =

new object[3];

myCluster

[0] =
new double(); //

myCluster

[1] = new double(); //

myCluster

[2] = new double(); //

//assign values to settings cluster

myCluster

[0] = 3.14;
//

myCluster

[1] = 1.2;
//

myCluster

[2] = 2.3;
//

//Write value to the LabVIEW cluster

myVI.SetControlValue("<clusterName>", myCluster);

 

Enjoy...

0 Kudos
Message 2 of 2
(2,298 Views)