Base Thorlabs.MotionControl class.[source]

Returns a reference to the DeviceManager library.

The Thorlabs.MotionControl.DeviceManager.dll library must be available on os.environ['PATH'].


ctypes.CDLL – A reference to the library.

class, api_function, build_device_list=False)[source]

Bases: ConnectionSDK

Base Thorlabs.MotionControl class.

Do not instantiate this class directly. Use the connect() method to connect to the equipment.


ThorlabsError – If a connection to the device cannot be established.

Benchtop_Brushless_Motor = 73

Benchtop Brushless Motor device ID

Benchtop_NanoTrak = 22

Benchtop NanoTrak device ID

Benchtop_Piezo_1_Channel = 41

Benchtop Piezo 1-Channel device ID

Benchtop_Piezo_3_Channel = 71

Benchtop Piezo 3-Channel device ID

Benchtop_Stepper_Motor_1_Channel = 40

Benchtop Stepper Motor 1-Channel device ID

Benchtop_Stepper_Motor_3_Channel = 70

Benchtop Stepper Motor 3-Channel device ID

Filter_Flipper = 37

Filter Flipper device ID

Filter_Wheel = 47

Filter Wheel device ID

KCube_Brushless_Motor = 28

KCube Brushless Motor device ID

KCube_DC_Servo = 27

KCube DC Servo device ID

KCube_Inertial_Motor = 97

KCube Inertial Motor device ID

KCube_LaserSource = 56

KCube Laser Source device ID

KCube_NanoTrak = 57

KCube NanoTrak device ID

KCube_Piezo = 29

KCube Piezo device ID

KCube_Solenoid = 68

KCube Solenoid device ID

KCube_Stepper_Motor = 26

KCube Stepper Motor device ID

Long_Travel_Stage = 45

Long Travel Stage device ID

Cage_Rotator = 55

Cage Rotator device ID

LabJack_490 = 46

LabJack 490 device ID

LabJack_050 = 49

LabJack 050 device ID

Modular_NanoTrak = 52

Modular NanoTrak device ID

Modular_Piezo = 51

Modular Piezo device ID

Modular_Stepper_Motor = 50

Modular Stepper Motor device ID

TCube_Brushless_Motor = 67

TCube Brushless Motor device ID

TCube_DC_Servo = 83

TCube DC Servo device ID

TCube_Inertial_Motor = 65

TCube Inertial Motor device ID

TCube_LaserSource = 86

TCube Laser Source device ID

TCube_LaserDiode = 64

TCube Laser Diode device ID

TCube_NanoTrak = 82

TCube NanoTrak device ID

TCube_Quad = 89

TCube Quad device ID

TCube_Solenoid = 85

TCube Solenoid device ID

TCube_Stepper_Motor = 80

TCube Stepper_Motor device ID

TCube_Strain_Gauge = 84

TCube Strain Gauge device ID

TCube_TEC = 87

TCube TEC device ID

Vertical_Stage = 24

Vertical Stage device ID

errcheck_api(result, func, args)[source]

The API function returns OK if the function call was successful.

errcheck_true(result, func, args)[source]

The API function returns True if the function call was successful.


Disconnect and close the device.

property settings

The device settings specified in ThorlabsDefaultSettings.xml

If this is an empty dict then you can specify the device_name in the properties field in the Connections Database or you can run the Kinesis software and allow Kinesis to configure the actuator that is connected to the motor controller.

The possible values for device_name can be found in the ThorlabsDefaultSettings.xml file (located in the Kinesis installation folder, e.g., C:Program FilesThorlabsKinesis). as the Name value in one of the <DeviceSettingsType> tags.



static build_device_list()[source]

Build the device list.

This function builds an internal collection of all devices found on a USB port that are not currently open.


If a device is open, it will not appear in the list until the device has been closed.


ThorlabsError – If the device list cannot be built.

static get_device_list_size()[source]

int: The number of devices in the device list.

static get_device_list(*device_ids)[source]

Get the contents of the device list which match the supplied device IDs.


device_ids (int) – A sequence of device ID’s.


list of str – A list of device serial numbers for the specified device ID(s).


ThorlabsError – If there was an error getting the device list.

static get_device_info(serial_number)[source]

Get the device information from a USB port.

The device info is read from the USB port not from the device itself.


serial_number (str) – The serial number of the device.


structs.TLI_DeviceInfo – A DeviceInfo structure.


ThorlabsError – If there was an error getting the device information.

static to_version(dword)[source]

Convert the firmware or software number to a string.

The number is made up of 4-byte parts.

See the get_firmware_version() or the get_software_version() method of the appropriate Thorlabs MotionControl subclass.


dword (int) – The firmware or software number.


str – The string representation of the version number.

static convert_message(msg_type, msg_id, msg_data)[source]

Converts the message into a dict.

See the get_next_message() or the wait_for_message() method of the appropriate Thorlabs MotionControl subclass.

  • msg_type (int) – The message type defines the device type which raised the message.

  • msg_id (int) – The message ID for the msg_type.

  • msg_data (int) – The message data.


dict – The message represented as

{ 'type': MessageTypes, 'id': MessageID, 'data': int }