Class LaserModule
Represents a Keyence marking laser.
public class LaserModule : InitializableCompositeModule, ICompositeModule, ILisrtModule, IInitializable, INotifyPropertyChangedEx, INotifyPropertyChanged, IHasServiceView, IHasDeviceLabel
- Inheritance
-
PropertyChangedBaseLaserModule
- Implements
-
INotifyPropertyChangedEx
- Inherited Members
-
PropertyChangedBase.Refresh()PropertyChangedBase.IsNotifyingPropertyChangedBase.PropertyChanged
Remarks
Performance Improvement
To speed up modifying a program, open a program using the CreateJob(int, int) method and close it after modification using the EndJob(int) method. This means that the program only has to be verified once, and not with every change.Constructors
LaserModule(string, ICommunication)
Initializes a new instance of the LaserModule class.
public LaserModule(string name, ICommunication communication)
Parameters
name
stringModule Name.
communication
ICommunicationInstance of communication module.
Properties
DefaultTimeout
Gets or sets default timeout in milliseconds.
[Configuration(1000)]
public int DefaultTimeout { get; set; }
Property Value
DeviceLabel
Gets or sets the label for the device.
[Configuration("Keyence")]
public string DeviceLabel { get; set; }
Property Value
DeviceState
Gets the device state.
public DeviceState DeviceState { get; }
Property Value
Errors
Gets the current errors.
public IEnumerable<string> Errors { get; }
Property Value
InstanceID
Gets or sets the ID for this instance.
[Configuration(0)]
public int InstanceID { get; set; }
Property Value
LastReceivedResponse
Gets last received response from laser.
public string LastReceivedResponse { get; }
Property Value
LastSentCommand
Gets last sent command.
public string LastSentCommand { get; }
Property Value
MarkingBuilderVersion
Gets or sets current Marking Builder Version.
[Configuration(MarkingBuilderVersion.MB3)]
public MarkingBuilderVersion MarkingBuilderVersion { get; set; }
Property Value
Methods
ClearError()
Clears error memory on laser and updates error state collection afterwards.
public void ClearError()
Exceptions
- NotInitializedException
Throw when the module is not initialized.
- LaserException
Thrown when the marking laser returns an error.
CreateJob(int, int)
Opens a program for creation or modification.
public void CreateJob(int programNumber, int timeoutInMs = 1000)
Parameters
programNumber
intNumber of program to create or modify.
timeoutInMs
intTimespan in milliseconds after which an exception is thrown when device does not return an answer.
Exceptions
- NotInitializedException
Throw when the module is not initialized.
- LaserException
Thrown when the marking laser returns an error.
EndJob(int)
Ends creation or modification of a program.
public void EndJob(int timeoutInMs = 1000)
Parameters
timeoutInMs
intTimespan in milliseconds after which an exception is thrown when device does not return an answer.
Exceptions
- NotInitializedException
Throw when the module is not initialized.
- LaserException
Thrown when the marking laser returns an error.
Initialize()
Initializes laser module.
public override void Initialize()
Read2DCode(Read2DCodeParameters, int)
Reads a 2D code.
public Read2DCodeResult Read2DCode(Read2DCodeParameters writeValues, int timeoutInMs = 1000)
Parameters
writeValues
Read2DCodeParametersCode read settings.
timeoutInMs
intTimespan in milliseconds after which an exception is thrown when device does not return an answer.
Returns
- Read2DCodeResult
return values of scan operation depending on marking builder version.
Exceptions
- NotInitializedException
Throw when the module is not initialized.
- LaserException
Thrown when the marking laser returns an error.
ReadCameraImageSetting(Targets)
Reads the camera image settings from laser.
public CameraImageSettings ReadCameraImageSetting(Targets targets)
Parameters
targets
TargetsTarget parameters for communication.
Returns
- CameraImageSettings
Settings read from laser.
Exceptions
- ArgumentNullException
Thrown when any argument is null.
- NotSupportedException
Thrown when the MarkingBuilderVersion property is MB3.
- NotInitializedException
Throw when the module is not initialized.
- LaserException
Thrown when the marking laser returns an error.
ReadCharacterString(Targets)
Reads last marked character string on laser.
public string ReadCharacterString(Targets targets)
Parameters
targets
TargetsTarget parameters for communication.
Returns
- string
Last marked character string.
Exceptions
- ArgumentNullException
Thrown when any argument is null.
- NotInitializedException
Throw when the module is not initialized.
- LaserException
Thrown when the marking laser returns an error.
ReadCodeReaderLightSetting(Targets)
Reads the code reader lighting settings.
public CodeReaderLightSettings ReadCodeReaderLightSetting(Targets targets)
Parameters
targets
TargetsTargets.
Returns
- CodeReaderLightSettings
Parameters read from laser.
Exceptions
- ArgumentNullException
Thrown when any argument is null.
- NotSupportedException
Thrown when the MarkingBuilderVersion property is MB3.
- NotInitializedException
Throw when the module is not initialized.
- LaserException
Thrown when the marking laser returns an error.
ReadCodeReaderSetting(Targets)
Reads code reader settings from Laser.
public CodeReaderSettings ReadCodeReaderSetting(Targets targets)
Parameters
targets
TargetsTarget parameters for communication.
Returns
- CodeReaderSettings
parameters read from laser.
Exceptions
- ArgumentNullException
Thrown when any argument is null.
- NotSupportedException
Thrown when the MarkingBuilderVersion property is MB3.
- NotInitializedException
Throw when the module is not initialized.
- LaserException
Thrown when the marking laser returns an error.
ReadCounter(Targets)
Read laser counter parameters from Laser.
public CounterValues ReadCounter(Targets targets)
Parameters
targets
Targetstarget parameters for communication.
Returns
- CounterValues
parameters read from laser.
Exceptions
- ArgumentNullException
Thrown when any argument is null.
- NotInitializedException
Throw when the module is not initialized.
- LaserException
Thrown when the marking laser returns an error.
ReadGroupOffset(Targets)
Reads the offset of a group.
public GroupOffset ReadGroupOffset(Targets targets)
Parameters
targets
TargetsTarget the group is belonging to. See GroupNumber.
Returns
- GroupOffset
The offset of a group.
Exceptions
- ArgumentNullException
Thrown when any argument is null.
ReadLastCodeResult(int)
Reads 2D-Code from Laser with marking builder version MBPLUS.
public Read2DCodeResult ReadLastCodeResult(int timeoutInMS = 1000)
Parameters
timeoutInMS
intTimespan in milliseconds after which an exception is thrown when device does not return an answer.
Returns
- Read2DCodeResult
results of last scan operation.
Exceptions
- NotInitializedException
Throw when the module is not initialized.
- LaserException
Thrown when the marking laser returns an error.
ReadLastWindowCheckAfterMarkingResult(int)
Reads the last window check after marking result. Requires marking builder version MBPLUS.
public WindowCheckResult ReadLastWindowCheckAfterMarkingResult(int timeoutInMS = 1000)
Parameters
timeoutInMS
intTimespan in milliseconds after which an exception is thrown when device does not return an answer.
Returns
- WindowCheckResult
results of last window check.
Exceptions
- NotSupportedException
Thrown when the MarkingBuilderVersion is MB3.
- NotInitializedException
Throw when the module is not initialized.
- LaserException
Thrown when the marking laser returns an error.
ReadMarkingConfirmationResult()
Reads the last marking confirmation result.
public MarkingConfirmationResult ReadMarkingConfirmationResult()
Returns
- MarkingConfirmationResult
The result of the last marking confirmation.
ReadOnTheFlyParameters(Targets)
Reads OnTheFly settings from Laser.
public OnTheFlySettings ReadOnTheFlyParameters(Targets targets)
Parameters
targets
TargetsTarget parameters for communication.
Returns
- OnTheFlySettings
Parameters read from laser.
Exceptions
- ArgumentNullException
Thrown when any argument is null.
- NotInitializedException
Throw when the module is not initialized.
- LaserException
Thrown when the marking laser returns an error.
ReadProgramNumber()
Reads loaded program number from laser.
public int ReadProgramNumber()
Returns
- int
parameters read from laser.
Exceptions
- ArgumentNullException
Thrown when any argument is null.
- NotInitializedException
Throw when the module is not initialized.
- LaserException
Thrown when the marking laser returns an error.
ReadWindowCheckAfterMarkingAlarmThreshold(Targets)
Reads the alarm threshold value for window check with marking builder version MBPLUS.
public int ReadWindowCheckAfterMarkingAlarmThreshold(Targets targets)
Parameters
targets
Targetslaser targets.
Returns
- int
Alarm threshold in percent.
Exceptions
- ArgumentNullException
Thrown when
targets
is null.- NotSupportedException
Thrown when the MarkingBuilderVersion is MB3.
- NotInitializedException
Throw when the module is not initialized.
- LaserException
Thrown when the marking laser returns an error.
ShowServiceView()
Shows the service window.
public void ShowServiceView()
StartMarking(int)
Starts the loaded program.
public void StartMarking(int timeoutInMs = 1000)
Parameters
timeoutInMs
intTimespan in milliseconds after which an exception is thrown when device does not return an answer.
Exceptions
- NotInitializedException
Throw when the module is not initialized.
- LaserException
Thrown when the marking laser returns an error.
StopMarking()
Stops a running marking operation.
public void StopMarking()
Exceptions
- NotInitializedException
Throw when the module is not initialized.
- LaserException
Thrown when the marking laser returns an error.
UpdateDeviceState()
Updates device state Properties and error state collection afterwards.
public void UpdateDeviceState()
Exceptions
- NotInitializedException
Throw when the module is not initialized.
- LaserException
Thrown when the marking laser returns an error.
UpdateErrorState()
Updates the Errors.
public void UpdateErrorState()
Exceptions
- NotInitializedException
Throw when the module is not initialized.
- LaserException
Thrown when the marking laser returns an error.
WriteCameraImageSetting(Targets, CameraImageSettings)
Writes camera image settings to Laser.
public void WriteCameraImageSetting(Targets targets, CameraImageSettings writeValues)
Parameters
targets
Targetstarget parameters for communication.
writeValues
CameraImageSettingssettings to be written to laser.
Exceptions
- ArgumentNullException
Thrown when any argument is null.
- NotInitializedException
Throw when the module is not initialized.
- LaserException
Thrown when the marking laser returns an error.
WriteCharacterString(Targets, string)
Writes the marking string to the laser.
public void WriteCharacterString(Targets targets, string markingCharacters)
Parameters
Remarks
- This command can be sent to a block No. having the block type (BlockType) of “-4: Hatch logo/-3: Photo/-2: Workpiece image/-1: Logo/00: Horizontal characters/01: Vertical characters/02: Arc clockwise/03: Arc counterclockwise/09: Barcode/2D Code”.
- To send a “, (comma)” as a string, send it in the form of “%044A” (ASCII).
- To send a “%” as a string, send it in the form of “%%” (ASCII).
Exceptions
- ArgumentNullException
Thrown when any argument is null.
- NotInitializedException
Throw when the module is not initialized.
- LaserException
Thrown when the marking laser returns an error.
WriteCodeReaderSetting(Targets, CodeReaderSettings)
Writes code reader settings to Laser.
public void WriteCodeReaderSetting(Targets targets, CodeReaderSettings writeValues)
Parameters
targets
TargetsTarget parameters for communication.
writeValues
CodeReaderSettingsparameters to be written to laser.
Exceptions
- ArgumentNullException
Thrown when any argument is null.
- NotInitializedException
Throw when the module is not initialized.
- LaserException
Thrown when the marking laser returns an error.
WriteCounter(Targets, CounterValues)
Write counter settings to laser.
public void WriteCounter(Targets targets, CounterValues writeValues)
Parameters
targets
TargetsTarget parameters for communication.
writeValues
CounterValuesparameters to be written to laser.
Exceptions
- ArgumentNullException
Thrown when any argument is null.
- NotInitializedException
Throw when the module is not initialized.
- LaserException
Thrown when the marking laser returns an error.
WriteGroupOffset(Targets, GroupOffset)
Sets the offset of a group.
public void WriteGroupOffset(Targets targets, GroupOffset groupOffset)
Parameters
targets
TargetsTarget the group is belonging to. See GroupNumber.
groupOffset
GroupOffsetOffset to set.
Exceptions
- ArgumentNullException
Thrown when any argument is null.
WriteOnTheFlyParameters(Targets, OnTheFlySettings)
Writes OnTheFly settings to Laser.
public void WriteOnTheFlyParameters(Targets targets, OnTheFlySettings writeValues)
Parameters
targets
TargetsTarget parameters for communication.
writeValues
OnTheFlySettingsOnTheFly parameters to be written to laser.
Exceptions
- ArgumentNullException
Thrown when any argument is null.
- NotInitializedException
Throw when the module is not initialized.
- LaserException
Thrown when the marking laser returns an error.
WriteProgramNumber(int)
Writes new program number to laser.
public void WriteProgramNumber(int programNumber)
Parameters
programNumber
intNew program number.
Exceptions
- ArgumentNullException
Thrown when any argument is null.
WriteWindowCheckAfterMarkingAlarmThreshold(Targets, int)
Writes alarm threshold value for window check to laser.
public void WriteWindowCheckAfterMarkingAlarmThreshold(Targets targets, int alarmThreshold)
Parameters
Exceptions
- ArgumentNullException
Thrown when
targets
is null.- ArgumentOutOfRangeException
Throw when
alarmThreshold
is less than 0 or greater than 100.- NotSupportedException
Thrown when the MarkingBuilderVersion is MB3.
- NotInitializedException
Throw when the module is not initialized.
- LaserException
Thrown when the marking laser returns an error.