Getting Started With Loehnert.Lisrt.Laser.Keyence
Communication With the Keyence Marking Laser
This package provides several methods to communicate with the marking laser and the Marking Builder software:
Commands via TCP/IP (required)
The primary method for sending commands to the laser.OPC/UA for file transfer (optional)
Used for transferring files to and from the laser.Marking Builder ActiveX Control (optional)
Used to create TrueType font blocks or measure the size of blocks (see ).
Requires a MarkingBuilder installation.
The MarkingBuilder ActiveX controls (.ocx
files in the MarkingBuilder installation directory) must be registered. See Register ActiveX controls manually for instructions.
Create a Job From Code
This example creates a job and uploads it to the marking laser.
import clr
clr.AddReference("Loehnert.Lisrt.Laser.Keyence")
from Loehnert.Lisrt.Laser.Keyence.Jobs import Job, HorizontalTextBlock, QRCodeBlock, FontType
job = Job()
# Create a text block
txt = HorizontalTextBlock(FontType.TrueType)
txt.Position.X = 5
txt.Position.Y = 10
txt.Content = 'Hallo'
job.Blocks.Add(txt)
# Create a QR code block
qr = QRCodeBlock()
qr.Content = '1234567890'
job.Blocks.Add(qr)
# Upload the job to the laser to position 100
Laser.UploadJob(job=job, jobIndex=100)
Use the ViewModelFactory to create a preview of the job.