LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ActiveX - LabView from C#

Solved!
Go to solution

Hello,

 

I am creating a program in LabView from a already developed program in C# which uses ActiveX for controlling a laser machine.

 

The first thing I see in the program is the initialization of the ActiveX server and equipment system:

 

Laser = new LaserAxApp();

 

LaserSystem = Laser.System;

 

I found a refNum in labview with LaserAxApp but in their properties I found systems inside ILaserAxApp property. But also I found another refNum called laserengineLib.ISystem which is another class reference like AxApp.

 

which one should I choose to continue implementing my program from C#?

 

thanks in advanced,

0 Kudos
Message 1 of 5
(3,790 Views)

Hello,

My name is Ed and I am with National Instruments Technical support. I’m happy to assist with this issue you are having, firstly I will need more information as to the overall system and just clarify what it is you are trying to achieve.

Am I correct in assuming that what you want is LabVIEW to communicate with C# through ActiveX (COM) and then C# also communicates to the laser machine through ActiveX and in this way you are able to control the laser machine from LabVIEW? Is the C# also a .dll file or an executable and do you also have access to the original source code or documentation as to the library/application code?

In the mean time I will continue to research in specifically communicating with C# from LabVIEW, as I understand it the process is very similar to that of .NET development for communication between C# and LabVIEW. The properties you are referring to I believe are that of classes in C# yes, where LaserAxApp could be the main object for the laser machine and laserengineLib.ISystem referring to a library which is used but this can only be confirmed by inspecting the C# code itself.

Here is one thread already solved referring to C# and ActiveX with LabVIEW which may be of some use to you:

http://forums.ni.com/t5/LabVIEW/Calling-ActiveX-dll-in-Labview/m-p/802573#U802573

Also included are two white papers which outline ActiveX in terms of the LabVIEW programming itself and the concepts behind these.

http://www.ni.com/white-paper/2983/en/

http://www.ni.com/white-paper/3831/en/

Regards,

Ed.

0 Kudos
Message 2 of 5
(3,624 Views)

If I read your post correctly, you intend to write a program, formerly written in C#, entirely in LabVIEW, including using LabVIEW calls to reference ActiveX calls and code that you are "lifting" from the not-being-otherwise-used C# code.  If this is true, it would seem like the simplest thing to try is to write a tiny LabVIEW routine that gets tha appropriate ActiveX reference to your device, do just enough to ensure that you can "do something" (like get a status back, or get a Version number), and exit.  If this works, then start building the rest of your LabVIEW code.

 

Bob Schor

Message 3 of 5
(3,608 Views)

Hey,

 

I have a C# program, but I want to translate that program into Labview parameters. So, no, I do not want to use anything related to C#. That is just a reference to have a working program.

So if that program works with my device, I want to make a Labview program based on ActiveX events, that works too.

 

You can follow my program in this thread:

 

http://forums.ni.com/t5/LabVIEW/activex-Reg-Event-Callback-Leds/m-p/3173823/highlight/false#M917094

0 Kudos
Message 4 of 5
(3,578 Views)
Solution
Accepted by topic author Stavrosyt

@Stavrosyt wrote:

Hello,

 

I am creating a program in LabView from a already developed program in C# which uses ActiveX for controlling a laser machine.

 

The first thing I see in the program is the initialization of the ActiveX server and equipment system:

 

Laser = new LaserAxApp();

 

LaserSystem = Laser.System;

 

I found a refNum in labview with LaserAxApp but in their properties I found systems inside ILaserAxApp property. But also I found another refNum called laserengineLib.ISystem which is another class reference like AxApp.

 

which one should I choose to continue implementing my program from C#?

 

thanks in advanced,


Thanks anyway...I manage to find the answer.

 

It just works with properties and methods from the ActiveX menu in Labview. To answer my own question, the result is to use iLaseraxapp and ilasersystem refnums.

 

Here is better explained:

 

1) Start the laser with laserengineLib.ILaserAxApp refnum

2) use automation open function to open it and

3) link it with a property node IlaserAxApp system (true visible).

 

And that's it. then you can use same system lib for reg event callback, and ilaserdoc for loading a laser xlp file.

 

0 Kudos
Message 5 of 5
(3,434 Views)