TrumpfTruMark5000#
Controls a Trumpf TruMark 5000 series laser marker from Python (TLV commands over TCP/IP). In demo mode no hardware is accessed. This class inherits from MeasmaticDevice.
property configuration#
Gets the configuration of the laser marker.
Returns#
| Type | Description |
|---|---|
| Any | The device configuration (.NET type TrumpfTruMarkConfiguration ). |
Example#
marker = measmatic.get_device('device-laser')
config = marker.configuration
property demo_mode#
Indicates whether the device runs in simulation mode without connecting to actual hardware.
Returns#
| Type | Description |
|---|---|
| bool | True if the device runs in demo mode, otherwise False . |
Example#
marker = measmatic.get_device('device-laser')
is_demo = marker.demo_mode
method initialize(comm: Any)#
Initializes the device. In demo mode the device is only marked as initialized.
Parameters#
| Name | Description |
|---|---|
| comm | Optional communicator (.NET type Atv.Framework.Communication.Contracts.ICommunicator ) to use instead of |
Example#
marker = measmatic.get_device('device-laser')
marker.initialize()
method laser_mark()#
Executes the marking of the loaded marking file. Raises an error if the device reports one, e.g. no marking file loaded or laser / pilot laser switched off.
Example#
marker = measmatic.get_device('device-laser')
marker.laser_mark()
method laser_offsets(power_offset: float, frequency_offset: float = 0, speed_offset: float = 0, defocus_offset: float = 0, pulsewidth_offset: float = 0, offset_Z: float = 0)#
Sets the laser parameter offsets used for subsequent markings.
Parameters#
| Name | Description |
|---|---|
| power_offset | The power offset in percent (-100 to 100). |
| frequency_offset | The frequency offset in Hz. Default: 0 |
| speed_offset | The speed offset in mm/s. Default: 0 |
| defocus_offset | The defocus offset in mm. Default: 0 |
| pulsewidth_offset | The pulse width offset in microseconds. Default: 0 |
| offset_Z | The Z axis offset in mm. Default: 0 |
Example#
marker = measmatic.get_device('device-laser')
marker.laser_offsets(-10.0, speed_offset=50.0)
method laser_power(power: int)#
Sets the laser power in percent.
Parameters#
| Name | Description |
|---|---|
| power | The laser power in percent (0 to 100). |
Example#
marker = measmatic.get_device('device-laser')
marker.laser_power(80)
method laser_reset()#
Resets the laser.
Example#
marker = measmatic.get_device('device-laser')
marker.laser_reset()
method laser_status()#
Requests the laser status bits (e.g. laser ready, shutter open, pilot laser on).
Returns#
| Type | Description |
|---|---|
| Any | The status structure (.NET type TrumpfLaserStatus ) with one boolean field per status bit. |
Example#
marker = measmatic.get_device('device-laser')
status = marker.laser_status()
print(status.LaserReady)
method laser_status(on: bool)#
Switches the laser on or off.
Parameters#
| Name | Description |
|---|---|
| on | True to switch the laser on, False to switch it off. |
Example#
marker = measmatic.get_device('device-laser')
marker.laser_status(True)
method last_error_text()#
Queries the text of the last error reported by the laser marker.
Returns#
| Type | Description |
|---|---|
| str | The error code and error text. Empty in demo mode. |
Example#
marker = measmatic.get_device('device-laser')
text = marker.last_error_text()
method last_warning_text()#
Queries the text of the last warning reported by the laser marker.
Returns#
| Type | Description |
|---|---|
| str | The warning code and warning text. Empty in demo mode. |
Example#
marker = measmatic.get_device('device-laser')
text = marker.last_warning_text()
method mark_offsets(dx: float, dy: float, scale: float = 1.0, rotate: float = 0)#
Displaces, scales and rotates the marking pattern for the following marking.
Parameters#
| Name | Description |
|---|---|
| dx | The displacement in X direction in mm. |
| dy | The displacement in Y direction in mm. |
| scale | The scaling factor (1.0 leaves the pattern unchanged). Default: 1.0 |
| rotate | The rotation angle in degrees, clockwise around the center of the image field. Default: 0 |
Example#
marker = measmatic.get_device('device-laser')
marker.mark_offsets(1.5, -2.0, rotate=90)
method pilot_laser(on: bool)#
Switches the pilot laser on or off.
Parameters#
| Name | Description |
|---|---|
| on | True to switch the pilot laser on, False to switch it off. |
Example#
marker = measmatic.get_device('device-laser')
marker.pilot_laser(True)
method read_all_inputs()#
Reads all 24 digital inputs of the laser marker.
Returns#
| Type | Description |
|---|---|
| Any | The input states as unsigned integer (.NET type UInt64 ). |
Example#
marker = measmatic.get_device('device-laser')
inputs = marker.read_all_inputs()
method read_input_bit(bit: bytes)#
Reads a single digital input of the laser marker.
Parameters#
| Name | Description |
|---|---|
| bit | The zero-based index of the input to read (0 to 23). |
Returns#
| Type | Description |
|---|---|
| bool | True if the input is high, otherwise False . |
Example#
marker = measmatic.get_device('device-laser')
is_set = marker.read_input_bit(3)
method read_input_byte(b: Any)#
Reads one group of eight digital inputs of the laser marker.
Parameters#
| Name | Description |
|---|---|
| b | The input byte to read (.NET enum TrumpfTruMark5000.InputByte : Byte1_8, Byte9_16 or Byte17_24). |
Returns#
| Type | Description |
|---|---|
| Any | The input byte (.NET type Byte , 0 to 255). |
Example#
from Atv.Framework.Devices.LaserMarker.TrumpfTruMark5000 import TrumpfTruMark5000
marker = measmatic.get_device('device-laser')
value = marker.read_input_byte(TrumpfTruMark5000.InputByte.Byte1_8)
method set_mark_file(file: str)#
Loads a marking file into the laser marker. The file has to be present locally on the laser marker system. If no extension is given, the default extension ".vlf" is used. If no directory is given, the directory of the last loaded marking file or the one set with set_path is used.
Parameters#
| Name | Description |
|---|---|
| file | The name of the marking file, including the directory. |
Example#
marker = measmatic.get_device('device-laser')
marker.set_mark_file('C:\\marking\\logo.vlf')
method set_outout_byte(b: Any, value: bytes)#
Sets one group of eight digital outputs of the laser marker (Byte1_8 or Byte9_16).
Parameters#
| Name | Description |
|---|---|
| b | The output byte to set (.NET enum TrumpfTruMark5000.OutputByte ). |
| value | The bit pattern to output (0 to 255). |
Example#
from Atv.Framework.Devices.LaserMarker.TrumpfTruMark5000 import TrumpfTruMark5000
marker = measmatic.get_device('device-laser')
marker.set_outout_byte(TrumpfTruMark5000.OutputByte.Byte1_8, 0x0F)
method set_output_bit(bit: bytes, value: bool)#
Sets a single digital output of the laser marker to high or low.
Parameters#
| Name | Description |
|---|---|
| bit | The zero-based index of the output (0 to 15). |
| value | True for high, False for low. |
Example#
marker = measmatic.get_device('device-laser')
marker.set_output_bit(2, True)
method set_path(path: str)#
Sets the directory from which marking files are loaded, so that set_mark_file can be used without a directory.
Parameters#
| Name | Description |
|---|---|
| path | The directory name. |
Example#
marker = measmatic.get_device('device-laser')
marker.set_path('C:\\marking')
method set_pilot_laser_mode(rectangle: bool, continous: bool, speed: int)#
Sets the marking mode of the pilot laser. In continuous mode the pilot laser can only be stopped by an interrupt command of the laser marker, not by laser_mark .
Parameters#
| Name | Description |
|---|---|
| rectangle | True to trace a rectangle around the pattern, False to trace the contour. |
| continous | True for continuous operation, False to trace once. |
| speed | The pilot laser speed in mm/s. |
Example#
marker = measmatic.get_device('device-laser')
marker.set_pilot_laser_mode(True, False, 500)