LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Insert Xcontrol into a class

Solved!
Go to solution

Hi, 

Hope that I describe my issue properly.
I would like to insert Thorlabs Kinesis motor reference (if I understand correctly it's a XControl) into  a class. I think the image below will assist to demonstrate my issue. 

 

Block Diagram:

Tamir87_0-1698954410419.png 

Front Panel:

Tamir87_1-1698954460872.png
Kinesis Motor is the parent and i have some kind of motors which are the childs. 

Attaching another Image how it looks inside:

Tamir87_3-1698954621645.png

 

I guess that my approach is wrong, how can I deal with this issue..? 
I can Provide example code and more details if required, 
Using LV2018 32bit. 

Kindly ask for your Help

0 Kudos
Message 1 of 5
(19,882 Views)

Thorlabs Kinesis is not an Xcontrol, it's a .NET control.

 

If you want to put multiple motor types into the same reference storage, you need to set the reference storage to be a common .NET class or interface that all your motors share.

 

Playing with .NET classes in LabVIEW can be tricky though.  Before I give more advice, do you actually want to see and use those controls, or do you just want to send commands to the motors and you don't need a visual display?

0 Kudos
Message 2 of 5
(19,867 Views)

Thanks for responding my topic 

 

First the answer is yes, I would like to use the control and also send commands and receive data.

 

The ideal thing for me is that I will be able to choose between the controls (before run) and see only one of them (while VI is running) on the front panel but this is on a less priority. 

 

Before posting this topic i tried to look for a more generic class but didn't find. So yes I kindly ask your advice. 

0 Kudos
Message 3 of 5
(19,858 Views)
Solution
Accepted by Tamir87

The common class I found for those controls is "IDeviceInterface".  You'll need to create it manually.

 

1. Put down either a .NET refnum control or indicator, or a block diagram constant, whichever one you need.

2. Right-click on it, choose Select Class, then choose Browse

3. Find the DLL called ThorLabs.MotionControl.Controls and choose that (might be in the dropdown if already in memory, or you might need to browse to where you store the DLLs)

4. There will probably be 4 namespaces shown, expand the plain one just named "ThorLabs.MotionControl.Controls"

5. Scroll down just a bit to find "IDeviceInterface" and choose that

6. If you wire any of the controls up to that they should be able to be stored as an IDeviceInterface, though they will show a coercion dot.  You can use the standard LabVIEW "to more generic class" on the .NET wire from the control paired with a .NET constant with its class chosen in the same way if you don't like the dot.

 

IDeviceInterface has a lot of the same properties but in order to get the device reference itself (you will need it to do a lot of the actual motion control), you'll have to cast that class back down to KCubeDCServoControl or whatever later to put down a working "Device" property node to get the reference you need to send commands.  But IDeviceInterface should be usable in your top level class for generic storage and a few shared operations (setting the serial number, creating and closing the device, etc.).

Message 4 of 5
(19,842 Views)

Perfect, it solve my issue. 

Thank you man! appreciate your assistance. 

0 Kudos
Message 5 of 5
(19,826 Views)