Scanscript Full
Scanscript Full
ScanScript
Following section describes the lexis, the syntax, and the semantics of ScanMaster™ Script.
Variables
Variables are placeholders for values. The naming conventions for the variables are as follows:
l Names (also called identifiers) can be any string of letters, digits, and underscores, not beginning with a digit.
To use a variable in your ScanScript™, simply type an appropriate name and assign a value or string. ScanScript™ is a dynamically typed language hence the variable type
depends on the value assigned to it.
The equal "=" sign is used as an assignment operator to give a value to a variable. When a variable is declared, a memory space is reserved for it. Such a space is empty until
you fill it with a value.
Variable Types
All variables in ScanScript™ by default are global unless explicitly declared as local. Local variables can be defined by using the keyword local in front of the variable name.
ScanScript™ automatically converts all strings to numbers before subjecting them to an arithmetic operation and converts any numbers to strings where strings are expected.
Control Structures
Conditional statements allow you to control the flow of execution of a script or one of its sections. The conditional statements perform comparisons and act depending on the
outcome of such comparisons.
if
if (condition) then
<Statements>
elseif (condition) then
<Statements>
else
<Statements>
end
while
while (condition) do
<Statements>
end
for
for index = start index, end index [,step value] do
<Statements>
end
repeat
repeat
<loop body>
until <condition>
break
The break keyword allows you to terminate a loop. This statement breaks the inner loop (for, repeat, or while) that contains it; it cannot be used outside a loop. After the
break, the program continues running from the point immediately after the broken loop.
Language Operators
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 2 of 197
Relational Operators
== Indicates whether the value of the left operand is equal to the value of the right operand.
~= Indicates whether the value of the left operand is not equal to the value of the right operand.
< Indicates whether the value of the left operand is less than the value of the right operand.
> Indicates whether the value of the left operand is greater than the value of the right operand.
<= Indicates whether the value of the left operand is less than or equal to the value of the right operand.
>= Indicates whether the value of the left operand is greater than or equal to the value of the right operand.
l Each of these six relational operators takes two operands. These two operands must both be arithmetic or both be strings.
Arithmetic Operators
All the basic arithmetic operations can be carried out in ScanScript™. Here are the most common arithmetic operators:
Logical Operator
Logical operators are mainly used to control the program flow. The logical operators in ScanScript™ are and, or, and not.
l The conjunction operator andreturns its first argument if this value is false or nil; otherwise, and returns its second argument
Concatenation
The string concatenation operator is denoted by two dots ('..'). If both operands are strings or numbers, then they are converted to strings.
Precedence
Operator precedence in ScanScript™ follows the table below, from lower to higher priority:
or
and
< > <= >= ~= ==
..
+-
*/%
not # - (unary)
^
You can use parentheses to change the precedences of an expression. The concatenation ('..') and exponentiation ('^') operators are right associative. All other binary operators
are left associative.
Function
Optional Parameters
You can specify that a method parameter is optional and no argument has to be supplied for it when the method is called. Optional parameters are indicated within square
brackets [].
When you call a method with an optional parameter, you can choose whether to supply the argument.
OpenTextFile(
string path,
FileMode mode,
[Encoding encoding]
)
The following line of code will open a text file named "readFile" in read-only mode. Note the optional parameter (Encoding.UTF8) usage:
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 3 of 197
Nested Brackets
In some cases you will find nested brackets. These kind of brackets usually indicate dependent parameters where the immediate previous parameter becomes mandatory in
order to use the subsequent optional parameter. If the subsequent parameter is not being used the immediate previous parameter will remain an optional.
For example in the following method the parameter message is mandatory and the rest are optional. However in order to use the button parameter it is required to specify a
title. Likewise to use the icon parameter you must specify a button.
Smd.MessageBox(
string message,
[string title,
[Smd.MessageBoxButton button,
[Smd.MessageBoxIcon icon]]]
)
Global Functions
DateTime
Initializes a new instance of the DateTime structure to a specified number of years, months, days, hours, and minutes.
Syntax
Parameters
Methods
AddMilliseconds(float milliseconds) Adds the specified number of milliseconds to the datetime instance.
AddSeconds(float seconds) Adds the specified number of seconds to the datetime instance.
AddMinutes(float seconds) Adds the specified number of minutes to the datetime instance.
AddHours(float seconds) Adds the specified number of hours to the datetime instance.
AddDays(float seconds) Adds the specified number of days to the datetime instance.
AddMonths(int months) Adds the specified number of months to the datetime instance.
AddYears(int years) Adds the specified number of years to the datetime instance.
ToString(string format) Returns a string that is formatted according to the format specifier.
Properties
GetMillisecond Returns the milliseconds component of the date represented by this instance.
GetSecond Returns the seconds component of the date represented by this instance.
GetMinute Returns the minutes component of the date represented by this instance.
GetHour Returns the hour component of the date represented by this instance.
GetDay Returns the day component of the date represented by this instance.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 4 of 197
GetMonth Returns the month component of the date represented by this instance.
GetYear Returns the year component of the date represented by this instance.
IsLeapYear Returns an indication whether the specified year is a leap year.
GetDayOfWeek Returns the day of the week represented by this instance.
GetDayOfYear Returns the day of the week represented by this instance.
[DD] Returns the day of the month as a two digit number {01 to 31}
[DDDD] Long weekday name Eg: Sunday, Monday etc
[DDD] Abbreviated weekday name Eg: Sun, Mon, Tue etc
[MM] Returns the month of the year as two digit number {01 to 12}
[MMMM] Returns the full month name Eg: January, February, March etc.
[MMM] Returns the abbreviated month name Eg: Jan, Feb, Mar etc.
[YY] Returns year as two digit number Eg: 98
[YYYY] Returns full year Eg: 1998
Return Values
If no argument is provided, return a DateTime instance with the current date and time. Otherwise, it returns a DateTime instance having the specified date and time by the
arguments.
Example
----- This program will scan the system date and time.
Error
Stops executing the script and displays the specified error.
Syntax
Parameters
Example
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 5 of 197
--InterlockHandler function
function InterlockHandler(interlockName)
error("Abort")
end
while (true) do
Report("Marking started")
Image.Line(0, 0, 1, 1)
Laser.WaitForEnd()
System.Flush()
Sleep(1000)
end
Report
Displays a message on the Output window
Syntax
Parameters
message string The message which will appear on the Output window.
Example
---------- This program will generate random numbers.
ScanAll
Scans all the images in a particular project.
Syntax
ScanAll()
Example
--This program will scan all the images related to the current project
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 6 of 197
ScanImage
Scan a specified image. When there are several Images in the project, you can use this command to scan a selected Image.
Syntax
ScanImage( Images )
ScanImage( Index )
Parameters
Return Values
Example
--This program will scan the image that the user specifies
SetAngleUnits
Specify the units used for angle measurement.
Syntax
Parameters
Example
-------- This program will draw a rectangle with an angle of PI/4 radians
SetUnits
Change the currently active units.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 7 of 197
Syntax
Parameters
Example
-------------------- This programme draws a circle using Bits as the unit of measurement.
Sleep
Freezes the script execution for a specified number of milliseconds. Call the System.Flush() command prior to the Sleep() command. System.Flush() will remove all the
commands in the buffer.
Syntax
Parameters
Example
------ This Example describes scanning serial numbers. By using the sleep command a delay is introduced to the loop.
--Variable assignment
number = 19820928
--Use horizontal text
multiText = Text.Horizontal()
multiText.X = -1
multiText.Y = 0
multiText.Font = "Arial"
multiText.CharacterGap = 0.1
multiText.Elevation = 0
multiText.Angle = 30
multiText.Height = 12.5
multiText.ScaleX = 1
multiText.ScaleY = 1
--MarkText function
function MarkText()
--Text is combination of "SN:" string with number variable
multiText.Text = "SN:"..number
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 8 of 197
end
--count variable assignment
count = 0
--Loop
while true do
--Function calling
MarkText()
--Increment count by 1
count = count+1
number = number+1
--If the value = 10, loop terminates
if count == 10 then
break
end
--Introduces the delay between each marking
System.Flush()
Sleep(1000)
end
ToNumber
Converts the given argument to a number. If the argument is already a number or a string convertible to a number, then tonumber returns that number; otherwise, it returns nil.
Syntax
Parameters
Example
--If the string received from the user to the Index No is not converted successfully, the following message will be displayed: "Invalid Index Number".
else
--If the range between 1000-10000
if identification_number >= 1000 and identification_number <= 10000 then
else
--If range is not between 1000-10000
Report("Access denied.")
end
end
ToString
Converts the given argument into a string.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 9 of 197
Syntax
ToString( value )
Parameters
Example
--Set the units as Millimeters
SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
myText = Text.Horizontal()
myText.X = -2
myText.Y = 0
-- Z axis elevation of the text
myText.Elevation = 0
myText.Height = 15.5
--Dot ovf font selected
myText.Font = "TXT.ovf"
myText.Angle = 0
myText.DotDuration = 1000
for i = 0, 10 do
--Number is converted to string
myText.Text = "Level-"..ToString(i)
Image.Text(myText)
i = i + 1
end
Array
Creates a typed array. Following Array types are supported.
Array ByteArray
Creates an instance of a byte array according to the specified length.
Syntax
Parameters
Properties
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 10 of 197
Gets the string from the byte array. Additional arguments are available to specify the encoding type (UTF8, ANSI,Unicode), if not specified the default (UTF8) is
GetString
used. e.g. byteArray.GetString(Encoding.ANSI)
Insert Inserts an item to the array.e.g. byteArray.Insert(int index, byte value)
Length Returns the length of the array.
Remove Removes an item in the specified index of the array.e.g. byteArray.Remove(int index)
Reverse Reverse the array.
Return Values
Example
--This program will describe the ByteArray method.
Array DoubleArray
Creates an instance of a double array according to the specified length.
Syntax
Parameters
Properties
Return Values
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 11 of 197
Example
--This program marks 6 circles with different radius from the radi Mapping table.
Array IntArray
Creates an instance of an integer array according to the specified length.
Syntax
Parameters
Properties
Return Values
Example
--This program will mark 5 circles using different laser power levels from the powerMap Mapping table.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 12 of 197
--Create an IntArray with the size of 5 and assign to powerMap mapping table
powerMap = Array.IntArray(5)
--First Power value is 10
powerMap[1] = 10
--Second Power value is 9
powerMap[2] = 20
--Third Power value is 8
powerMap[3] = 30
--Fourth Power value is 7
powerMap[4] = 40
--Fifth Power value is 6
powerMap[5] = 50
Array StringArray
Creates an instance of a string array according to the specified length.
Syntax
Parameters
Properties
Insert Inserts an item to the array. e.g. stringArray.Insert(int index, string str)
Length Returns the length of the array.
Remove Removes an item in the specified index of the array. e.g. stringArray.Remove(int index)
Return Values
Example
--This program will mark 5 circles using different laser power levels from the powerMap Mapping table.
--Create an IntArray with the size of 5 and assign to powerMap mapping table
powerMap = Array.IntArray(5)
--First Power value is 10
powerMap[1] = 10
--Second Power value is 9
powerMap[2] = 20
--Third Power value is 8
powerMap[3] = 30
--Fourth Power value is 7
powerMap[4] = 40
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 13 of 197
Barcodes
Following Barcode types are supported.
Linear Barcodes
2D Barcodes
Barcodes Codabar
Creates an instance of Codabar barcode.
Syntax
Barcodes.Codabar ( )
Properties
Angle float Angle at which the barcode is placed along the positive X-axis. This can have +/- values in current angle unit.
Elevation float Gets or sets the z coordinate of the starting position.
HatchStyle HatchStyle The hatch pattern used to fill the barcode.
Height float The height of the Barcode.
HumanReadableMarkingOrder MarkingOrder Gets or sets the order in which the hatch and the outline of the human readable text will be marked.
HumanReadableText HumanReadableText Get or Set human readable text settings
Invert bool If true, Inverts the barcode.
LineSpace float Gets or sets the hatching line gap of the barcode.
MarkingOrder MarkingOrder Gets or sets the order in which the hatch and the outline will be marked.
PrintRatio float Gets or sets the print ration (width to narrow ratio) of the barcode.
QuietZone bool Gets or sets whether the quite zone of the barcode is enabled or disabled.
ShowHumanReadableText bool Gets or sets whether the human readable text is visible or not
Text string Alphanumeric characters, which will get encoded into the Barcode.
Width float Gets or sets the width of the Barcode.
X float Gets or sets the X coordinate of the starting position.
Y float Gets or sets the Y coordinate of the starting position.
Return Values
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 14 of 197
Example
--This program will scan a Codabar barcode
Barcodes Code2of5
This will create an instance of Code2of5 barcode.
Syntax
Barcodes.Code2of5 ( )
Properties
Angle float Angle at which the barcode is placed along the positive X-axis. This can have +/- values in current angle unit.
Elevation float Gets or sets the z coordinate of the starting position.
HatchStyle HatchStyle The hatch pattern used to fill the barcode.
Height float The height of the Barcode.
HumanReadableMarkingOrder MarkingOrder Gets or sets the order in which the hatch and the outline of the human readable text will be marked.
HumanReadableText HumanReadableText Get or Set human readable text settings
Invert bool If true, Inverts the barcode.
LineSpace float Gets or sets the hatching line gap of the barcode.
MarkingOrder MarkingOrder Gets or sets the order in which the hatch and the outline will be marked.
PrintRatio float Gets or sets the print ration (width to narrow ratio) of the barcode.
QuietZone bool Gets or sets whether the quite zone of the barcode is enabled or disabled.
ShowHumanReadableText bool Gets or sets whether the human readable text is visible or not
Text string Alphanumeric characters, which will get encoded into the Barcode.
Width float Gets or sets the width of the Barcode.
X float Gets or sets the X coordinate of the starting position.
Y float Gets or sets the Y coordinate of the starting position.
Return Values
Example
--This program will scan Code2of5 barcode
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 15 of 197
Laser.MarkDelay = 100
Barcodes Code11
This will create an instance of Code11 barcode.
Syntax
Barcodes.Code11 ( )
Properties
Angle float Angle at which the barcode is placed along the positive X-axis. This can have +/- values in current angle unit.
Elevation float Gets or sets the z coordinate of the starting position.
HatchStyle HatchStyle The hatch pattern used to fill the barcode.
Height float The height of the Barcode.
HumanReadableMarkingOrder MarkingOrder Gets or sets the order in which the hatch and the outline of the human readable text will be marked.
HumanReadableText HumanReadableText Get or Set human readable text settings
Invert bool If true, Inverts the barcode.
LineSpace float Gets or sets the hatching line gap of the barcode.
MarkingOrder MarkingOrder Gets or sets the order in which the hatch and the outline will be marked.
PrintRatio float Gets or sets the print ration (width to narrow ratio) of the barcode.
QuietZone bool Gets or sets whether the quite zone of the barcode is enabled or disabled.
ShowHumanReadableText bool Gets or sets whether the human readable text is visible or not
Text string Alphanumeric characters, which will get encoded into the Barcode.
Width float Gets or sets the width of the Barcode.
X float Gets or sets the X coordinate of the starting position.
Y float Gets or sets the Y coordinate of the starting position.
Return Values
Example
-This program will scan a Code11 barcode
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 16 of 197
Barcodes Code39
This will create an instance of Code39 barcode.
Syntax
Barcodes.Code39 ( )
Properties
Angle float Angle at which the barcode is placed along the positive X-axis. This can have +/- values in current angle unit.
Elevation float Gets or sets the z coordinate of the starting position.
HatchStyle HatchStyle The hatch pattern used to fill the barcode.
Height float The height of the Barcode.
HumanReadableMarkingOrder MarkingOrder Gets or sets the order in which the hatch and the outline of the human readable text will be marked.
HumanReadableText HumanReadableText Get or Set human readable text settings
Invert bool If true, Inverts the barcode.
LineSpace float Gets or sets the hatching line gap of the barcode.
MarkingOrder MarkingOrder Gets or sets the order in which the hatch and the outline will be marked.
PrintRatio float Gets or sets the print ration (width to narrow ratio) of the barcode.
QuietZone bool Gets or sets whether the quite zone of the barcode is enabled or disabled.
ShowHumanReadableText bool Gets or sets whether the human readable text is visible or not
Text string Alphanumeric characters, which will get encoded into the Barcode.
Width float Gets or sets the width of the Barcode.
X float Gets or sets the X coordinate of the starting position.
Y float Gets or sets the Y coordinate of the starting position.
Return Values
Example
------ This program will scan Code39 barcode
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 17 of 197
Barcodes Code93
This will create an instance of Code93 barcode.
Syntax
Barcodes.Code93 ( )
Barcodes.Code93 ( Code93 subType )
Parameters
Properties
Angle float Angle at which the barcode is placed along the positive X-axis. This can have +/- values in current angle unit.
Elevation float Gets or sets the z coordinate of the starting position.
HatchStyle HatchStyle The hatch pattern used to fill the barcode.
Height float The height of the Barcode.
HumanReadableMarkingOrder MarkingOrder Gets or sets the order in which the hatch and the outline of the human readable text will be marked.
HumanReadableText HumanReadableText Get or Set human readable text settings
Invert bool If true, Inverts the barcode.
LineSpace float Gets or sets the hatching line gap of the barcode.
MarkingOrder MarkingOrder Gets or sets the order in which the hatch and the outline will be marked.
PrintRatio float Gets or sets the print ration (width to narrow ratio) of the barcode.
QuietZone bool Gets or sets whether the quite zone of the barcode is enabled or disabled.
ShowHumanReadableText bool Gets or sets whether the human readable text is visible or not
Text string Alphanumeric characters, which will get encoded into the Barcode.
Width float Gets or sets the width of the Barcode.
X float Gets or sets the X coordinate of the starting position.
Y float Gets or sets the Y coordinate of the starting position.
Return Values
Example
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 18 of 197
Barcodes Code128
This will create an instance of Code128 barcode.
Syntax
Barcodes.Code128 ( )
Barcodes.Code128 ( BarcodeSubtypeCode128 subType )
Parameters
Properties
Angle float Angle at which the barcode is placed along the positive X-axis. This can have +/- values in current angle unit.
Elevation float Gets or sets the z coordinate of the starting position.
HatchStyle HatchStyle The hatch pattern used to fill the barcode.
Height float The height of the Barcode.
HumanReadableMarkingOrder MarkingOrder Gets or sets the order in which the hatch and the outline of the human readable text will be marked.
HumanReadableText HumanReadableText Get or Set human readable text settings
Invert bool If true, Inverts the barcode.
LineSpace float Gets or sets the hatching line gap of the barcode.
MarkingOrder MarkingOrder Gets or sets the order in which the hatch and the outline will be marked.
PrintRatio float Gets or sets the print ration (width to narrow ratio) of the barcode.
QuietZone bool Gets or sets whether the quite zone of the barcode is enabled or disabled.
ShowHumanReadableText bool Gets or sets whether the human readable text is visible or not
Text string Alphanumeric characters, which will get encoded into the Barcode.
Width float Gets or sets the width of the Barcode.
X float Gets or sets the X coordinate of the starting position.
Y float Gets or sets the Y coordinate of the starting position.
Return Values
Example
------- This program will scan a Code128 barcode
Barcodes DataMatrix
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 19 of 197
Syntax
datamatrixBarcode = Barcodes.DataMatrix ( )
Properties
Angle float Angle at which the barcode is placed along the positive X-axis. This can have +/- values in current angle unit.
AutoExpand bool Gets or sets whether the Data Matrix size will be automatically increased if the current size cannot accommodate all the characters.
CircleRadius Double Gets or sets the radius of the hatching circles when the HatchStyle is set to HatchStyle.Circle.
DotDuration float Gets or Sets the time in micro seconds that the laser should wait to mark a dot when the HatchStyle is set to HatchStyle.Dot
DotCountPerCell int Sets the Number of dots per circle in HatchStyle.CircleWithDot, if selected
Elevation float The z coordinate of the DataMatrix starting position.
Format DataMatrixFormat Format of the DataMatrix.
HatchStyle HatchStyle The hatch pattern used to fill the DataMatrix.
Height float The height of the DataMatrix.
HatchingAngle float Get or sets the hatch line angle for MergeCellsSerpentine and MergeCellsUniDirectional hatch patterns
Invert bool If true, Inverts the DataMatrix.
LineSpace float Gets or sets the hatching line gap of the DataMatrix.
MarkingOrder MarkingOrder Gets or sets the order in which the hatch and the outline will be marked.
MatrixSize DatamatrixSize Gets or sets the size of the datamatrix.
QuietZone bool Gets or sets whether the quite zone of the DataMatrix is enabled or disabled.
Text string Alphanumeric characters, which will get encoded into the DataMatrix.
X float Gets or sets the X coordinate of the starting position.
Y float Gets or sets the Y coordinate of the starting position.
Methods
Return Values
Example
----- This program will scan a Datamatrix code applying the dot hatch pattern
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 20 of 197
var.HatchStyle = HatchStyle.Dot
-- Sets dot duration as 100
var.DotDuration = 100
-- Barcode includes "ScanMaster" text as the string
var.Text = "ScanMaster"
-- Code format is Industry
var.Format = DataMatrixFormat.Industry
-- Mark DataMatrix code
Image.Barcode(var)
Barcodes EAN
This will create an instance of EAN type barcode.
Syntax
Barcodes.Ean ( )
Barcodes.Ean( Ean subType )
Parameters
Properties
Angle float Angle at which the barcode is placed along the positive X-axis. This can have +/- values in current angle unit.
Elevation float Gets or sets the z coordinate of the starting position.
HatchStyle HatchStyle The hatch pattern used to fill the barcode.
Height float The height of the Barcode.
HumanReadableMarkingOrder MarkingOrder Gets or sets the order in which the hatch and the outline of the human readable text will be marked.
HumanReadableText HumanReadableText Get or Set human readable text settings
Invert bool If true, Inverts the barcode.
LineSpace float Gets or sets the hatching line gap of the barcode.
MarkingOrder MarkingOrder Gets or sets the order in which the hatch and the outline will be marked.
PrintRatio float Gets or sets the print ration (width to narrow ratio) of the barcode.
QuietZone bool Gets or sets whether the quite zone of the barcode is enabled or disabled.
ShowHumanReadableText bool Gets or sets whether the human readable text is visible or not
Text string Alphanumeric characters, which will get encoded into the Barcode.
Width float Gets or sets the width of the Barcode.
X float Gets or sets the X coordinate of the starting position.
Y float Gets or sets the Y coordinate of the starting position.
Return Values
Example
------ This program will scan EAN barcode
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 21 of 197
Following is a brief introduction to the geometry and mechanisms of each hatching style.
The Horizontal line hatch fills data cells with horizontal lines. The laser scans horizontally and makes return jumps back to the start where it scans forward again. The laser
scanning operation breaks at each cell boundary, and continue with a mark or forward jump again.
Use LineSpace property to define the gap between each hatching lines.
Linear Barcodes Data Matrix QR Code Micro QR Code PDF417 Macro PDF417
HorizontalSerpentine Hatch
The Horizontal serpentine hatch fills data cells with horizontal lines. The laser scans in a horizontal forward and backward motion and makes jumps to the next line start
position vertically where it scans backward again. The laser scanning operation breaks at each cell boundary, and continue with a mark or forward jump again.
Use LineSpace property to define the gap between each hatching lines.
Linear Barcodes Data Matrix QR Code Micro QR Code PDF417 Macro PDF417
The Vertical line hatch fills data cells with vertical lines. The laser scans vertically and makes return jumps back to the start where it scans forward again. The laser scanning
operation breaks at each cell boundary, and continue with a mark or forward jump again.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 22 of 197
Use LineSpace property to define the gap between each hatching lines.
Linear Barcodes Data Matrix QR Code Micro QR Code PDF417 Macro PDF417
The Vertical serpentine hatch fills data cells with vertical lines. The laser scans in a vertical up and down motion and makes jumps to the next line start position horizontally
where it scans backward again. The laser scanning operation breaks at each cell boundary, and continue with a mark or forward jump again.
Use LineSpace property to define the gap between each hatching lines.
Linear Barcodes Data Matrix QR Code Micro QR Code PDF417 Macro PDF417
Helix Hatch
The helix hatch style marks a helix fill on data cells of the data matrix code.
Linear Barcodes Data Matrix QR Code Micro QR Code PDF417 Macro PDF417
Dot hatch
The Dot hatch style marks a Dot on data cells of the data matrix code.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 23 of 197
Use DotDuration property to define the time that the laser should wait before jumping to the next marking point.
Linear Barcodes Data Matrix QR Code Micro QR Code PDF417 Macro PDF417
The circle hatch style marks circles on data cells of the data matrix code.
The radius of the circles is defined using the CircleRadius property of the code.
Linear Barcodes Data Matrix QR Code Micro QR Code PDF417 Macro PDF417
The circle with dot hatch style marks dotted circles on data cells of the data matrix code.
The radius of the circles is defined using the CircleRadius property of the code.
The no of dots per circle is defined using DotCountPerCell property of the code.
Linear Barcodes Data Matrix QR Code Micro QR Code PDF417 Macro PDF417
Merge Cells Uni Directional Hatch merges data cells that share a common boundary into a single shape before hatching. The hatch lines fill the merged shape as a single
shape.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 24 of 197
Use LineSpace property to define the gap between each hatching lines.
Use HatchingAngle property to define a hatching angle for the hatch lines.
Linear Barcodes Data Matrix QR Code Micro QR Code PDF417 Macro PDF417
See Note See Note
Note: Linear Barcodes do not directly support merge cell hatch patterns. But they automatically merge cells into a single region for all the supported types.
Merge Cells Serpentine hatch merges data cells that share a common boundary into a single shape before hatching. The hatch lines fill the merged shape as a single shape.
Use LineSpace property to define the gap between each hatching lines.
Use HatchingAngle property to define a hatching angle for the hatch lines.
Linear Barcodes Data Matrix QR Code Micro QR Code PDF417 Macro PDF417
See Note See Note
Note: Linear Barcodes do not directly support merge cell hatch patterns. But they automatically merge cells into a single region for all the supported types.
Barcodes MacroPdf417
This will create an instance of MacroPdf417 Barcode.
Syntax
macropdfBarcode = Barcodes.MacroPdf417 ( )
Properties
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 25 of 197
Methods
Return Values
Example
---- This program will scan a MacroPdf417 barcode
Barcodes MicroQRCode
This will create an instance of MicroQRCode barcode.
Syntax
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 26 of 197
microqrBarcode = Barcodes.MicroQrCode ( )
Properties
Angle float Angle at which the barcode is placed along the positive X-axis. This can have +/- values in current angle unit.
Gets or sets whether the barcode size will be automatically increased if the current size cannot accommodate all the
AutoExpand bool
characters.
CodeSize MicroQRCodeSize Gets or sets the size of the QR-code. Refer the Code Sizes page for a list of enumerations.
DotDuration float Gets or sets the dot duration in milliseconds (for dot hatch style)
Elevation float The z coordinate of the MicroQrCode starting position.
EncodingMode MicroQRCodeEncodingMode Gets or sets the encoding mode of the MicroQrCode Barcode.
ErrorCorrectionLevel MicroQRCodeErrorCorrectionlevel Gets or sets the error correction level of the MicroQrCode Barcode.
HatchStyle HatchStyle The hatch pattern used to fill the barcode.
Height float The height of the DataMatrix.
Invert bool If true, Inverts the DataMatrix.
LineSpace float Gets or sets the hatching line gap of the MicroQRCode.
MarkingOrder MarkingOrder Gets or sets the order in which the hatch and the outline will be marked.
MaskPattern MicroQRCodeMaskPattern Gets or sets the mask pattern of the QR-code.
QuietZone bool Specifies whether the QuietZone of the MicroQRCode is enabled or not.
Text string Gets or sets the text of the MicroQrCode Barcode.
X float Gets or sets the X coordinate of the MicroQrCode Barcode.
Y float Gets or sets the Y coordinate of the MicroQrCode Barcode.
Methods
Return Values
Example
------ This program will scan a MicroQrCode applying the Dot hatch pattern
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 27 of 197
Barcodes Msi
The Msi Barcode can display only the number 0-9 and has no fixed length.
Syntax
msiBarcode = Barcodes.Msi ( )
Properties
Angle float Angle at which the barcode is placed along the positive X-axis. This can have +/- values in current angle unit.
Elevation float Gets or sets the z coordinate of the starting position.
HatchStyle HatchStyle The hatch pattern used to fill the barcode.
Height float The height of the Barcode.
HumanReadableMarkingOrder MarkingOrder Gets or sets the order in which the hatch and the outline of the human readable text will be marked.
HumanReadableText HumanReadableText Get or Set human readable text settings
Invert bool If true, Inverts the barcode.
LineSpace float Gets or sets the hatching line gap of the barcode.
MarkingOrder MarkingOrder Gets or sets the order in which the hatch and the outline will be marked.
PrintRatio float Gets or sets the print ration (width to narrow ratio) of the barcode.
QuietZone bool Gets or sets whether the quite zone of the barcode is enabled or disabled.
ShowHumanReadableText bool Gets or sets whether the human readable text is visible or not
Text string Alphanumeric characters, which will get encoded into the Barcode.
Width float Gets or sets the width of the Barcode.
X float Gets or sets the X coordinate of the starting position.
Y float Gets or sets the Y coordinate of the starting position.
Return Values
Example
-------- This program will scan Msi barcode
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 28 of 197
Image.Barcode(var)
Barcodes Pdf417
This will create an instance of Pdf417 Barcode.
Syntax
pdfBarcode = Barcodes.Pdf417 ( )
Properties
Angle float Angle at which the barcode is placed along the positive X-axis. This can have +/- values in current angle unit.
Gets or sets whether the barcode size will be automatically increased if the current size cannot accommodate all the
AutoExpand bool
characters..
CompactionMode Pdf417CompactionMode Gets or sets the compaction mode of the Pdf417 barcode.
DotDuration float Gets or sets the dot duration in milliseconds (for dot hatch style)
Elevation float The z coordinate of the barcodes starting position.
Gets or sets the error correction level of the Pdf417 barcode. Refer the Error Correction Level page for a list of
ErrorCorrectionLevel Pdf417ErrorCorrectionLevel
enumerations.
HatchStyle HatchStyle The hatch pattern used to fill the barcode.
Height float The height of the Barcode.
Invert bool If true, Inverts the barcode.
LineSpace float Gets or sets the hatching line gap of the MicroQRCode.
MarkingOrder MarkingOrder Gets or sets the order in which the hatch and the outline will be marked.
NumberOfColumns int Gets or sets the number of columns of the Pdf417 Barcode.
NumberOfRows int Gets or sets the number of rows of the Pdf417 Barcode.
PrintRatio float Ratio between the widths of wide and narrow bars
QuietZone bool Specifies whether the QuietZone of the barcode is enabled or not.
Text string Gets or sets the text of the Pdf417 Barcode.
Width float Gets or sets the width of the Pdf417 Barcode.
X float Gets or sets the X coordinate of the Pdf417 Barcode.
Y float Gets or sets the Y coordinate of the Pdf417 Barcode.
Methods
Return Values
Example
------ This program will scan a Pdf417 barcode
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 29 of 197
Barcodes QRCode
This will create an instance of QRCode barcode.
Syntax
qrBarcode = Barcodes.QRCode ( )
Properties
Angle float Angle at which the barcode is placed along the positive X-axis. This can have +/- values in current angle unit.
Gets or sets whether the barcode size will be automatically increased if the current size cannot accommodate all the
AutoExpand bool
characters.
CodeSize QRCodeSize Gets or sets the size of the QR-code. Refer the Code Sizes page for a list of enumerations.
DotDuration float Gets or sets the dot duration in milliseconds (for dot hatch style)
Elevation float The z coordinate of the QRCode starting position.
EncodingMode QRCodeEncodingMode Gets or sets the encoding mode of the QR-code.
ErrorCorrectionLevel QRCodeErrorCorrectionlevel Gets or sets the error correction level of the QR-code.
HatchStyle HatchStyle The hatch pattern used to fill the barcode.
Height float The height of the DataMatrix.
Invert bool If true, Inverts the DataMatrix.
LineSpace float Gets or sets the hatching line gap of the QRCode
MarkingOrder MarkingOrder Gets or sets the order in which the hatch and the outline will be marked.
MaskPattern QRCodeMaskPattern Gets or sets the mask pattern of the QRCode barcode.
QuietZone bool Specifies whether the QuietZone of the QRCode is enabled or not.
Text string Gets or sets the text of the QRCode Barcode.
X float Gets or sets the X coordinate of the QrCode Barcode.
Y float Gets or sets the Y coordinate of the QrCode Barcode.
Methods
Return Values
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 30 of 197
Example
------ This program will scan a QRCode applying the Dot hatch pattern
Barcodes Upca
This will create an instance of Upca type barcode.
Syntax
upcaBarcode = Barcodes.Upca ( )
upcaBarcode = Barcodes.Upca ( Upca subType )
Parameters
Properties
Angle float Angle at which the barcode is placed along the positive X-axis. This can have +/- values in current angle unit.
Elevation float Gets or sets the z coordinate of the starting position.
HatchStyle HatchStyle The hatch pattern used to fill the barcode.
Height float The height of the Barcode.
HumanReadableMarkingOrder MarkingOrder Gets or sets the order in which the hatch and the outline of the human readable text will be marked.
HumanReadableText HumanReadableText Get or Set human readable text settings
Invert bool If true, Inverts the barcode.
LineSpace float Gets or sets the hatching line gap of the barcode.
MarkingOrder MarkingOrder Gets or sets the order in which the hatch and the outline will be marked.
PrintRatio float Gets or sets the print ration (width to narrow ratio) of the barcode.
QuietZone bool Gets or sets whether the quite zone of the barcode is enabled or disabled.
ShowHumanReadableText bool Gets or sets whether the human readable text is visible or not
Text string Alphanumeric characters, which will get encoded into the Barcode.
Width float Gets or sets the width of the Barcode.
X float Gets or sets the X coordinate of the starting position.
Y float Gets or sets the Y coordinate of the starting position.
Return Values
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 31 of 197
Example
------- This program will scan UPCA barcode
Barcodes Upce
This will create an instance of Upce type barcode.
Syntax
upceBarcode = Barcodes.Upce ( )
upceBarcode = Barcodes.Upce ( Upce subType )
Parameters
Properties
Angle float Angle at which the barcode is placed along the positive X-axis. This can have +/- values in current angle unit.
Elevation float Gets or sets the z coordinate of the starting position.
HatchStyle HatchStyle The hatch pattern used to fill the barcode.
Height float The height of the Barcode.
HumanReadableMarkingOrder MarkingOrder Gets or sets the order in which the hatch and the outline of the human readable text will be marked.
HumanReadableText HumanReadableText Get or Set human readable text settings
Invert bool If true, Inverts the barcode.
LineSpace float Gets or sets the hatching line gap of the barcode.
MarkingOrder MarkingOrder Gets or sets the order in which the hatch and the outline will be marked.
PrintRatio float Gets or sets the print ration (width to narrow ratio) of the barcode.
QuietZone bool Gets or sets whether the quite zone of the barcode is enabled or disabled.
ShowHumanReadableText bool Gets or sets whether the human readable text is visible or not
Text string Alphanumeric characters, which will get encoded into the Barcode.
Width float Gets or sets the width of the Barcode.
X float Gets or sets the X coordinate of the starting position.
Y float Gets or sets the Y coordinate of the starting position.
Return Values
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 32 of 197
Example
------ This program will scan Upce barcode
BitConverter
Converts base data types to bytes and vice versa.
Example
--This program will demonstrate the BitConverter.GetBytesFromDouble method.
--Double value
value = 4294967295.0
--Convert value to ByteArray "true" on little-endian systems and "false" on big-endian systems
bytes = BitConverter.GetBytesFromDouble(value, true)
for i= 1, bytes.Length() do
--ByteArray element converted to Hexadecimal format and displayed
Report(String.ToHexString(bytes[i]))
end
BitConverter GetBytesFromDouble
Returns the specified double value as a Byte Array.
Syntax
Parameters
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 33 of 197
Return Values
Example
--This program will demonstrate the BitConverter.GetBytesFromDouble method.
--Double value
value = 4294967295.0
--Convert value to ByteArray "true" on little-endian systems and "false" on big-endian systems
bytes = BitConverter.GetBytesFromDouble(value, true)
for i= 1, bytes.Length() do
--ByteArray element converted to Hexadecimal format and displayed
Report(String.ToHexString(bytes[i]))
end
BitConverter GetBytesFromFloat
Returns the specified float value as a Byte Array.
Syntax
Parameters
Return Values
Example
--This program will demonstrate the BitConverter.GetBytesFromFloat method.
for i= 1, bytes.Length() do
--ByteArray element convert to Hexa decimal format and display
Report(String.ToHexString(bytes[i]))
end
BitConverter GetBytesFromInt
Returns the specified 32-bit signed integer value as a Byte Array.
Syntax
Parameters
Return Values
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 34 of 197
Example
--This program will return the 32-bit integer value as an array of bytes and each element will be converted to Hexadecimal format.
--Int value
value = 2147483647
--Convert value to ByteArray "true" on little-endian systems and "false" on big-endian systems
bytes = BitConverter.GetBytesFromInt(value, true)
for i= 1, bytes.Length() do
--ByteArray element converted to Hexadecimal format and displayed
Report(String.ToHexString(bytes[i]))
end
BitConverter GetBytesFromShort
Returns the specified 16-bit signed integer value as a Byte Array.
Syntax
Parameters
Return Values
Example
--This program will return the 16-bit integer value as an array of bytes and each element converted into Hexadecimal format.
for i= 1, bytes.Length() do
--ByteArray element is converted to Hexadecimal format and is displayed
Report(String.ToHexString(bytes[i]))
end
BitConverter ToDouble
Returns a double value by converting eight bytes from a specified position, in the ByteArray.
Syntax
Parameters
Return Values
Example
--Double value
value = 4294967295.0
--Convert value to ByteArray "true" on little-endian systems and "false" on big-endian systems
bytes = BitConverter.GetBytesFromDouble(value, true)
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 35 of 197
BitConverter ToFloat
Returns a float value by converting four bytes from a specified position, in the ByteArray.
Syntax
Parameters
Return Values
Example
--The Float value
value = 3.40282347E+38
--Convert value to ByteArray "true" on little-endian systems and "false" on big-endian systems
bytes = BitConverter.GetBytesFromFloat(value, true)
BitConverter ToInt
Returns a 32-bit signed integer value by converting four bytes from a specified position, in the ByteArray.
Syntax
Parameters
Return Values
Example
--Int value
value = 2147483647
--Convert value to ByteArray "true" on little-endian systems and "false" on big-endian systems
bytes = BitConverter.GetBytesFromInt(value, true)
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 36 of 197
BitConverter ToShort
Returns a 16-bit signed integer value by converting two bytes from a specified position, in the ByteArray.
Syntax
Parameters
Return Values
Example
--This program will Display the characters according to the ASCII values that the user has defined in the byte array
Bit Operation
Following bit operations are supported.
Example
--This program demonstrates the RotateLeft operation. The loop will run 12 times and each time j will be rotated left by 1.
for j=1,12 do
--Rotate left
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 37 of 197
i = BitOp.RotateLeft(j,1)
--Displays result
Report(j.." "..i)
end
Syntax
Parameters
Return Values
Example
--This program will demonstrate the Bitwise AND operation.
val1 = 125
val2 = 115
--Display the result of the Bitwise AND operation
Report(BitOp.BAnd(val1, val2))
Syntax
Parameters
Return Values
Example
--This program will demonstrate the Bitwise NOT operation.
val1 = 125
--Display the result of the Bitwise NOT operation
Report(BitOp.BNot(val1))
Syntax
Parameters
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 38 of 197
Return Values
Example
--This program will demonstrate the Bitwise OR operation.
val1 = 125
val2 = 115
--Display the result of the Bitwise OR operation
Report(BitOp.BOr(val1, val2))
Syntax
Parameters
Return Values
Example
--This program will demonstrate the Bitwise Xor operation.
val1 = 125
val2 = 115
--Display the result of the Bitwise Xor operation
Report(BitOp.BXor(val1, val2))
Syntax
Parameters
Return Values
Example
--This program will demonstrate the GetBit operation.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 39 of 197
else
Report("test fail")
end
Syntax
Parameters
Return Values
Example
--This program demonstrates the RotateLeft operation. The loop will run 12 times and each time j will be rotated by 1.
for j = 1,12 do
--Rotate left
i = BitOp.RotateLeft(j,1)
--Displays result
Report(j.." "..i)
end
Syntax
Parameters
Return Values
Example
--This program demonstrates the RotateRight operation.
val = -35
--Display the right rotated value.
Report(BitOp.RotateRight(val, 2))
Syntax
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 40 of 197
Parameters
Return Values
Example
--This program will demonstrate the SetBit operation
Syntax
Parameters
Return Values
Example
--This program demonstrates the ShiftLeft operation. The loop will run 12 times and each time j will be shifted by 1.
for j = 1, 12 do
--Left shift
i = BitOp.ShiftLeft(j, 1)
--Displays result
Report(j.." "..i)
end
Syntax
Parameters
Return Values
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 41 of 197
Example
--This program demonstrates the ShiftRight operation.
Syntax
Parameters
Return Values
Example
--This program demonstrates the Left shift and ToggleEndianness32 operations.
for j = 1, 20 do
i = BitOp.ShiftLeft(j, 1) --Left shift
--Toggle the Endianness int32 format
k = BitOp.ToggleEndianness32(i)
--Displays result
Report("Value: "..j.." is shifted by one position and the shifted value is "..i..", after changing the endianness the value is "..k)
end
Syntax
Parameters
Return Values
Example
--This program demonstrates the Left shift and ToggleEndianness16 operations.
for j = 1, 20 do
i = BitOp.ShiftLeft(j, 1) --Left shift
--Toggle the Endianness int16 format
k = BitOp.ToggleEndianness16(i)
--Displays result
Report("Value: "..j.." is shifted by one position and the shifted value is "..i..", after changing the endianness the value is "..k)
end
Control Structures
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 42 of 197
Example
--This Program will demonstrate how a Rectangular Array is created
Laser.MarkSpeed = 1500
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
Laser.LaserOnDelay = 0
Laser.LaserOffDelay = 0
Laser.LaserPipelineDelay = 420
Laser.PolyDelay = 0
-- Text initialized
height = 5
myText = Text.Horizontal()
myText.Elevation = 0
myText.Height = height
myText.X = 0
myText.Y = 0
myText.ScaleX = 1
myText.Font = "SIMPLEX.ovf"
myText.Text = "*"
--Rectangular Array
function RectangularArray(rowOffset, columnOffset, rowNum, colNum, MarkingFunction)
for x = 1, colNum do
--Save the state
state = Image.SaveTransform()
for y = 1,rowNum do
Mark()
Image.Translate(0, columnOffset)
end
Image.LoadTransform(state)
Image.Translate(rowOffset, 0)
end
end
--Rectangular array variables. User can enter values according to his requirements
rowOffset = 10
columnOffset = 10
rowNum = 3
colNum = 4
break
Implements the break command
Example
--This Example describes scanning serial numbers. When the count reaches 10 it breaks out of the loop
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 43 of 197
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
--Variable assignment
number = 19820928
--Use horizontal text
multiText = Text.Horizontal()
multiText.X = -1
multiText.Y = 0
multiText.Font = "Arial"
multiText.CharacterGap = 0.1
multiText.Elevation = 0
multiText.Angle = 30
multiText.Height = 12.5
multiText.ScaleX = 1
multiText.ScaleY = 1
end
--count variable assignment
count = 0
--Loop
while true do
--Function calling
MarkText()
--Increment count by 1
count = count+1
number = number+1
--If the value = 10, loop terminates
if count == 10 then
break
end
--Introduces the delay between each marking
System.Flush()
Sleep(1000)
end
for
Implements the for loop.
Syntax
<Body of loop>
end
Example
--------- This Program will demonstrate how to use the for loop
-- for loop will increment loop variable 'index' in each execution until 10
for index=1,5 do
Report(index)
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 44 of 197
end
-- for loop will increment loop variable 'index' by 2 in each execution until 4
for index=-4,4,2 do
Report(index)
end
if
Implements the if statement
Syntax
if (condition) then
<Statements>
<Statements>
else
<Statements>
end
Example
------- This program will execute the command selected.
-- Commands
line = 1
box = 2
circle = 3
repeat
Implements the repeat statement
Syntax
repeat
<loop body>
until <condition>
Example
------- This Example will scan serial numbers until count == 10 and display the message "Finished:.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 45 of 197
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
--Variable assignment
number = 19820930
--horizontal text
multiText = Text.Horizontal()
multiText.X = -3
multiText.Y = 0
multiText.Font = "Arial"
multiText.CharacterGap = 0.1
multiText.Elevation = 0
multiText.Angle = 30
multiText.Height = 12.5
multiText.ScaleX = 1
multiText.ScaleY = 1
--MarkText function
function MarkText()
--A combination of the "SN:" string with a number variable
multiText.Text = "SN:"..number
--Mark the horizontal text as serial number
Image.Text(multiText)
end
--count variable assignment
count = 0
--repeat loop
repeat
--Function calling
MarkText()
--Increment count by 1
count= count+1
number = number+1
System.Flush()
Sleep(200)
--repeat until count ==10
until count == 10
Laser.WaitForEnd()
--Display the message
Report ("Finished")
while
Implements the while statement
Syntax
while (condition) do
<Statements>
end
Example
-------This program will mark a Box, when the user presses 'External Input' to UserIn1 input pin and then displays the message "Mark completed". If the user is not giv
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 46 of 197
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
end
Functions
Syntax
<Statements>
return (value)
end
Example
------- This Program will demonstrate how to define and use functions
-- Temperature to validate
temperature = -1
if isValid then
-- Temperature is valid
else
Inform(errorMessage)
end
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 47 of 197
Directory
Following functions are supported.
Example
--This program will create a directory and "binfile.bin" file. Finally it will delete the directory.
--Create a directory
Directory.Create("/mnt/SMC/tmp")
--creates a binary file called "binfile" in write mode
binaryFile = File.OpenBinaryFile("/mnt/SMC/tmp/binfile.bin", FileMode.Write)
j = 65
byteArray = Array.ByteArray(1)
for i = 1, 26 do
byteArray[1] = j
--Writes to the binary file
binaryFile.Write(byteArray)
j = j+1
end
binaryFile.Close()
Directory Create
Creates a directory in the specified path.
Syntax
Parameters
Return Values
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 48 of 197
--Creates a directory
result = Directory.Create("/mnt/SMC/tmp")
j = 65
byteArray = Array.ByteArray(1)
for i = 1, 26 do
byteArray[1] = j
--Writes to the binary file
binaryFile.Write(byteArray)
j = j+1
end
binaryFile.Close()
else
-- This message will be displayed
Report("Directory already exist or it is not created")
end
--Creates a directory
result = Directory.Create("Disk\\User")
j = 65
byteArray = Array.ByteArray(1)
for i = 1, 26 do
byteArray[1] = j
--Writes to the binary file
binaryFile.Write(byteArray)
j = j+1
end
binaryFile.Close()
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 49 of 197
else
-- This message will be displayed
Report("Directory already exist or it is not created")
end
Directory Delete
Deletes the specified directory.
Syntax
Parameters
Return Values
j = 65
byteArray = Array.ByteArray(1)
for i = 1, 26 do
byteArray[1] = j
--Writes to the binary file
binaryFile.Write(byteArray)
j = j+1
end
binaryFile.Close()
else
-- This message will be displayed.
Report("Directory already exist or it is not created")
end
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 50 of 197
--Creates a directory
result = Directory.Create("Disk\\User")
j = 65
byteArray = Array.ByteArray(1)
for i = 1, 26 do
byteArray[1] = j
--Writes to the binary file
binaryFile.Write(byteArray)
j = j+1
end
binaryFile.Close()
else
-- This message will be displayed.
Report("Directory already exist or it is not created")
end
Directory GetDirectories
Returns a string array containing the list of directories in the specified path.
Syntax
Parameters
Return Values
Example SMC
--This program will show the all directories in the given path. Number of directories and their names will be displayed.
for i = 1, allDirectories.Length() do
--Display their names
Report(allDirectories[i])
end
Example EC1000
--This program will show the all directories in the given path. Number of directories and their names will be displayed.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 51 of 197
for i = 1, allDirectories.Length() do
--Display their names
Report(allDirectories[i])
end
Directory GetFiles
Returns a string array containing the list of files in the specified path. Use the wildcard to filter specific file types.
Syntax
Parameters
Return Values
Events
Following functions are supported.
CreateIOEvent Creates an IOEvent that will notify the event handler when the specified IO condition is met.
CreateWaitEvent Creates a WaitEvent which will block the script until the event asserts in the marking engine.
CreateNotifyEvent Creates a NotifyEvent which will notify back on demand
CreateApplicationEvent Creates a User defined event that will notify back to the application connected to the controller
Example
--This program will demonstrate the CreateNotifyEvent method.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 52 of 197
function PartCompleted(messageData)
Report("Part #"..messageData.." Completed")
end
Image.Circle(0, 0, 25)
System.Flush()
sleep(100)
end
Events CreateIOEvent
Creates an IOEvent which will notify the event handler when the specified IO condition is met.
Note:This method is currently supported with the SMC and EC1000 cards only.
Syntax
notifyEvent = Events.CreateIOEvent ( Pin pin, bool raiseOnLow, bool raiseOnHigh, string eventHandlerFunctionName )
Parameters
Properties
RaiseOnHigh Raise the IO event pattern when the state of the pin is high. True = High
RaiseOnLow Raise the IO event pattern when the state of the pin is low. True = Low
Return Values
Example
-------- This program will demonstrate the CreateIOEvent method.
function OnIoEvent(state)
Report(tostring(state))
end
-- OnIoEvent will call the event handler when the UserIn1 pin conditions are false
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 53 of 197
ioEvent.RaiseOnHigh = true
ioEvent.RaiseOnLow = true
while Io.ReadPin(Pin.Din.UserIn3) do
System.Flush()
Sleep(10)
end
Events CreateNotifyEvent
CreateNotifyEvent will generate an event notification from the marking engine to the scripting engine on demand. Use the Schedule() property to initiate the event at any
position of the Script.
Note:This method is currently supported with the SMC and EC1000 card only.
Syntax
Parameters
Methods
Example
--This program will demonstrate the CreateNotifyEvent method.
function PartCompleted(messageData)
Report("Part #"..messageData.." Completed")
end
Image.Circle(0, 0, 25)
System.Flush()
sleep(100)
end
Events CreateWaitEvent
CreateWaitEvent will generate an event notification from the marking engine to the scripting engine. The execution of the script will be blocked until the event asserts in the
marking engine. Use the Schedule() method to enable the event before using the Wait() to wait for the event to occur in the script. Each Schedule() should be followed by a
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 54 of 197
Note:This method is currently supported with the EC1000 and SMC cards only.
Syntax
waitEvent = Events.CreateWaitEvent()
Methods
Return Values
Example
--This program will demonstrates the CreateWaitEvent.
--Creates a eventOne event to synchronize the script engine with the marking engine
eventOne = Events.CreateWaitEvent()
--Creates a eventTwo event to synchronize the script engine with the marking engine
eventTwo = Events.CreateWaitEvent()
Report("Circle is marked")
--Waits until eventTwo is notified
eventTwo.Wait()
Report("Rectangle is marked")
File
Following functions are supported.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 55 of 197
length = binaryFile.Length()
end
--Close the file
binaryFile.Close()
end
--Close the file
binaryFile.Close()
File Delete
Deletes the specified file.
Syntax
Parameters
Return Values
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 56 of 197
end
--Close the file
binaryFile.Close()
--Delete the file
File.Delete("/mnt/SMC/tmp/binfile.bin")
File OpenBinaryFile
Opens the specified binary file.
Syntax
Parameters
Methods
Return Values
end
--Close the file
binaryFile.Close()
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 57 of 197
File OpenTextFile
Opens a text file.
Syntax
Parameters
Methods
Return Values
for i = 1, str.Length() do
--Writes a string to a file
txtFile.WriteLine(str[i])
i = i+1
end
--Close the write file
txtFile.Close()
--Opens a text file named "readFile" in read-only mode
readFile = File.OpenTextFile("/mnt/SMC/tmp/txtfile.txt", FileMode.Read, Encoding.UTF8)
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 58 of 197
readValue = readFile.ReadLine()
end
Interlocks
Manages the interlock operation.
The interlock system is a safety feature where breaks in the interlock connectivity can be conditioned to shut down the laser and galvo motions, and generate an exception
event to the host application to notify it that the break occurred.
When a conditioned interlock trips or any other hardware-detectable exception condition occurs, the marking engine controller immediately stops processing the vector
stream, turns off the laser, and stops the galvo motion. It then sends an exception event message to the host application and enters a state where it will not execute any more
instructions until a Priority Abort:Job message is received. The Abort message reinitializes the marking engine and prepares it for a new job. If an exception occurs, the job
cannot be restarted from where it was left off.
Interlocks AssertOnCurrentFlow
Sets the polarity of the interlock pin defined.
Syntax
Parameters
Example
----------- This program will demonstrate the Interlock function
--InterlockHandler function
function InterlockHandler(interlockName)
Report("Interlock triggered. Abort")
System.Abort()
end
while (true) do
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 59 of 197
Report("Marking started")
Image.Line(0, 0, 25, 25)
Laser.WaitForEnd()
System.Flush()
Sleep(1000)
end
Interlocks Enable
Enable or disable interlock on the given interlock pin.
Syntax
Parameters
Example
----------- This program will demonstrate the Interlock function
--InterlockHandler function
function InterlockHandler(interlockName)
Report("Interlock triggered. Abort")
System.Abort()
end
while (true) do
Report("Marking started")
Image.Line(0, 0, 25, 25)
Laser.WaitForEnd()
System.Flush()
Sleep(1000)
end
Interlocks MasterEnable
Enable or disable all the interlocks. It is always advisable to disable interlocks before making any modification and enabling after.
Syntax
Parameters
Example
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 60 of 197
--InterlockHandler function
function InterlockHandler(interlockName)
Report("Interlock triggered. Abort")
System.Abort()
end
while (true) do
Report("Marking started")
Image.Line(0, 0, 1, 1)
Laser.WaitForEnd()
System.Flush()
Sleep(1000)
end
Interlocks SetInterlockHandler
Sets the interlock handler function to be called when an interlock is triggered. The function should accept a single argument of a string.
Syntax
Parameters
Example
--This program will demonstrate the Interlock function
--InterlockHandler function
function InterlockHandler(interlockName)
Report("Interlock triggered. Abort")
System.Abort()
end
while (true) do
Report("Marking started")
Image.Line(0, 0, 1, 1)
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 61 of 197
Laser.WaitForEnd()
System.Flush()
Sleep(1000)
end
Image
Provides commands to scan shapes such as Arcs, Circles, Polylines, Text, Barcodes, etc. It also provides commands to transform the shapes.
Geometric Commands
Transform Commands
Example
--This program is used to draw an arc with a radius of 2 and a center point of 0,0
Laser.MarkSpeed = 150
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
Image Arc
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 62 of 197
Scans an arc according to the given parameters. All the angles are in the current angle units. If the sweep angle is positive, the arc will be scanned counterclockwise and
scanned clockwise if negative.
Syntax
Arc( float centerX, float centerY, float radius, float startAngle, float sweepAngle )
Arc( float centerX, float centerY, float radius, float startAngle, float sweepAngle,float Elevation )
Arc( float centerX, float centerY, float radius, float startAngle, float sweepAngle,float Elevation,float maximumSegmentationError )
Parameters
Example
----- This program is used to draw an arc with a radius of 2 and a center point of 0,0
Image Barcode
Scans the barcode passed as a parameter.
Syntax
Parameters
Example
--This program will mark Code93 barcode
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 63 of 197
var.Height = 12.5
--barcode width is 1.4
var.Width = 37.5
--x position of the barcode
var.X = 0.5
--Y position of the barcode
var.Y = 0.5
--10 degree angle to the canvas
var.Angle = 10
--Apply Horizontal hatch pattern
var.HatchStyle = HatchStyle.Horizontal
--Barcode includes "12X345AB" text as the string
var.Text = "12X345AB"
--0.01 unit line gap
var.LineSpace = 0.25
--Mark Code93 full ascii subtype barcode
Image.Barcode(var)
Image Box
Scans a box/rectangle according to the given parameters.
Syntax
Box( float lowerLeftX, float lowerLeftY, float width, float height, [float angle,] [float elevation] )
Parameters
Example
-- This program will draw a rectangle by using the Box command.
--Draws a rectangle with a width and height of 1 and 2 starting from (0,0) and with an angle of 30 degree.
Image.Box(0, 0, 25, 50, 30)
Image Circle
Scans a circle according to the given parameters.
Syntax
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 64 of 197
Parameters
Example
-- This program will draw a circle according to the given parameters
Image Dot
Scans a dot for a given period of time.
Syntax
Parameters
Example
--This program is used to draw a dot
Image Line
Scans a two dimensional line from one point to another.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 65 of 197
Syntax
Parameters
Example
-- This program will draw a square by using the line command
Laser.MarkDelay = 200
Image Line3D
Scans a three dimensional line from one point to another.
Syntax
Line3D( float X1, float Y1, float Z1, float X2, float Y2, float Z2 )
Parameters
Example
-- This program will draw a 3D line by using the line3D command
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 66 of 197
Laser.MarkDelay = 200
Image Polyline3D
Scans a 3D polyline according to the given parameters.
Syntax
Polyline3D( bool closeFlag, float X1, float Y1, float Z1, float X2, float Y2, float Z2, ... )
Parameters
closeFlag bool Indicates whether the Polyline is open or closed. Can be either True(closed) or False(open).
X1 float The x coordinate of the Polyline's start point.
Y1 float The y coordinate of the Polyline's start point.
Z1 float The z coordinate of the Polyline's start point.
X2 float The x coordinate of the Polyline's end point.
Y2 float The y coordinate of the Polyline's end point.
Z2 float The z coordinate of the Polyline's end point.
Example
-- This program will draw a 3D polyline
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
--Unit settings
Laser.MarkDelay = 200
Image Spiral
Scans the spiral object passed as a parameter.
Syntax
Parameters
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 67 of 197
Example
Image Text
Scans a horizontal text/arc text object passed as a parameter.
Syntax
Parameters
Example
--This program will scan the text "ScanMaster"
myText = Text.Horizontal()
myText.X = -2
myText.Y = 0
--Z axis elevation of the text
myText.Elevation = 0
myText.Height = 2.5
myText.Font = "Arial"
--Assign "ScanMaster" string to text variable
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 68 of 197
myText.Text = "ScanMaster"
myText.Angle = 0
--Scan the "ScanMaster" text string
Image.Text(myText)
Transform Commands
The following geometric shapes related commands are available in the Image library:
Rotate Rotates the current transformation matrix of the device by the given value in degrees.
SaveTransform Returns the current transformation matrix state of the device.
LoadTransform Loads the transformation matrix state saved by Image.SaveState() to the device.
Scale Scales the current transformation matrix of the device according to the given values.
Translate Translates the current transformation matrix of the device according to the given values
RealtimeTransformEnabled This function enables the TranslateRealtime and RotateRealtime commands.
TranslateRealtime TranslateRealtime function allows the user to move an object in real time.
RotateRealtime RotateRealtime function allows the user to rotate an object in real time.
MoveTo Moves the galvo to the specified position.
Image LoadTransform
Loads the transformation matrix state saved by Image.SaveState() to the device.
Syntax
LoadTransform(TransformationState state)
Parameters
state TransformationState
Example
-- This program will first draw a rectangle and save it. Then it will rotate the rectangle by 45 degrees and scan it. Finally it will load the original state and scan
Image MoveTo
Moves the galvo to the specified position.
Syntax
Parameters
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 69 of 197
Example
-- Set Millimeters as the Unit
SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
--Unit settings
Laser.MarkDelay = 200
for i = 10,30 do
--Moves the galvo to the given position
Image.MoveTo(i, 0, 0)
end
Image RealtimeTransformEnabled
Enable realtime translate and rotate commands.
Note: This command will be processed through instruction buffer and therefore will not take effect immediately.
Syntax
Parameters
Example
---- This program will scan the original and the translated version of "ScanMaster ScanScript" arcText
arcText.Radius = 25.4
arcText.Font = "Arial"
arcText.CenterX = 0
arcText.CenterY = 0
arcText.StartAngle = 10
arcText.Height = 12.4
arcText.Elevation = 0
arcText.Align = ArcTextAlign.Baseline
Laser.Sleep(100)
--Enable the real time transformation commands
Image.RealtimeTransformEnabled(true)
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 70 of 197
Image.TranslateRealtime(1, 0.8)
--Mark the translated arc arcText
Image.Text(arcText)
Image.RealTimeTransformEnabled(false)
Image ResetRtTransformMatrix
Resets the Real time Transform Matrix to default.
Syntax
ResetRtTransformMatrix ()
Example
-- This program will scale the Rectangle by a specified factor for x and y, and both the scaled and original rectangles will be marked.
Image Rotate
Rotates the current transformation matrix of the device by the given angle.
Syntax
Parameters
Example
--Set Millimeters as the Unit
SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 71 of 197
Image RotateRealtime
Rotates the device transformation matrix by the specified angle. This command bypasses the instruction buffer and therefore this will take effect immediately. Real time
transformation should be enabled using Image.RealtimeTransformEnabled.
Syntax
Parameters
Example
-- This program will first draw a rectangle, it will then rotate the rectangle by 45 degrees and scan it.
Image SaveTransform
Returns the current transformation matrix state of the device.
Syntax
state = Image.SaveTransform()
Return Values
Example
----- This program will first draw a rectangle and save it, and then it will rotate the rectangle by 45 degrees and scan it. Finally it will load the original state an
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 72 of 197
Image Scale
Scales the current transformation matrix of the device.
Syntax
Parameters
Example
----- This program will scale the Rectangle by a specified factor, and both the scaled and original rectangles will be marked.
--Draw a rectangle
Image.Box(0, 0, 25, 50, 45)
--Enlarge the width by 2 times and the height by 0.5 times
Image.Scale(2, 0.5)
--Scan the scaled rectangle
Image.Box(0, 0, 25, 50, 45)
Image ScaleRealtime
Scales the current transformation matrix by the given value. The transformation will be effective until the next ResetRtTransformMatrix is called. This command bypasses the
instruction buffer and therefore will take effect immediately. Real time transformation should be enabled using Image.RealtimeTransformEnabled command.
Syntax
Parameters
Example
----- This program will scale the Rectangle by a specified factor for x and y, and both the scaled and original rectangles will be marked.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 73 of 197
Image Translate
Translates the current transformation matrix of the device
Syntax
Parameters
dX float The distance by which the matrix should be translated along the x axis
dY float The distance by which the matrix should be translated along the y axis
dZ float The distance by which the matrix should be translated along the z axis
append bool If true, appends the translation matrix to the current matrix, else prepends.
Example
---- This program will scan the original and the translated version of "ScanMaster ScanScript" arcText
arcText.Font = "Arial"
arcText.CenterX = 0
arcText.CenterY = 0
arcText.StartAngle = 10
arcText.Height = 2.5
arcText.Elevation = 0
arcText.Align = ArcTextAlign.Baseline
Image TranslateRealtime
Translates the device transformation matrix by the specified offsets. This function bypasses the instruction buffer and therefore this will take effect immediately. Real time
transformation should be enabled using Image.RealtimeTransformEnabled. .
Syntax
Parameters
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 74 of 197
Example
-- This program will scan the original and the translated version of "ScanMaster ScanScript" arcText
arcText.Radius = 25
arcText.Font = "Arial"
arcText.CenterX = 0
arcText.CenterY = 0
arcText.StartAngle = 10
arcText.Height = 2.5
arcText.Elevation = 0
arcText.Align = ArcTextAlign.Baseline
Laser.Sleep(100)
--Enable the real time transformation commands
Image.RealtimeTransformEnabled(true)
Image.TranslateRealtime(1, 1)
--Mark the translated arc arcText
Image.Text(arcText)
Image.RealTimeTransformEnabled(false)
Input Output
Example
--This program will demonstrate Serial communication (via RS232)
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 75 of 197
--Writes "This is text" string to the port and assign it to the variable length.
length = port1.Write("This is text", 5000)
--Display the result
Report("The length of the string is "..length)
------------------Reads data from the port------------------------
--Reads the 5 characters from the port
readData = port1.Read(5,5000)
else
--Else show the received data
Report("Read Data:"..readData)
end
--Close Com2 port
port1.close()
IO OpenComPort
Opens the specified communication Port.
Syntax
Parameters
Properties
Methods
Example
--This program will demonstrate Serial communication (via RS232)
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 76 of 197
else
--Else show the received data
Report("Read Data:"..readData)
end
--Close Com2 port
port1.close()
IO PreloadJob
Loads the specified job file.
Syntax
Parameters
Methods
Execute Executes the preloaded job. It is executed inside the current running job and therefore some states of the device might have changed at the end of the job.
Note: When a job file is preloaded, the corresponding Laser settings will also be loaded.
Return Values
Example
--This program will demonstrate loading a job and scanning it.
--Load the "barcode.lsj" file from the card and assign it to the variable "preload"
preload=Io.PreloadJob("/mnt/SMC/Jobs/barcode.lsj")
preload.Execute()
IO PreloadVectorImage
Loads the specified static vector image file. Supports .svi files only.
Syntax
Parameters
Methods
Return Values
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 77 of 197
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
--Load a "textmarking.svi" file from the card and assign it to the variable "preload"
preload=Io.PreloadVectorImage("/mnt/SMC/Jobs/textmarking.svi")
--Scan the file
preload.Execute()
Laser.MarkSpeed = 150
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
--Load a "textmarking.svi" file from the card and assign it to the variable "preload"
preload=Io.PreloadVectorImage("Disk\\lec\\jobs\\textmarking.svi")
--Scan the file
preload.Execute()
IO ReadPin
Returns the state of the pin as a boolean value.
Syntax
Parameters
Return Values
Example
--This program will check the object to be marked by connecting the sensor to the UserIn1 pin, if it is accepted then the barcode will be marked.
Laser.MarkDelay = 200
var.Height = 25
var.X = 0.5
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 78 of 197
var.Y = 0.5
var.MatrixSize = DataMatrixSize.S16x16
var.HatchStyle = HatchStyle.Dot
var.DotDuration = 100
var.Format = DataMatrixFormat.Industry
count = 28198209
function Marking(serialNo)
-- "serialNo" value is used as DataMatrix barcode text
var.Text = serialNo
Image.Barcode(var)
end
while true do
--Check the sensor output
if (Io.ReadPin(Pin.Din.UserIn1)) then
Marking(count)
count = count+1
Laser.WaitForEnd()
else
--Keep the part on conveyor or start system
Laser.Sleep(100000)
end
end
IO ReadPort
Returns the state of the port as an integer value.
Syntax
Parameters
Return Values
Int
Example
--This program will check the object to be marked by connecting the sensor to the UserIn1 pin, if it is accepted then the barcode will be marked.
var.Height = 25
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 79 of 197
var.X = 0.5
var.Y = 0.5
var.MatrixSize = DataMatrixSize.S16x16
var.HatchStyle = HatchStyle.Dot
var.DotDuration = 100
var.Format = DataMatrixFormat.Industry
count = 28198209
function Marking(serialNo)
-- "serialNo" value is used as DataMatrix barcode text
var.Text = serialNo
Image.Barcode(var)
end
while true do
--Check the sensor output
if (Io.ReadPort(port.AuxiliaryIn) > 255) then
Marking(count)
count = count+1
Laser.WaitForEnd()
else
--Keep the part on conveyor or start system
Laser.Sleep(100000)
end
end
IO WaitForIO
Wait for the digital pin value to be set. Job execution will pause until the external signal is in the state, or changes to the state as specified.
Syntax
Parameters
Pin /
port / pin The specific port or pin
Port
trigger Trigger The type of trigger
timeoutInMicroSec int Abort wait if time exceeds the value. If timeout is zero, then wait indefinitely
debounceInMilliSec int Debounce interval in milliseconds
Immediate mode (True): This instruction will be executed immediately as the script is processed. Deferred mode (False, Default): This
flushImmediate bool
instruction will be queued for execution along with other marking instructions.
Note: This method is currently supported with the EC1000 and SMC cards only.
Example
--This program will mark a Box, when the user presses 'External Input' to UserIn1 input pin and then displays the message "Mark completed". If the user is not giving a
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 80 of 197
while (true) do
--Displays 'Press The Button'
Report("Press the Button")
--Halts the instruction execution until the UserIn1 input pin trigger level is High
IO.WaitForIO(Pin.Din.UserIn1, Trigger.Level.High, 10000000, 100)
--Scans a rectangle with a width and height of 1 and 2
Image.Box(0, 0, 25, 50, 0)
--Waits until finished
Laser.WaitForEnd()
--Displays 'Mark Completed' message
Report("Mark Completed")
end
IO WriteAnalog
Writes the specified value to an analog output port.
Syntax
Parameters
Note: This method is currently supported with the EC1000 and SMC cards only.
Example
--This program will mark the current date. It will write the value 3045 in the Camera system.
lineText.EvaluateVariableTags = true
lineText.Font = "Arial"
lineText.Height = 5.1
function Marking()
--Get the current date as marking text
lineText.Text = DateTime("[D]/[M]/[YY]")
Image.Text(lineText)
end
while (true) do
--System will wait for the UserIn1 pin input
Io.WaitForIo(Pin.Din.UserIn1, Trigger.Edge.Falling, 10000000 , 100)
--Write value 3045 in AnalogOut2 port to camera system
Io.WriteAnalog(Port.AnalogOut2, 3045)
Laser.WaitForEnd()
Marking()
end
IO WriteDigital
Writes the specified value to a digital port or pin.
Syntax
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 81 of 197
Parameters
Port /
port /Pin The specific digital port or pin to write the value.
Pin
value Int Value to send to port.
Immediate mode (True): This instruction will be executed immediately as the script is processed. Deferred mode (False, Default): This instruction
flushImmediate bool
will be queued for execution along with other marking instructions.
Note: This method is currently supported with the EC1000 and SMC cards only.
Example
--This program will mark the current date. It will write the value 126 in the PLC system.
lineText.EvaluateVariableTags = true
lineText.Font = "Arial"
lineText.Height = 5.1
function Marking()
--Get the current date as marking text
lineText.Text = DateTime("[D]/[M]/[YY]")
Image.Text(lineText)
end
while (true) do
--System will wait for the UserIn1 pin input
Io.WaitForIo(Pin.Din.UserIn1, Trigger.Edge.Falling, 10000000 , 100)
--Writes value 126 in AuxiliaryOut1 port (in the PLC system)
Io.WriteDigital(Port.AuxiliaryOut, 126)
Laser.WaitForEnd()
Marking()
end
Laser
methods
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 82 of 197
Example
--This program demonstrates how the global settings of a laser. User can change the parameters and observe the marking quality of a rectangle. This program will also d
--Blocks the script execution until the device finishes processing instructions in the buffer.
Laser.WaitForEnd()
--Display the time
Report(Stopwatch.Time())
Laser AxisDisable
Disables galvo axes on heads connected to the XY2-100e and XY2-100 ports. Axis selection is bit-encoded [ZYX] -> HeadAxes[2..0].
Note: This method is currently supported with the EC1000 and SMC cards only.
Syntax
Parameters
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 83 of 197
Example
--This Example will disables galvo heads
Laser.AxisDisable(0, 1)--Disable the galvo heads
Laser BeamOff
Turns the laser off.
Syntax
Laser.BeamOff()
Note: This method is currently supported with the EC1000 and SMC cards only.
Example
-- This program will move the galvo to the specified location once the laser is turned on. It will then scan the image and turn off the laser
Laser BeamOn
Turns the laser on.
Syntax
Laser.BeamOn()
Note: This method is currently supported with the EC1000 and SMC cards only.
Example
-- This program will move the galvo to the specified location once the laser is turned on. It will then scan the image and turn off the laser
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 84 of 197
Laser.JumpDelay = 100
Laser.MarkDelay = 100
Laser BreakAngle
Sets the Break Angle.
Syntax
Parameters
Example
--Blocks the script execution until the device finishes processing instructions in the buffer.
Laser.WaitForEnd()
Laser Dutycycle
Sets the percentage of the duty cycle. Supports two Laser Heads thus, Dutycycle1 and Dutycycle2.
Syntax
Dutycycle1 = int value (Duty cycle as a percentage for the relevant channel )
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 85 of 197
Example
--This program will mark a box,circle and an arc with different Duty cycles for both the Channels
Laser Frequency
Set the laser modulation frequency in KHz.
Syntax
Example
--This program will mark a Circle and a Box with the different Modulation frequencies.
Laser JumpDelay
Sets the delay used at the end of a jump command.
During a jump, the system mirrors accelerate too rapidly get to the next mark position, ideally at the fastest speed possible to minimize overall marking time. As with all
accelerations, mirror and system inertia create a slight lag at the beginning of the acceleration. Likewise, the system will require a certain delay (settling time) at the end of the
jump as it decelerates to precisely the correct speed required for accurate marking.
Acceleration and deceleration times and settling times will vary from system to system (weight of mirrors, type of galvanometer, etc.), and will vary depending on the
requested jump speed and the length of the jump.
Too short of Jump Delay will cause marking to start before mirrors are properly settled, while too long Jump Delay will increase the marking time.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 86 of 197
Syntax
Example
----This program demonstrates how the global settings of a laser works. User can change the parameters and observe the marking quality of a rectangle. This program wil
--Blocks the script execution until the device finishes processing instructions in the buffer.
Laser.WaitForEnd()
--Display the time
Report(Stopwatch.Time())
Laser JumpSpeed
Sets the vector speed at which a jump is executed in application selected unit/sec.
The laser is off during a jump and the jump speed is set high enough to maximize throughput, but low enough to minimize instability in the galvo motion as the galvo slows
down in its approaches the next marking location.
Syntax
Example
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 87 of 197
----This program demonstrates how the global settings of a laser works. User can change the parameters and observe the marking quality of a rectangle. This program wil
--Blocks the script execution until the device finishes processing instructions in the buffer.
Laser.WaitForEnd()
--Display the time
Report(Stopwatch.Time())
Laser LaserOffDelay
Sets the delay for turning off the laser when marking.
The Laser Off Delay can be used to prevent burn-in effects at the end of a vector. This delay in time before the laser is turned off is typically used to turn off the laser just
before the last few microsteps of a mark command to ensure that the marking stops exactly where it is desired to stop.Typically, too short of a delay will cause skipping of line
segments, and too long of a delay will cause burn-in at the end of line segments.
The goal is to adjust the Laser Off Delay to ensure uniform marking with no variations of intensity throughout the desired vector.
Syntax
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 88 of 197
Example
----This program demonstrates how the global settings of a laser works. User can change the parameters and observe the marking quality of a rectangle. This program wil
--Blocks the script execution until the device finishes processing instructions in the buffer.
Laser.WaitForEnd()
--Display the time
Report(Stopwatch.Time())
Laser LaserOnDelay
Specifies the waiting period before firing after an incremental jump.
The Laser On Delay can be used to prevent burn-in effects at the start of a vector. This delay in time before the laser is turned on is typically used to turn on the laser after the
first few microsteps of a mark command to ensure that the laser’s motion control systems (mirrors, etc.) are “up to speed” before marking. The vectors must be scanned with a
constant velocity to ensure uniform marking.
The delay can have either a positive or negative value and will vary with different marking media (some media require a burn- in time to begin marking). The goal is to adjust
the LaserOn Delay to ensure uniform marking with no variations of intensity throughout the desired vector.
Typically, too short of a delay will cause burn-in effects, and too long of a delay will cause skipping (missed line segments).
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 89 of 197
Syntax
Example
----This program demonstrates how the global settings of a laser works. User can change the parameters and observe the marking quality of a rectangle. This program wil
--Blocks the script execution until the device finishes processing instructions in the buffer.
Laser.WaitForEnd()
--Display the time
Report(Stopwatch.Time())
Laser LaserPipeLineDelay
The Laser Pipeline Delay shifts all of the laser timing signals as a group relative to the generation of the position commands. This shifting compensates for the finite amount
of time it takes for the servos to process the command information, and for the galvos to accelerate at the beginning of a move and decelerate at the end. By using this
compensation, it is possible to have a Laser On Delay value of zero since all of the laser timing signals are shifted to synchronize the time the laser actually starts emitting
with the time the galvos actually start.
The advantage of being able to set Laser On Delay to zero is that even if mark vectors are very short, the laser will always be guaranteed to turn on. Otherwise, if the vectors
are so short that they complete in a time less than the Laser On Delay, the laser will not turn on and faulty marking will result.
Because the laser may not turn off at the same rate that it turns on, the Laser Off Delay control is used to synchronize the laser and galvo timing at the end of a move. This
adjustment should be done after the start of mark-vector/laser timing is synchronized using the Laser Pipeline Delay control.
Normally, the galvos respond slower than the laser so the resulting Laser Pipeline Delay will almost always be greater than zero. If however the laser has a very slow turn-on,
it may be necessary to turn the laser on before the galvo commands are issued. This is done by setting the Laser On Delay to a negative value and the Laser Pipeline Delay to
zero.
Syntax
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 90 of 197
Note: This method is currently supported with the EC1000 and SMC cards only.
Example
--This program demonstrates how the global settings of a laser works. User can change the parameters and observe the marking quality of a rectangle. This program will
--Blocks the script execution until the device finishes processing instructions in the buffer.
Laser.WaitForEnd()
--Display the time
Report(Stopwatch.Time())
Laser MarkDelay
A mark delay at the end of marking a line segment allows the mirrors to move to the required position prior to executing the next mark command. Too short of a Mark Delay
will allow the subsequent jump command to begin before the system mirrors get to their final marking position. The end of the current mark will turn upwards towards the
direction of the jump vector, as shown below.
Too long of a Mark delay will cause no visible marking errors, but will add to the overall processing time.
Syntax
Example
----This program demonstrates how the global settings of a laser works. User can change the parameters and observe the marking quality of a rectangle. This program wil
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 91 of 197
--Blocks the script execution until the device finishes processing instructions in the buffer.
Laser.WaitForEnd()
--Display the time
Report(Stopwatch.Time())
Laser MarkSpeed
Sets the speed during marking. The speed is set to a value such that the laser forms the proper width and depth of a mark in the target media. This is laser power and target
material dependent.
Syntax
Example
-----This program demonstrates how the global settings of a laser works. User can change the parameters and observe the marking quality of a rectangle. This program wi
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 92 of 197
--Blocks the script execution until the device finishes processing instructions in the buffer.
Laser.WaitForEnd()
--Display the time
Report(Stopwatch.Time())
Laser MaxRadialError
Sets the Maximum Radial Error.
Syntax
MaxRadialError = float value (The max radial error in the specified unit. )
Note: This method is currently supported with the SMC cards only.
Example
------This program demonstrates how to set the maximum radial error.
--Blocks the script execution until the device finishes processing instructions in the buffer.
Laser.WaitForEnd()
Laser PointerDisable
Turns off the Laser Pointer.The laser beam will be enabled after this.
The laser beam will normally be turned off through the entire duration of the Tracing or Aligning. If however, the command Laser.PointerDisable() is present in the job
ScanScript, the laser will turn on.
Syntax
Laser.PointerDisable()
Note: This method is currently supported with the EC1000 and SMC cards only.
Example
--This Example will trace the circle with the laser pointer.
Laser PointerEnable
Turns on the Laser Pointer. The laser beam will be disabled after this.
The laser beam will normally be turned off through the entire duration of the Tracing or Aligning. If however, the command Laser.PointerDisable() is present in the job
ScanScript, the laser will turn on.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 93 of 197
Syntax
Laser.PointerEnable()
Note: This method is currently supported with the EC1000 and SMC cards only.
Example
------This Example will trace the circle with laser pointer
Laser PolyDelay
A polygon delay is a delay automatically inserted between two marking segments. The minimum delay allows enough time for the galvos and mirror to “catch-up” with the
command signal before a new command is issued to move on to the next point.
If variable polygon delay mode is selected, then the delay is variable and changes as a function as to how large an angular change is required to move on to the next point. The
larger the angular change, the longer it takes for the galvos to change direction and accelerate to the required speed in the new direction. The delay is scaled proportionally to
the size of the angle.
Syntax
Example
--This program demonstrates how the global settings of a laser works. User can change the parameters and observe the marking quality of a rectangle. This program will
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 94 of 197
--Blocks the script execution until the device finishes processing instructions in the buffer.
Laser.WaitForEnd()
--Display the time
Report(Stopwatch.Time())
Laser Power
Set the power level of the laser as a percentage.
The Laser Output Power must be set based on the material being used for marking and the type of marking. The power can be set as a percentage within the range of 0-100%.
You can use a higher laser power to engrave on a hard surface and a lower power to engrave on a sensitive surface. In the case of projection, the Laser Power can be used to
optimize the intensity of the laser beam.
Syntax
Example
----This program will mark a rectangle and a circle, with different power levels.
Laser PulseWaveform
Sets the pulse waveform of the laser. This is required only for SPI lasers.
Syntax
Example
--This Example will set the pulse waveform
Laser.PulseWaveform = 27--set the pulse waveform as 27
Laser SetVelocityCompensation
Sets the mode and behavior of the velocity controlled laser modulation compensation for scanning.
Syntax
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 95 of 197
Parameters
velocityCompensation VelocityCompensation Velocity Compensation mode. Available options are: Disabled,Dutycycle, Frequency,Power
Limit of maximum compensation as a percentage of the normal Marking power level. Range from - zero (maximum
limit int
compensation) to 100% (no compensation).
Sets how aggressively the system will compensate for velocity changes. The higher the number, the quicker the change will be
aggressiveness int
applied.
Note: This method is currently supported with the EC1000 and SMC cards only.
Example
---- This program will draw a 3D polyline
Laser SetLissajousWobble
Sets a Lissajous wobble pattern for wobble function.
SetLissajousWobble is used to specify a wobble pattern that represents a Lissajous path. The path's X and Y components are defined as sinusoidal waveforms with
independent frequencies and amplitudes. The starting phase relationship can also be specified.
The specified Lissajous pattern is calculated relative to a standard unrotated coordinate system.
The pattern is applied in real-time to the outgoing vector stream only when the laser is on for marking. It is not applied to jumps.
As the vector path changes direction, the Lissajous pattern is transformed to follow the vector orientation.
This feature will override other Wobble attribute definitions associated with the normal circular wobble pattern.
Syntax
SetLissajousWobble( float X_Width, float Y_Width, float X_Frequency, float Y_Frequency, float X_Phase )
SetLissajousWobble( )
Parameters
X_Width float Specifies the width in user units of the X axis sinusoidal wobble component.
Y_Width float Specifies the width in user units of the Y axis sinusoidal wobble component.
X_Frequency float Specifies the frequency of the X axis wobble pattern in KHz.
Y_Frequency float Specifies the frequency of the Y axis wobble pattern in KHz.
X_Phase float Specifies the phase relationship of the X axis pattern relative to the Y axis pattern. The range is +/- 180 degrees.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 96 of 197
Example
--This program marks a Square inside a square with Lissajous wobble pattern enabled and disabled
System.SetGalvoCmdMarker()
-- Scans a square
Image.Box(0, 0, 30, 30, 0)
Laser Sleep
Put the laser on stand by mode for a given amount of time in microseconds.
Syntax
Parameters
Example
-----This Example describes marking with serial numbers. Using the Sleep command a delay is introduced to the loop.
--Variable assignment
number = 19820928
--Use horizontal text
multiText = Text.Horizontal()
multiText.X = -1
multiText.Y = 0
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 97 of 197
multiText.Font = "Arial"
multiText.CharacterGap = 0.1
multiText.Elevation = 0
multiText.Angle = 30
multiText.Height = 12.5
multiText.ScaleX = 1
multiText.ScaleY = 1
--MarkText function
function MarkText()
--Text is comprised of string "SN:" and a number variable
multiText.Text = "SN:"..number
--Mark the horizontal text as a serial number
Image.Text(multiText)
end
--count variable assignment
count = 0
--Loop
while true do
--Function calling
MarkText()
--Increment count by 1
count = count+1
--If the value = 10, loop terminates
if count == 10 then
break
end
--Introduces the delay between each marking
Laser.Sleep(1000)
end
Laser Timer
Measure the elapsed time.
Syntax
Laser.Timer.Start()
Methods
Note: This method is currently supported with the EC1000 and SMC cards only.
Example
----This program will scan an Arc Text when the user press the userin1 pin. After marking 10 times it will display the average marking time
arcText.CenterX = 0
arcText.CenterY = 0
arcText.Radius = 50
arcText.Elevation = 0
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 98 of 197
arcText.CharacterGap = 0.0
arcText.Clockwise = true
arcText.Font = "Arial"
arcText.Height = 12.2
arcText.Align = ArcTextAlign.Baseline
arcText.StartAngle = 120
count = 0
--Start the Timer
Laser.Timer.Start()
--Start the While loop. The loop will run 10 times
while count < 10 do
--Pause the timer
Laser.Timer.Pause()
--Wait for user input
Io.WaitForIo(Pin.Din.UserIn1, Trigger.Edge.Falling, 10000000, 100)
--Resume the timer
Laser.Timer.Resume()
Image.Text(arcText)
--Waits until finished
Laser.WaitForEnd()
--Increment the Count by 1
count = count + 1
end
--Stop the timer
Laser.Timer.Stop()
--Displays the average marking time per cycle
Report("Average Marking Time:" ..(Laser.Timer.Time() / count).."ms per cycle" )
Laser VariPolyDelayFlag
Set if using variable polygon delay values. If variable polygon delays are used, then the PolyDelay value is adjusted proportional to the angular change in the next segment of
the poly-vector.
Syntax
VariPolyDelayFlag = bool value (Enables variable polygon delay if value is set to true. Options: true, false)
Note: This method is currently supported with the EC1000 and SMC cards only.
Example
----This program demonstrates how the global settings of a laser works. User can change the parameters and observe the marking quality of a rectangle. This program wil
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 99 of 197
Laser.MarkSpeed = 150
--Set channel 1 duty cycle as a percentage
Laser.Dutycycle1 = 50
--Blocks the script execution until the device finishes processing instructions in the buffer.
Laser.WaitForEnd()
--Display the time
Report(Stopwatch.Time())
Laser WaitForEnd
Blocks the script execution until the laser has finished processing the instructions it has received.
Syntax
WaitForEnd()
Example
------ This Example describes the Sleep command
Laser WobbleEnabled
Enables or disables the wobble function. Enable "Wobble" to mark thicker lines by Wobbling the laser beam. When the Wobble is enabled the galvos draw overlapping
circles as they move. This function may be very useful for welding operations. You specify the width of the path, the percentage overlap you want the circles to have, and the
marking speed (tangential velocity of the circular path). This creates a spiral path along a poly-vector that causes the laser to expose at constant power level along the path.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 100 of 197
Syntax
Note: This method is currently supported with the EC1000 and SMC cards only.
Example
------ This program marks a Rectangle with a line width of 0.01 and 80% overlap and finally disables the line width and scans a circle.
Laser WobbleMode
Sets the wobble mode. Use the WobbleMode enumeration to choose the desired wobble mode.
Syntax
Note: This method is currently supported with the SMC card only.
Example
----This program marks a Rectangle with a line width of 0.01 and 80% overlap and finally disables the line width and scans a circle.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 101 of 197
Laser WobbleOverlap
Sets the wobble overlap percentage.
Syntax
Note: This method is currently supported with the EC1000 and SMC cards only.
Example
----This program marks a Rectangle with a line width of 0.01 and 80% overlap and finally disables the line width and scans a circle.
Laser WobblePeriod
Sets the wobble period when Laser.WobbleMode = 2 is selected.
Syntax
Note: This method is currently supported with the SMC card only.
Example
--This program marks a Rectangle with a line width of 0.01 and 80% overlap and finally disables the line width and scans a circle.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 102 of 197
Laser WobbleThickness
Sets the Wobble thickness. Thickness of a line is determined by the value given for Wobble Thickness.
Syntax
Note: This method is currently supported with the EC1000 and SMC cards only.
Example
----This program marks a Rectangle with a line width of 0.01 and 80% overlap and finally disables the line width and scans a circle.
Motion
Example
--This example will demonstrate how to move a motor.
--Set params with velocity = 20 mm/s, accel = 500 mm/s², decel = 500 mm/s².
Motion.SetMoveParams(0,20,500,500)
--Move motor with 20 mm
Motion.MoveRelative(0,20)
--Wait for motor until it stops
Motion.WaitForMotion(0)
Motion GetCurrentPosition
Gets the current position of a motor
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 103 of 197
Syntax
Parameters
Return Values
Example
--This program will demonstrate the Motion.GetCurrentPosition method
Motion GetMotionStatus
Gets the status of the motion of a given motor. Returns 1 or 0 to indicate the movement of the motor.
Syntax
Parameters
Return Values
1 if Moving , 0 if Stoped
Example
--This program will demonstrate the Motion.GetMotionStatus method
Motion MoveAbsolute
Moves a given motor to a specific location.
Syntax
Parameters
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 104 of 197
Return Values
Example
--This program will demonstrate the Motion.MoveAbsolute method
Motion MoveRelative
Moves a given motor to a relative position.
Syntax
Parameters
Return Values
Example
--This program will demonstrate the Motion.MoveRelative method
Motion SetCurrentPosition
Sets the current position of the motor.
Syntax
Parameters
Return Values
Example
--This program will demonstrate the Motion.SetCurrentPosition method
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 105 of 197
Motion SetMoveParams
Creates an instance of motor with given configurations.
Syntax
Motion.SetMoveParams( string friendly name, float velocity, float accelerate, float de-accelerate )
Motion.SetMoveParams( int channel, float velocity, float accelerate, float de-accelerate )
Parameters
Return Values
Example
--This program will demonstrate the Motion.SetMoveParams method
Motion Stop
Stops a motion command executed on a given motor.
Syntax
Parameters
Return Values
Example
--This program will demonstrate the Motion.Stop method
--Stop a motor
--Channel 0 with Friendly Name X
Motion.Stop(0)
--Motion.Stop(X)
Motion WaitForMotion
Wait for a motor to complete a given motion command.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 106 of 197
Syntax
Parameters
Return Values
Example
--This program will demonstrate the Motion.WaitForMotion method
Math
Math Abs
Return the absolute number of a given value.
Syntax
Parameters
Return Values
Returns an integer
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 107 of 197
Example
--This program will mark 2 circles. Coordinates of the second circle are calculated by calling the Math.Abs function.
--center X coordinate
centerX = -25.57
--center Y coordinate
centerY = -35.59
--Radius is 1 inch
radius = 25
--Original circle
Image.Circle(centerX, centerY, radius)
--Mirrored circle(neglect the - sign)
Image.Circle(Math.Abs(centerX), Math.Abs(centerY), radius)
Math Acos
Returns the inverse cosine of a given value in Radians or Degrees depending on the current angle unit.
Syntax
Parameters
Return Values
Example
------ This will draw the rectangle and calculate the angle in the hypotenuse by applying trigonometric functions.
Math Asin
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 108 of 197
Syntax
Parameters
Return Values
Example
----This program will generate random numbers and calculate the angle (radians and degrees) by using the Math.Asin function.
Math Atan
Returns the angle whose tangent is the specified number.
Syntax
Parameters
Return Values
Returns the inverse tangent of 'value' in degrees or radians depending on the current angle unit.
Example
--This will draw the rectangle and calculate the angle in the hypotenuse by applying trigonometric functions.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 109 of 197
Math Atan2
Return the angle whose tangent is the quotient of the two specified numbers.
Syntax
Parameters
Return Values
An angle, measured in the unit specified in SetAngleUnits, where (x, y) is a point in the Cartesian plane.
Example
----- This will display the inverse tangent value of theta angle by using Atan2 command
Math Ceil
Returns the smallest integer larger than or equal to specified number.
Syntax
Parameters
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 110 of 197
Return Values
Example
----- This will display the greater and smaller integer values
Math Cos
Returns the cos value of the angle according to the unit specified in SetAngleUnits.
Syntax
Parameters
Return Values
Example
----- This will display the radians, cosine, sine and the tangent values of a theta angle of 45
Math Deg
Converts radians in to degrees.
Syntax
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 111 of 197
Parameters
Return Values
Example
---- This will draw the rectangle and calculate the angle in the hypotenuse by applying trigonometric functions.
Math Exp
Returns 'e' raised to the specified power.
Syntax
Parameters
Return Values
Example
------ This will display the Exponential values up to the power of 10 along with its natural logarithmic value
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 112 of 197
Laser.JumpDelay = 150
Laser.MarkDelay = 200
--For loop
for index = 1, 10 do
--Display the exponential value and natural logarithm value
Report(Math.Exp(index).." "..Math.Log(Math.Exp(index)))
end
Math Floor
Returns the largest integer less than or equal to specified number.
Syntax
Parameters
Return Values
Example
----- This will display the greater and smaller integer values
Math Fmod
Returns the remainder of the division of two numbers that rounds the quotient towards zero.
Syntax
Parameters
Return Values
Example
-----This will display the integer and fractional part of a given number.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 113 of 197
Math Log
Returns the natural (base e) logarithm of the specified number.
Syntax
Parameters
Return Values
Example
------This will display the Exponential value until power of 10 and its natural logarithm value
--For loop
for index = 1, 10 do
--Display the exponential value and natural logarithm value
Report(Math.Exp(index).."\t"..Math.Log(Math.Exp(index)))
end
Math Log10
Return the base 10 logarithm of a given number.
Syntax
Parameters
Return Values
Example
------ This will display ten raised to the power value from -5 to 5 and its base 10 logarithm value
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 114 of 197
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
--For loop
for index = -5,5 do
--Display 10 to the power value and base 10 logarithm value
Report(Math.Pow(10,index).."\t"..Math.Log10(Math.Pow(10,index)))
end
Math Max
Return the maximum value.
Syntax
Parameters
Return Values
Example
------This program will display the maximum and the minimum values from a list of numbers.
--Display the maximum and the minimum values in the given range
Report("Maximum value "..Math.Max(1.2, -7, 3).." Minimum value "..Math.Min(1.2, -7, 3))
Math Min
Return the minimum value.
Syntax
Parameters
Return Values
Example
----This program will display the maximum and the minimum values from a list of numbers.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 115 of 197
--Display the maximum and the minimum values in the given range
Report("Maximum value "..Math.Max(1.2, -7, 3).." Minimum value "..Math.Min(1.2, -7, 3))
Math PI
Ratio of the circumference of a circle to its diameter, specified by the constant, PI.
Syntax
PI : float value
Return Values
Example
------ This Program will scan "ScanMaster" as a polar array.
--Text height
height = 5
--Use horizontal text
myText = Text.Horizontal()
myText.Elevation = 0
myText.Height = height
--Use "Simplex.ovf" font (Font should be embed)
myText.Font = "SIMPLEX.ovf"
--Marking string
myText.Text = "ScanMaster"
myText.Angle = i
--Scan text
Image.Text(myText)
end
Math Pow
Returns the specified number raised to specified power.
Syntax
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 116 of 197
Parameters
Return Values
Example
--This will draw the rectangle and calculate the angle in the hypotenuse by applying trigonometric functions.
Math Rad
Convert degrees to radians.
Syntax
Parameters
Return Values
Example
------ This will display the radians, cosine, sine and the tangent values of a theta angle of 45
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 117 of 197
Laser.JumpDelay = 150
Laser.MarkDelay = 200
--Assign value to variable theta
theta = 45
Math Random
Returns a random value. If no arguments passed random value is within [0, 1]. If a single argument is passed the value will be within [1, min]. If two arguments are passed the
value will be within[min, max].
Syntax
Random( )
Random( int min )
Random( int min, int max )
Parameters
Return Values
If single argument provided, returns random integer value greater than zero and less than the specified value.
If two arguments provided, returns a random integer greater than the first argument but less than the second argument.
Example
Math Round
Changes any given number to the nearest round number
Syntax
Parameters
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 118 of 197
decimal int represents the number of decimal places inserted *This is an optional parameter.
rounding MidpointRounding rounding mode.
Return Values
Example
------This program will demonstrate the Math.Round() method.
beforeValue = 123.45
afterValue1 = Math.Round(beforeValue,1, MidpointRounding.AwayFromZero)
afterValue2 = Math.Round(beforeValue,1, MidpointRounding.ToEven)
afterValue3 = Math.Round(beforeValue)
Math Sin
Return the sine value for a given value in the specified unit in SetAngleUnits.
Syntax
Parameters
Return Values
Example
----This will display the radians, cosine, sine and the tangent values of a theta angle of 45
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 119 of 197
Math Sqrt
Return the square root of a given number.
Syntax
Parameters
Return Values
Example
-----This will draw the rectangle and calculate the angle in the hypotenuse by applying trigonometric functions.
Math Tan
Returns the tan value of the angle passed according to the unit set in SetAngleUnits.
Syntax
Parameters
Return Values
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 120 of 197
Example
--This will display the radians, cosine, sine and the tangent values of a theta angle of 45
The default single-axis MOTF configuration is set using the parameters Motf.CalFactor, Motf.Mode and Motf.Direction defined in the Controller Configuration file and
additionally changeable as part of a job. Run-time control of the MOTF operation is performed through the use of several commands including Motf.Initialize and
Motf.StartTracking.
The MOTF commands are designed to permit multiple scenarios that include variable spaced part detection, uniformly spaced image marking, and tiling based continuous
image marking. The diagram below illustrates how a Script would initiate and control a sequence of MOTF operations where a part is detected and marking synchronized with
the position and motion of each part.
Properties
CalFactor Sets the relationship between laser positioning bits to motion encoder counts. This value will be applied to both the MOTF 0 and MOTF 1 encoder ports.
CalFactor0 Sets the relationship between laser positioning bits to motion encoder counts for encoder port MOTF 0.
CalFactor1 Sets the relationship between laser positioning bits to motion encoder counts for encoder port MOTF 1.
Direction The target travel direction of the web or conveying system relative to a job coordinate system.
Mode Defines how MOTF position information is derived.
Tracking Sets the MOTF tracking behavior.
WaitForCounterPort Sets the MOTF port that will be used for commands
Methods
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 121 of 197
Example
--This program will mark 2 circles. Coordinates of the second circle are calculated by calling the Math.Abs function.
--center X coordinate
centerX = -2.5
--center Y coordinate
centerY = -3.5
--Radius is 1 inch
radius = 1
--Original circle
Image.Circle(centerX, centerY, radius)
--Mirrored circle(neglect the - sign)
Image.Circle(Math.Abs(centerX), Math.Abs(centerY), radius)
Motf CalFactor
Sets the relationship between laser positioning bits to motion encoder counts. The units are galvo-command-bits per encoder-count. This value is applied to both encoder
inputs. For rotary MOTF, it is the number of micro-radians per encoder- count.
Typically for linear MOTF operation, this value calculated by multiplying the linear resolution of the encoder (mm/count) by the scan head cal factor value (bits/mm) yielding
the MOTF CalFactor (bits/count). The scan head cal factor can be referenced in the script by accessing the variable System.CalFactorX or System.CalFactorY dpending on
the direction of the MOTF conveying system.
Syntax
Value
value float Calibration factor in galvo-command-bits per encoder-count. A negative number corresponds to a downward counting encoder when tracking forward motion.
Return Values
Example
-- This sample marks a series of circles spaced at a constant distance
SetUnits(Units.Millimeters)
-- Use MOTF Port 0
MOTF.Mode = Encoder.ExternalSingleAxis
-- Web direction
MOTF.Direction = Direction.BottomToTop
-- 10um linear resolution for example
encoderLinResInMmPerCount = 0.010
-- Bits/Mm * Mm/Count -> Bits/Count
MOTF.CalFactor = System.CalFactorX *
encoderLinResInMmPerCount
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 122 of 197
Motf CalFactor0
Sets the relationship between laser positioning bits to motion encoder counts. The units are galvo-command-bits per encoder-count. This value is applied to encoder input port
MOTF 0 which affects tracking in the job X axis.
Typically for linear MOTF operation, this value calculated by multiplying the linear resolution of the encoder (mm/count) by the scan head cal factor value (bits/mm) yielding
the MOTF CalFactor (bits/count). The scan head cal factor can be referenced in the script by accessing the variable System.CalFactorX.
Syntax
Value
value float Calibration factor in galvo-command-bits per encoder-count. A negative number corresponds to a downward counting encoder when tracking forward motion
Return Values
Example
-- This sample marks a series of circles spaced at a constant distance
SetUnits(Units.Millimeters)
-- Use MOTF Port 0
MOTF.Mode = Encoder.ExternalSingleAxis
-- Web direction
MOTF.Direction = Direction.LeftToRight
-- 10um linear resolution for example
encoderLinResInMmPerCount = 0.010
-- Bits/Mm * Mm/Count -> Bits/Count
MOTF.CalFactor0 = System.CalFactorX *
encoderLinResInMmPerCount
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 123 of 197
Motf CalFactor1
Sets the relationship between laser positioning bits to motion encoder counts. The units are galvo-command-bits per encoder-count. This value is applied to encoder input port
MOTF 1 which affects tracing in the job Y axis.
Typically for linear MOTF operation, this value calculated by multiplying the linear resolution of the encoder (mm/count) by the scan head cal factor value (bits/mm) yielding
the MOTF CalFactor1 (bits/count). The scan head cal factor can be referenced in the script by accessing the variable System.CalFactorY.
Syntax
Value
value float Calibration factor in galvo-command-bits per encoder-count. A negative number corresponds to a downward counting encoder when tracking forward motion.
Return Values
Example
-- This sample marks a series of circles spaced at a constant distance
SetUnits(Units.Millimeters)
-- Use MOTF Port 0
MOTF.Mode = Encoder.ExternalSingleAxis
-- Web direction
MOTF.Direction = Direction.BottomToTop
-- 10um linear resolution for example
encoderLinResInMmPerCount = 0.010
-- Bits/Mm * Mm/Count -> Bits/Count
MOTF.CalFactor1 = System.CalFactorY *
encoderLinResInMmPerCount
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 124 of 197
Image.Circle(0, 0, 20)
MOTF.StopTrackingAndJump(0, 0, 0, 200)
Laser.WaitForEnd()
-- Counters are still counting and distance being measured
end
Motf CenterOfRotation
Sets the center of rotation for rotary MOTF operation. Coordinates in the global address space with the lens field origin being 0,0. The diagram below shows how to interpret
the geometry associated with rotary MOTF operation.
Syntax
CenterOfRotation(float x, float y)
Parameters
Example
-- This sample marks a square on a rotating platen where the center
-- of rotation is displaced from the scan head origin.
EncoderResolutionCountsPerRev = 40000
EncoderResolutionMicroRadPerCount = ((2 * 3.14159)
/ EncoderResolutionCountsPerRev) * 1000000
Report("EncoderResInMicroRadPerCount = " .. EncoderResolutionMicroRadPerCount)
-- In Rotary mode, the encoder counts are scaled to Micro-radians
MOTF.CalFactor = EncoderResolutionMicroRadPerCount
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 125 of 197
Motf DelayCompensation
NOTE: This method is deprecated.
Sets a compensation value in usec for delays in MOTF system that exist between the triggering of a WaitForCount or WaitForDistance command and the beginning of actual
lasing operations. Only needed for very precise high-speed MOTF operations.
Syntax
DelayCompensation(int delay)
Parameters
Example
-- This sample marks a series of circles spaced at a constant distance
SetUnits(Units.Millimeters)
-- Use MOTF Port 0
MOTF.Mode = Encoder.ExternalSingleAxis
-- Web direction
MOTF.Direction = Direction.BottomToTop
-- 10um linear resolution for example
encoderLinResInMmPerCount = 0.010
-- Bits/Mm * Mm/Count -> Bits/Count
MOTF.CalFactor1 = System.CalFactorY *
encoderLinResInMmPerCount
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 126 of 197
Laser.Frequency = 20
Laser.DutyCycle1 = 50
Laser.Power = 50
Laser.LaserOnDelay = 75
Laser.LaserOffDelay = 125
Laser.PolyDelay = 50
Laser.VariPolyDelayFlag = true
Motf Direction
The target travel direction relative to a job coordinate system. You need to specify the direction in which the belt is moving to achieve the desired output.
Syntax
Motf.Direction = Direction.<direction>
Value
Example
-- This sample marks a series of circles spaced at a constant distance
SetUnits(Units.Millimeters)
-- Use MOTF Port 0
MOTF.Mode = Encoder.ExternalSingleAxis
-- Web direction
MOTF.Direction = Direction.BottomToTop
-- 10um linear resolution for example
encoderLinResInMmPerCount = 0.010
-- Bits/Mm * Mm/Count -> Bits/Count
MOTF.CalFactor = System.CalFactorY *
encoderLinResInMmPerCount
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 127 of 197
See Also
Motf DisableLaserRegulation
Disables laser regulation.
Syntax
DisableLaserRegulation()
Example
Text-- This sample images a square at equal spacing using Laser Regulation
SetUnits(Units.Millimeters)
-- Use MOTF Port 0
MOTF.Mode = Encoder.ExternalSingleAxis
-- Web direction
MOTF.Direction = Direction.BottomToTop
-- 10um linear resolution for example
encoderLinResInMmPerCount = 0.010
-- Bits/Mm * Mm/Count -> Bits/Count
MOTF.CalFactor = System.CalFactorY *
encoderLinResInMmPerCount
MOTF.EnableLaserRegulation(minWebSpeedInMmPerSec, maxWebSpeedInMmPerSec,
laserPropertyScaleAtMinWebSpeedInPct, laserPropertyScaleAtMaxWebSpeedInPct,
LaserRegMode.DutyCycle)
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 128 of 197
Motf DisableSpeedRegulation
Disables speed regulation.
Syntax
DisableSpeedRegulation()
Example
-- This sample images a square at equal spacing using Marking Speed Regulation
SetUnits(Units.Millimeters)
-- Use MOTF Port 0
MOTF.Mode = Encoder.ExternalSingleAxis
-- Web direction
MOTF.Direction = Direction.BottomToTop
-- 10um linear resolution for example
encoderLinResInMmPerCount = 0.010
-- Bits/Mm * Mm/Count -> Bits/Count
MOTF.CalFactor = System.CalFactorY * encoderLinResInMmPerCount
MOTF.EnableSpeedRegulation(minWebSpeedInMmPerSec, maxWebSpeedInMmPerSec,
speedScaleAtMinWebSpeedInPct, speedScaleAtMaxWebSpeedInPct)
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 129 of 197
MOTF.StartTracking(Tracking.WhileMarking)
Image.Box(-10, -10, 20, 20)
MOTF.StopTrackingAndJump(0, 0, 0, 200)
Laser.WaitForEnd()
-- Counters are still counting and distance being measured
-- The next two lines if uncommented are for diagnostics
-- webSpeedInBitsPerMsec = IO.ReadPort(Port.Advanced.MOTFFrequency1)
-- Report("Web speed in mm/sec: " .. (webSpeedInBitsPerMsec * 1000) / System.CalFactorY)
end
Motf EnableLaserRegulation
Enables laser parameter regulation as a function of MOTF speed.
The first two arguments let you specify the range of web speeds over which a linear scaling of a selected laser parameter, determined by the optional argument
LaserRegMode, will take place. If the belt speed is reduced to below motfSpeedMin, the selected laser parameter will be clamped at scaleFactorMinPct times the current set-
point of the parameter. If the web speed exceeds motfSpeedMax the selected laser parameter will be clamped at scaleFactorMaxPct times the current set-point of the
parameter.
Over the web speed range between motfSpeedMin and motfSpeedMax, the current set-point of the selected laser parameter is linearly scaled between scaleFactorMinPct and
scaleFactorMaxPct.
Syntax
EnableLaserRegulation( float motfSpeedMin, float motfSpeedMax, float scaleFactorMinPct, float scaleFactorMaxPct, LaserRegMode laserRegMode)
Parameters
motfSpeedMin float Minimum specified MOTF speed that scaling will be applied.
motfSpeedMax float Maximum specified MOTF speed that scaling will be applied.
scaleFactorMinPct float Scale factor in % applied the laser parameter set-point when the MOTF speed is at the minimum specified value.
scaleFactorMaxPct float Scale factor in % applied the laser parameter set-point when the MOTF speed is at the maximum specified value.
laserRegMode LaserRegMode Optional setting of the laser property to be regulated. Default is DutyCycle.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 130 of 197
Example
Text-- This sample images a square at equal spacing using Laser Regulation
SetUnits(Units.Millimeters)
-- Use MOTF Port 0
MOTF.Mode = Encoder.ExternalSingleAxis
-- Web direction
MOTF.Direction = Direction.BottomToTop
-- 10um linear resolution for example
encoderLinResInMmPerCount = 0.010
-- Bits/Mm * Mm/Count -> Bits/Count
MOTF.CalFactor = System.CalFactorY *
encoderLinResInMmPerCount
MOTF.EnableLaserRegulation(minWebSpeedInMmPerSec, maxWebSpeedInMmPerSec,
laserPropertyScaleAtMinWebSpeedInPct, laserPropertyScaleAtMaxWebSpeedInPct,
LaserRegMode.DutyCycle)
Motf EnableSpeedRegulation
Enables marking speed regulation as a function of MOTF speed.
The first two arguments let you specify the range of belt speeds over which a linear scaling of marking speed will take place. If the belt speed is reduced to below
motfSpeedMin, then the MarkSpeed will be clamped at markSpeedScaleMinPct, where markSpeedScaleMinPct is a percentage multiplier of the MarkSpeed. If the belt speed
exceeds motfSpeedMax then the MarkSpeed will be clamped to markSpeedScaleMaxPct where markSpeedScaleMaxPct is a percentage multiplier of the MarkSpeed.
Over the web speed range between motfSpeedMin and motfSpeedMax, the current set-point marking speed is linearly scaled between markSpeedScaleMinPct and
markSpeedScaleMaxPct.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 131 of 197
Syntax
Parameters
motfSpeedMin float Minimum specified MOTF speed that scaling will be applied.
motfSpeedMax float Maximum specified MOTF speed that scaling will be applied.
markSpeedScaleMinPct float Scale factor in % applied to the mark speed set-point when the MOTF speed is at the minimum specified value.
markSpeedScaleMaxPct float Scale factor in % applied to the mark speed set-point when the MOTF speed is at the maximum specified value.
Example
-- This sample images a square at equal spacing using Marking Speed Regulation
SetUnits(Units.Millimeters)
-- Use MOTF Port 0
MOTF.Mode = Encoder.ExternalSingleAxis
-- Web direction
MOTF.Direction = Direction.BottomToTop
-- 10um linear resolution for example
encoderLinResInMmPerCount = 0.010
-- Bits/Mm * Mm/Count -> Bits/Count
MOTF.CalFactor = System.CalFactorY * encoderLinResInMmPerCount
MOTF.EnableSpeedRegulation(minWebSpeedInMmPerSec, maxWebSpeedInMmPerSec,
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 132 of 197
speedScaleAtMinWebSpeedInPct, speedScaleAtMaxWebSpeedInPct)
Motf Initialize
Initialize the marking controller for MOFT operation
Syntax
Initialize ()
Example
-- This program demonstrates on-the-fly marking. Here a DataMatrix barcode is scanned.
-- The Barcode string is incremented by 1.
SetUnits(Units.Millimeters)
-- Use MOTF Port 0
MOTF.Mode = Encoder.ExternalSingleAxis
-- Web direction
MOTF.Direction = Direction.BottomToTop
-- 10um linear resolution for example
encoderLinResInMmPerCount = 0.010
-- Bits/Mm * Mm/Count -> Bits/Count
MOTF.CalFactor = System.CalFactorY *
encoderLinResInMmPerCount
--Variable initialization
serialNo = 105646
--Assign DataMatrix barcode to variable "code"
code = Barcodes.DataMatrix()
--Barcode height
code.Height = 10.0
--X coordinate
code.X = -5
--y coordinate
code.Y = -5
--Angle of the barcode
code.Angle = 0
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 133 of 197
function MarkBarcode()
--Assign serialNo variable to DataMatrix text string
barcodeText = "SN:"..serialNo
code.Text = barcodeText
--Mark DataMatrix code
Image.Barcode(code)
--Increments the Serial number by 1
serialNo = serialNo+1
--Display message "Mark Section Completed"
Report("Marked bacode: " .. barcodeText)
end
Motf Mode
Sets how MOTF position information is derived.
Syntax
Motf.Mode = Encoder.<mode>
Parameters
Example
-- This program demonstrates on-the-fly marking. Here a DataMatrix barcode is scanned.
-- The Barcode string is incremented by 1.
SetUnits(Units.Millimeters)
-- Use MOTF Port 0
MOTF.Mode = Encoder.ExternalSingleAxis
-- Web direction
MOTF.Direction = Direction.BottomToTop
-- 10um linear resolution for example
encoderLinResInMmPerCount = 0.010
-- Bits/Mm * Mm/Count -> Bits/Count
MOTF.CalFactor = System.CalFactorY *
encoderLinResInMmPerCount
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 134 of 197
Laser.MarkSpeed = 2000
Laser.MarkDelay = 200
Laser.JumpSpeed = 5000
Laser.JumpDelay = 200
Laser.Frequency = 20
Laser.DutyCycle1 = 50
Laser.Power = 50
Laser.LaserOnDelay = 75
Laser.LaserOffDelay = 125
Laser.PolyDelay = 50
Laser.VariPolyDelayFlag = true
--Variable initialization
serialNo = 105646
--Assign DataMatrix barcode to variable "code"
code = Barcodes.DataMatrix()
--Barcode height
code.Height = 10.0
--X coordinate
code.X = -5
--y coordinate
code.Y = -5
--Angle of the barcode
code.Angle = 0
--Matrix size is 16x16
code.MatrixSize = DataMatrixSize.S16x16
--Apply Dot hatch pattern (Options: Vertical Serpentine or horizontal or Helix filling pattern can be used)
code.HatchStyle = HatchStyle.Dot
--Sets dot duration as 100
code.DotDuration = 100
--Code format is Industry (Options: Default,Industry,macro_05,macro_06)
code.Format = DataMatrixFormat.Industry
function MarkBarcode()
--Assign serialNo variable to DataMatrix text string
barcodeText = "SN:"..serialNo
code.Text = barcodeText
--Mark DataMatrix code
Image.Barcode(code)
--Increments the Serial number by 1
serialNo = serialNo+1
--Display message "Mark Section Completed"
Report("Marked bacode: " .. barcodeText)
end
See Also
Motf PosFFCompEnable
This enables or disables position feed-forward compensation during high-accuracy MOTF operation, e.g. during SyncMaster operation. MOTF tracking is done through
observation of the motion of the moving element, e.g. a web or stage, using the position encoders as inputs. Because the galvo positions are altered in response to these
measurements, there is always an inherent lag in the compensated position of the scan head galvos due to the tracking delay of the galvo servo controllers. This lag contributes
to a positioning error of the focused beam on the work piece that is proportional to the speed of the work piece and the amount of the tracking delay of the galvo servos.
To compensate for this lag, position feed-forward adjustments are added to the galvo commands. These adjustments are calculated in real-time based on the measured work-
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 135 of 197
piece speed and acceleration. The current speed and acceleration of the motion system is used to project where the work-piece will be in the near-term future, i.e. the tracking
delay time of the galvo servos. For the short time frames of the tracking delay, the predicted position of the work-piece is easily calculated, and the projected position added to
the galvo job commands.
The position feed-forward compensation takes advantage of the fact that the galvos are far faster with far greater acceleration than the work-piece transport mechanism and
can be made to be in the proper position to minimize the positioning error. This compensation can be used in SyncMaster and normal MOTF operations.
Syntax
Parameters
Compensation method:
0 = None
1 = SW (Traditional mode marking only)
method int
2 = HW (Default - ScanPack or Traditional mode marking)
Both methods rely on an accurate setting of the X & Y galvo tracking delays in the ControlConfig file. This can be measured using SW tools provided by
CT technical support.
Example
-- This sample shows SyncMaster operation
-- The script units are in mm
SetUnits(Units.Millimeters)
-- SyncMaster initialization
SyncMaster.Connect()
SyncMaster.Initialize()
-- Move the stage so that a defined workspace origin on the stage surface is underneath the scan-head origin
-- The actual stage location relative to the stage home position is defined in the SyncMasterConfig file on the SMC
Stage.MoveAbsolute(0,0)
-- Start marking the job data described on the SMD canvas or SMAPI vector images
ScanAll()
-- When scanning is completed, disable the stage tracking and return the galvos to the scan-head origin
MOTF.StopTrackingAndJump(0,0,0,500)
Motf ResetTracking
Disables tracking if active, and reset all counters used in the MOTF control system. The counters are enabled for counting from this zeroed position.
Syntax
ResetTracking()
Example
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 136 of 197
Motf StartTracking
Activates MOTF compensation for all geometric shapes.
Syntax
StartTracking(TrackingMode mode)
Example
-- This sample marks a series of circles spaced at a constant distance
SetUnits(Units.Millimeters)
-- Use MOTF Port 0
MOTF.Mode = Encoder.ExternalSingleAxis
-- Web direction
MOTF.Direction = Direction.BottomToTop
-- 10um linear resolution for example
encoderLinResInMmPerCount = 0.010
-- Bits/Mm * Mm/Count -> Bits/Count
MOTF.CalFactor = System.CalFactorY *
encoderLinResInMmPerCount
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 137 of 197
Laser.Frequency = 20
Laser.DutyCycle1 = 50
Laser.Power = 50
Laser.LaserOnDelay = 75
Laser.LaserOffDelay = 125
Laser.PolyDelay = 50
Laser.VariPolyDelayFlag = true
See Also
Motf StopTrackingAndJump
Stop MOTF compensation. When this command is encountered the following actions occur: - a snapshot of the scaled hardware counter is taken and saved - Vector
compensation is disabled - a jump to a specified X, Y, Z is done
Syntax
Parameters
Example
-- This program demonstrates on-the-fly marking. Here a DataMatrix barcode is scanned.
-- The Barcode string is incremented by 1.
SetUnits(Units.Millimeters)
-- Use MOTF Port 0
MOTF.Mode = Encoder.ExternalSingleAxis
-- Web direction
MOTF.Direction = Direction.BottomToTop
-- 10um linear resolution for example
encoderLinResInMmPerCount = 0.010
-- Bits/Mm * Mm/Count -> Bits/Count
MOTF.CalFactor = System.CalFactorY *
encoderLinResInMmPerCount
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 138 of 197
--Variable initialization
serialNo = 105646
--Assign DataMatrix barcode to variable "code"
code = Barcodes.DataMatrix()
--Barcode height
code.Height = 10.0
--X coordinate
code.X = -5
--y coordinate
code.Y = -5
--Angle of the barcode
code.Angle = 0
--Matrix size is 16x16
code.MatrixSize = DataMatrixSize.S16x16
--Apply Dot hatch pattern (Options: Vertical Serpentine or horizontal or Helix filling pattern can be used)
code.HatchStyle = HatchStyle.Dot
--Sets dot duration as 100
code.DotDuration = 100
--Code format is Industry (Options: Default,Industry,macro_05,macro_06)
code.Format = DataMatrixFormat.Industry
function MarkBarcode()
--Assign serialNo variable to DataMatrix text string
barcodeText = "SN:"..serialNo
code.Text = barcodeText
--Mark DataMatrix code
Image.Barcode(code)
--Increments the Serial number by 1
serialNo = serialNo+1
--Display message "Mark Section Completed"
Report("Marked bacode: " .. barcodeText)
end
Motf TriggerOnIO
MOTF can be triggered by an external signal. This command will wait for a trigger condition to be met. It will then restart counting.
Syntax
Parameters
Example
-- This sample marks a circle on a part that is detected.
SetUnits(Units.Millimeters)
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 139 of 197
Motf WaitForCount
NOTE: This method is deprecated. Please use MOTF.WaitForDistance()
Syntax
Parameters
isAbsolute = TRUE absolute - indicates that the wait is to use absolute scaled encoder counts.
isAbsolute = FALSE relative - wait for a count relative to the position when the last StopTrackingAndJump occurred. This will be the default value.
Example
-- This sample marks a series of circles spaced at a constant distance
SetUnits(Units.Millimeters)
-- Use MOTF Port 0
MOTF.Mode = Encoder.ExternalSingleAxis
-- Web direction
MOTF.Direction = Direction.BottomToTop
-- 10um linear resolution for example
encoderLinResInMmPerCount = 0.010
-- Bits/Mm * Mm/Count -> Bits/Count
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 140 of 197
Motf WaitForCounterPort
When in DualAxis tracking, sets the MOTF port that will be used for the WaitForCount, WaitForDistance, WaitForTriggerCount, WaitForTriggerDistance commands.
Syntax
Parameters
port CounterPort Port0 for job X tracking, or Port1 for job Y tracking
Return Values
Example
-- This sample marks a series of circles spaced at a constant distance
-- using a two-axis stage
SetUnits(Units.Millimeters)
-- Use MOTF Ports 0 and 1
MOTF.Mode = Encoder.ExternalDualAxis
-- Stage direction
MOTF.Direction = Direction.DualAxisPlusDirection
-- 10um linear resolution for example
encoderLinResInMmPerCount = 0.010
-- Bits/Mm * Mm/Count -> Bits/Count
MOTF.CalFactor0 = System.CalFactorX *
encoderLinResInMmPerCount
MOTF.CalFactor1 = System.CalFactorY *
encoderLinResInMmPerCount
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 141 of 197
See Also
Motf WaitForDistance
Wait for the web to travel a distance (in user units) to reach or exceed a specific value. The distance is measured from the point where the last MOTF.ResetTracking() is
executed, or MOTF.WaitForDistance() command is executed provided that the optional flag isAbsolute is set false. If the argument isAbsolute is false, the MOTF counters are
automatically reset to zero.
Syntax
Parameters
distance float Distance of web travel since the last MOTF.ResetTracking() or MOTF.WaitForDistance()
isAbsolute bool Determines the measurement starting conditions.
isAbsolute = absolute - indicates that the wait is to use scaled encoder counts from the last MOTF.ResetTracking(). The MOTF counters continue count a measure
TRUE distance.
isAbsolute = relative - indicates that the wait is to use scaled encoder counts from the last MOTF.ResetTracking() or MOTF.WaitForDistance() where isAbsolute is
FALSE FALSE. The MOTF counters automatically reset when the distance is met or exceeded.
Example
-- This sample marks a series of circles spaced at a constant distance
SetUnits(Units.Millimeters)
-- Use MOTF Port 0
MOTF.Mode = Encoder.ExternalSingleAxis
-- Web direction
MOTF.Direction = Direction.BottomToTop
-- 10um linear resolution for example
encoderLinResInMmPerCount = 0.010
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 142 of 197
Motf WaitForTriggerCount
NOTE: This method is deprecated. Please use MOTF.WaitForTriggerDistance()
Wait for the trigger condition to be satisfied and then the count to be met or exceeded. When the wait completes, the hardware trigger is automatically reset and monitoring of
the next part in initiated.
Syntax
Parameters
Example
-- This sample marks a circle on a part that is detected.
SetUnits(Units.Millimeters)
-- Use MOTF Port 0
MOTF.Mode = Encoder.ExternalSingleAxis
-- Web direction
MOTF.Direction = Direction.BottomToTop
-- 10um linear resolution for example
encoderLinResInMmPerCount = 0.010
-- Bits/Mm * Mm/Count -> Bits/Count
MOTF.CalFactor = System.CalFactorY *
encoderLinResInMmPerCount
-- Trigger on UserIn1 when a part is detected
-- Immediately start checking for the next part
MOTF.TriggerOnIO(Pin.Din.UserIn1, Trigger.Edge.Rising, 0)
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 143 of 197
Motf WaitForTriggerDistance
Wait for the trigger condition to be satisfied and then the web motion distance from the trigger in user units to be met or exceeded. When the wait completes, the hardware
trigger is automatically reset and monitoring of the next part in initiated.
Syntax
Parameters
Example
-- This sample marks a circle on a part that is detected.
SetUnits(Units.Millimeters)
-- Use MOTF Port 0
MOTF.Mode = Encoder.ExternalSingleAxis
-- Web direction
MOTF.Direction = Direction.BottomToTop
-- 10um linear resolution for example
encoderLinResInMmPerCount = 0.010
-- Bits/Mm * Mm/Count -> Bits/Count
MOTF.CalFactor = System.CalFactorY *
encoderLinResInMmPerCount
-- Trigger on UserIn1 when a part is detected
-- Immediately start checking for the next part
MOTF.TriggerOnIO(Pin.Din.UserIn1, Trigger.Edge.Rising, 0)
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 144 of 197
Network
OpenTcpSocket Connects to a TCP client or server with the specified IP/Host name and Port.
Example
--This program will demonstrate how TCP communication takes place
Network OpenTcpSocket
Connects to a TCP server with the specified IP/Host name and Port.
Syntax
Parameters
Properties
Receive ( int bufferLength, int timeoutInMiliseconds) Receives data from the connected server
Receive ( int bufferLength, int timeoutInMiliseconds,Function errorFunction )
Send ( ByteArray databuffer) Sends data to the connected server
Send ( ByteArray databuffer, Function errorFunction )
Close Disconnect the TCP Socket connection.
Return Values
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 145 of 197
Example
--This program will demonstrate how TCP communication takes place
Shapes
The Shapes library supports the following shapes
Shape Spiral
Creates an instance of a spiral.
Syntax
spiral = Shapes.Spiral()
Properties
Angle Gets or sets the outer end angle of the spiral in current angle unit.
CenterX Gets or sets the center point X coordinate of the spiral.
CenterY Gets or sets the center point Y coordinate of the spiral.
Clockwise Gets or sets whether the spiral is clockwise or not.
Elevation Gets or sets the elevation of the spiral.
InnerRadius Gets or sets the inner radius of the spiral.
InnerRotations Gets or sets the number of inner rotations of the spiral.
OuterRadius Gets or sets the outer radius of the spiral.
OuterRotations Gets or sets the number of outer rotations of the spiral.
Outwards Gets or sets the direction of the spiral.
Pitch Gets or sets the pitch of the spiral.
ReturnToStart Gets or sets whether the marking returns back to start of the spiral.
Return Values
Example
------ This program will draw a a Spiral
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 146 of 197
Shape Hatch
Creates an instance of a Hatch shape.
Syntax
hatch = Shapes.Hatch()
Methods
Properties
Return Values
Example
--Unit is set to Millimeters
SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
myHatch = Shapes.Hatch()
myHatch.AddCircle(0,0,25)
myHatch.AddBox(-37.5,-37.5,75,75,0)
linePat = Shapes.HatchPattern.Line()
linePat.LineGap = 0.5
linePat.Angle = 45
linePat.BorderGap = 1.25
myHatch.AddHatchPattern(linePat)
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 147 of 197
Image.Hatch(myHatch)
Shape HatchPattern
Creates a Hatch pattern.
Syntax
hatchPattern = Shapes.HatchPattern.LineHatchPattern()
hatchPattern = Shapes.HatchPattern.OffsetHatchPattern()
hatchPattern = Shapes.HatchPattern.OffsetInOutHatchPattern()
hatchPattern = Shapes.HatchPattern.IncrementalHatchPattern()
hatchPattern = Shapes.HatchPattern.HelixHatchPattern()
methods
Return Values
Example
--Unit is set to Millimeters
SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
myHatch = Shapes.Hatch()
myHatch.AddCircle(0,0,25)
myHatch.AddBox(-37.5,-37.5,75,75,0)
linePat = Shapes.HatchPattern.Line()
linePat.LineGap = 0.5
linePat.Angle = 45
linePat.BorderGap = 1.25
myHatch.AddHatchPattern(linePat)
Image.Hatch(myHatch)
HatchPattern HelixHatchPattern
Creates a Helix hatch pattern
Syntax
hatchPattern = Shapes.HatchPattern.HelixHatchPattern()
Properties
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 148 of 197
HelixGap float Gets or sets the helix gap of the hatch pattern
RepeatCount Int Gets or sets individual hatch repeat count
CornerStyle CornerStyle Gets or sets corner style of the hatch pattern
Return Values
HelixHatchPattern
Example
--Unit is set to Millimeters
SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
myHatch = Shapes.Hatch()
myHatch.AddBox(-37.5,-37.5,75,75,0)
helixPat = Shapes.HatchPattern.Helix()
helixPat.HelixGap = .25
helixPat.CornerStyle = CornerStyle.SmoothWithLines
myHatch.AddHatchPattern(helixPat)
Image.Hatch(myHatch)
HatchPattern IncrementalHatchPattern
Creates an Incremental Hatch Pattern
Syntax
hatchPattern = Shapes.HatchPattern.IncrementalHatchPattern()
Properties
LineGap float Gets or sets the line gap of the hatch pattern
StartAngle float Gets or sets the start angle of the hatch pattern
IncrementAngle float Gets or sets the incrementing angle of the hatch pattern
IncrementStepCount int Gets or sets the number of steps to increment
LineHatchStyle LineHatchStyle Gets or sets the line style of the line hatch pattern
BaseX float Set an X coordinate through which at least one hatch line will pass
BaseY float Set a Y coordinate through which at least one hatch line will pass
RepeatCount int Gets or sets the individual hatch repeat count
BorderGap float Gets or sets the border gap of the hatch pattern
CornerStyle CornerStyle Gets or sets the corner style of the border offset
IncludeBorder bool Gets or sets whether to include border in the output
BorderGapDirection BorderGapDirection Gets or stes the direction of the border
Return Values
Example
--Unit is set to Millimeters
SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
myHatch = Shapes.Hatch()
myHatch.AddBox(-37.5,-37.5,75,75,0)
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 149 of 197
myHatch.AddCircle(0,0,1)
incPat = Shapes.HatchPattern.Incremental()
incPat.LineHatchStyle = LineHatchStyle .Unidirectional
incPat.LineGap = 1.25
incPat.IncrementAngle = 30
incPat.IncrementStepCount = 4
myHatch.AddHatchPattern(incPat)
Image.Hatch(myHatch)
HatchPattern LineHatchPattern
Creates a Line Hatch Pattern
Syntax
hatchPattern = Shapes.HatchPattern.LineHatchPattern()
Properties
LineGap float Gets or sets the line gap of the hatch pattern
Angle float Gets or sets the angle of the line hatch pattern
LineHatchStyle LineHatchStyle Gets or sets the line style of the line hatch pattern
BaseX float Set an X coordinate through which at least one hatch line will pass
BaseY float Set a Y coordinate through which at least one hatch line will pass
RepeatCount int Gets or sets the individual hatch repeat count
BorderGap float Gets or sets the border gap of the hatch pattern
CornerStyle CornerStyle Gets or sets the corner style of the border offset
IncludeBorder bool Gets or sets whether to include border in the output
BorderGapDirection BorderGapDirection Gets or stes the direction of the border
Return Values
LineHatchPattern
Example
----Unit is set to Millimeters
SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
myHatch = Shapes.Hatch()
myHatch.AddCircle(0,0,25)
linePat = Shapes.HatchPattern.Line()
linePat.LineGap = 3.12
linePat.Angle = 60
linePat.BorderGap = 0.15
myHatch.AddHatchPattern(linePat)
Image.Hatch(myHatch)
HatchPattern OffsetHatchPattern
Creates an Offset Hatch Pattern
Syntax
hatchPattern = Shapes.HatchPattern.OffsetHatchPattern()
Properties
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 150 of 197
OffsetGap float Gets or sets the offset gap of the hatch pattern
OffsetStyle OffsetStyle Gets or sets the offset style of the hatch pattern
RepeatCount int Gets or sets the individual hatch repeat count
CornerStyle CornerStyle Gets or sets the corner style of the border offset
Return Values
OffsetHatchPattern
Example
--Unit is set to Millimeters
SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
myHatch = Shapes.Hatch()
myHatch.AddBox(-37.5,-37.5,75,75,0)
myHatch.AddCircle(0,0,25)
offsetPat = Shapes.HatchPattern.Offset()
offsetPat.OffsetGap = 0.625
offsetPat.OffsetStyle = OffsetStyle.InToOut
offsetPat.CornerStyle = CornerStyle.SmoothWithLines
myHatch.AddHatchPattern(offsetPat)
Image.Hatch(myHatch)
HatchPattern OffsetInOutHatchPattern
Creates an Offset In Out Hatch Pattern
Syntax
hatchPattern = Shapes.HatchPattern.OffsetInOutHatchPattern()
Properties
InSideOffsetGap float Gets or sets the offset gap of the inside offsets
OutSideOffsetGap float Gets or sets the offset gap of the outside offsets
InSideOffsetCount int Gets or sets the inside offset count
OutSideOffsetCount int Gets or sets the outside offset count
RepeatCount int Gets or sets the individual hatch repeat count
CornerStyle CornerStyle Gets or sets the corner style of the border offset
Return Values
OffsetInOutHatchPattern
Example
--Unit is set to Millimeters
SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
myHatch = Shapes.Hatch()
myHatch.AddBox(-37.5,-37.5,75,75,0)
myHatch.AddCircle(0,0,1)
offsetPat = Shapes.HatchPattern.OffsetInOut()
offsetPat.InSideOffsetCount = 3
offsetPat.InSideOffsetGap = 0.625
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 151 of 197
myHatch.AddHatchPattern(offsetPat)
Image.Hatch(myHatch)
Smd
SMD commands work jointly with the ScanMaster™ Designer application. Using these methods you can create input and message boxes as well as clear the output window
in ScanMaster™ Designer.
Smd ClearOutputWindow
Clears the ScanMaster™ Designer output window.
Syntax
Smd.ClearOutputWindow()
Example
--This program will display the 3 messages in outputwindow, then it clears the output window. After 2 seconds displaying the Cleared the Output window message.
--Displays message
Report("Cleared the Output window")
Smd CreateInputBox
Creates an InputBox.
Syntax
inbox = Smd.CreateInputBox()
Methods
Return Values
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 152 of 197
Example
--This program will scan the name and the index number that the user entered. The message box will be displayed after the Scan All function
--Horizontal Text
myText = Text.Horizontal()
myText.Elevation = 0
myText.Height = 12.5
myText.Font = "Arial"
myText.Angle = 0
for i = 1, 10 do
--Pops the Input Box through ScanMaster™ Designer and waits until the user enters values
inBox.ReadInputs()
--Get the input from the user
x1, x2 = inBox.GetInputs()
myText.X = 0
myText.Y = 0
--Enter text name
myText.Text = x1
Image.Text(myText)
myText.Y = -0.2
--Enter Index Number
myText.Text = x2
Image.Text(myText)
System.Flush()
Sleep(1000)
i = i+1
end
--Message box to be displayed after marking
Smd.MessageBox("Marking Finished", "Output", Smd.MessageBoxButton.OK, Smd.MessageBoxIcon.Information)
Smd MessageBox
Displays a message box on ScanMaster™ Designer.
Syntax
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 153 of 197
Parameters
Error
Information
Question
Warning
OK
OKCancel
AbortRetryIgnore
YesNoCancel
YesNo
RetryCancel
Return Values
Example
--This example will demonstrate the CreateMessageBox method
else
end
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 154 of 197
Stopwatch
Implements a stop watch that can be used to record lapse of time.
Stopwatch measures the time intervals within the script only, and therefore cannot accurately measure the time spent by the laser during operations . If you want to measure
the time for marking use Laser.Timer.
Example
--This program will scan an Arc text 10 times and it will display the time it takes to scan it each time.
Stopwatch Pause
Pauses the recording. To resume recording call the Stopwatch.Resume() function.
Note: If you wish to restart, call Stopwatch.Start() function. In a typical marking scenario the Script would finish executing its commands before the laser could finish
marking. In order to approximate the Script execution with the actual marking you may use the Laser.WaitForEnd() command.
Syntax
Pause()
Example
--This program will scan an Arc text 10 times and it will display the time it takes to scan them each time.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 155 of 197
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
Laser.PolyDelay = 50
Stopwatch.Start()
--While loop start. loop run 10 times
while count<10 do
--Pause the timer
Stopwatch.Pause()
--Wait for user input
Io.WaitForIo(Pin.Din.UserIn1, Trigger.Edge.Falling, 10000000, 100)
--Resume the stopwatch
Stopwatch.Resume()
Image.Text(arcText)
Laser.WaitForEnd()
--Increments the Count by 1
count = count + 1
--Loop end
end
Stopwatch Resume
Resumes recording which has been paused.
Syntax
Resume()
Example
--This program will scan an Arc text 10 times and it will display the time it takes to scan them each time.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 156 of 197
Stopwatch.Start()
--While loop start. loop run 10 times
while count<10 do
--Pause the timer
Stopwatch.Pause()
--Wait for user input
Io.WaitForIo(Pin.Din.UserIn1, Trigger.Edge.Falling, 10000000, 100)
--Resume the stopwatch
Stopwatch.Resume()
Image.Text(arcText)
Laser.WaitForEnd()
--Increments the Count by 1
count = count + 1
--Loop end
end
Stopwatch Start
Starts the stopwatch. This will start recording the time.
Syntax
Start()
Example
--This program will scan an Arc text 10 times and it will display the time it takes to scan them each time.
Stopwatch.Start()
--While loop start. loop run 10 times
while count<10 do
--Pause the timer
Stopwatch.Pause()
--Wait for user input
Io.WaitForIo(Pin.Din.UserIn1, Trigger.Edge.Falling, 10000000, 100)
--Resume the stopwatch
Stopwatch.Resume()
Image.Text(arcText)
Laser.WaitForEnd()
--Increments the Count by 1
count = count + 1
--Loop end
end
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 157 of 197
Stopwatch Time
Returns the elapsed time in milliseconds.
Syntax
Time()
Example
--This program will scan an Arc text 10 times and it will display the time it takes to scan it each time.
String
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 158 of 197
Example
--This program will display the characters that the user specifies.
String CharacterAt
Gets the character specified by the index.
Syntax
Parameters
Return Values
Returns a character.
Example
--This program will display the characters that the user specifies.
String Concat
Concatenates two specified Strings. You can also use the concatenate operator ".." to concatenate strings.
Syntax
Parameters
Return Values
Example
------- This program will describe the String.Concat method.The program will concatenate two strings and mark as arc text.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 159 of 197
Image.Text(arcText)
Image.RealTimeTransformEnabled(true)
--Translates arc text
Image.TranslateRealtime(1, 1)
--Concatenates the above two strings using a different method
arcText.Text = str1..str2
Image.Text(arcText)
String EndsWith
Determines whether the end of this string instance matches the specified String.
Syntax
Parameters
Return Values
Example
--This program will demonstrate the EndsWith method. The program will check the end character of the specified string and report the results.
else
--Display this message if the last character is not "t"
Report("test failed")
end
String Format
Create a formatted string from the format and arguments provided. At run time, each format item is replaced with the string representation of the corresponding arguments.
Syntax
Parameters
%[Flags][Width].[Precision]Specifier
Flags
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 160 of 197
# Used with e, E and f, it forces the written output to contain a decimal point even if no digits would follow. By default, if no digits follow, no decimal point is written.
Used with g or G the result is the same as with e or E but trailing zeros are not removed.
Width
Minimum number of characters to be printed. If the value to be printed is shorter than this number, the result is padded with blank spaces. The value is not truncated
(number)
even if the result is larger.
* The width is not specified in the format string, but as an additional integer value argument preceding the argument that has to be formatted.
Precision
For integer specifiers (d, i, o, u, x, X): precision specifies the minimum number of digits to be written. If the value to be written is shorter than this number, the result
is padded with leading zeros. The value is not truncated even if the result is longer.
For e, E and f specifiers: this is the number of digits to be printed after the decimal point.
.number
For g and G specifiers: This is the maximum number of significant digits to be printed.
For s: this is the maximum number of characters to be printed. By default all characters are printed until the ending null character is encountered.
For c type: it has no effect. When no precision is specified, the default is 1. If the period is specified without an explicit value for precision, 0 is assumed.
.* The precision is not specified in the format string, but as an additional integer value argument preceding the argument that has to be formatted.
Specifier
The specifier is the most significant and defines the type and interpretation of the value of the corresponding argument.
Note: '$' indicates a space. This will not be reflected in the actual output, it is only used for explanatory purposes.
Example
--This program will demonstrate the String.Format method.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 161 of 197
String GetBytes
Converts a string to a byte array
Syntax
Parameters
Return Values
Example SMC
--This program will demonstrate the GetBytes method.
file1.Close()
f1 = File.OpenBinaryFile(location.."/myfile", FileMode.Read)
-- Read the whole file and return as byte array
readFile = f1.ReadToEnd()
--Display the file size
Report(f1.Length())
--Display the contents of the file
Report(readFile.GetString())
Example EC1000
--This program will demonstrate the GetBytes method.
file1.Close()
f1 = File.OpenBinaryFile(location.."\\myfile", FileMode.Read)
-- Read the whole file and return as byte array
readFile = f1.ReadToEnd()
--Display the file size
Report(f1.Length())
--Display the contents of the file
Report(readFile.GetString())
String IndexOf
Gets the index of a substring.
Syntax
Parameters
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 162 of 197
Return Values
Returns the starting position of the substring in the str string, as an integer.
Example SMC
--This program will demonstrate the Indexof method.
Example EC1000
--This program will demonstrate the Indexof method.
String LastIndexOf
Gets the last index of a substring.
Syntax
Parameters
Return Values
Returns the last index of the substring in the str string, as an integer.
Example SMC
--This program will demonstrate the LastIndexOf method.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 163 of 197
Example EC1000
--This program will demonstrate the LastIndexOf method.
String Length
Gets the length of the specified String.
Syntax
Parameters
Return Values
Example
--This program will demonstrate the String.Length method.
String Replace
Finds a specified substring and replaces it with a given String.
Syntax
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 164 of 197
Parameters
Return Values
Example
--This program will demonstrate the String.Replace method.
String Split
Splits the String with a given delimiter.
Syntax
Parameters
Return Values
Example
--This Program will demonstrate the String.Split method.
for i = 1, strArray.Length() do
--Display the string
Report(strArray[i])
end
String StartsWith
Determines whether the beginning of the String matches the specified String.
Syntax
Parameters
Return Values
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 165 of 197
Example
--This Program will demonstrate the String StratsWith operation.
String Substring
Gets the substring from the specified String. The substring starts at a specified character position and has a specified length.
Syntax
Parameters
Return Values
extracted substring
Example
--This Program will demonstrate the Substring operation.
String ToHexString
Returns the Hexadecimal representation of the Integer that was passed as the argument.
Syntax
Parameters
Return Values
Example
--This program demonstrates a value that will be left shifted by 3 bytes each time it runs through the loop and displays the Hexadecimal representation of "i"
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 166 of 197
String ToLower
Converts the given String to Lowercase.
Syntax
Parameters
Return Values
A string in lowercase.
Example
--This program will demonstrate the ToLower method.
String ToUpper
Converts the given String to Uppercase.
Syntax
Parameters
Return Values
A string in Uppercase.
Example
--This program will demonstrate the ToUpper method.
String Trim
Removes white spaces at the beginning and the end of the string.
Syntax
Parameters
Return Values
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 167 of 197
Example
--This program will display the Trim method in String
--Remove the white space at the beginning and the end of the string " ScanMaster ScanScript " and assign it to "str" variable
str = String.Trim(" ScanMaster ScanScript ")
--Display the Size of the string
Report(String.Length(str))
String TrimLeft
Removes white spaces on the left hand side of the String.
Syntax
Parameters
Return Values
Example
--This program will display the TrimLeft operation in String
--Remove the starting white space of the string " ScanMaster ScanScript" and assign it to "str" variable
str = String.TrimLeft(" ScanMaster ScanScript")
--Display the Size of the string
Report(String.Length(str))
--Display the size of the string " ScanMaster ScanScript" without removing left the white spaces
Report(string.Length(" ScanMaster ScanScript"))
String TrimRight
Removes white spaces on the right hand side of the String.
Syntax
Parameters
Return Values
Example
--This program will display the TrimRight operation in string
--Remove the white spaces at the end of the "ScanMaster ScanScript " string and assign it to the "str" variable
str = String.TrimRight("ScanMaster ScanScript ")
--Display the Size of the string
Report(String.Length(str))
--Display the size of "ScanMaster ScanScript " string without removing the right white spaces
Report(string.Length("ScanMaster ScanScript "))
System
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 168 of 197
Properties
Methods
Example
--This example will demonstrate the Flush command. It will receive the text for the DataMatrix barcode from serial communication.
Laser.MarkDelay = 200
comPort = Io.OpenComPort("com1:")
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 169 of 197
function Marking(data)
--comPort read data is used as DataMatrix barcode text
var.Text = "Serial"..data
Image.Barcode(var)
Report("Part marking Finished")
end
while true do
--Input coming from PLC
readData = comPort.Read(10, 10000)
Marking(readData)
--Check the device type
if System.DeviceType() == "EC1000" then
--Starts marking the buffered instructions
System.Flush()
else
--If the scan card is not an EC1000, wait here for the marking to complete
Laser.WaitForEnd()
end
end
System Abort
Aborts the marking job. If the terminateScript parameter is set to TRUE, it will abort the current marking job and terminates the script. If set to FALSE, the script will
continue to execute aborting only the active job.
Note: This method is currently supported with the SMC cards only
Syntax
System.Abort([bool terminateScript])
Parameters
terminateScript bool If TRUE abort the marking job and script, FALSE abort only the marking job. Optional , Default FALSE
Example
---- This program will demonstrate the System.Abort methods
if (i == 25) then
--Abort the current active and queued scanning operations when this command is executed.
--It will continue to execute the remaining script for i = 2.5 and i = 3.
System.Abort()
end
System.Flush()
Sleep (500)
end
System CalFactor
Returns the calibration factor for the specified axis as a float.
Syntax
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 170 of 197
System.CalFactorX
System.CalFactorY
System.CalFactorZ
Example
--------------- This program will show the current calibration factors.
System CalibrateJumpTime
Performs the jump time calibration for open loop via hole drilling
Syntax
Parameters
HeadToCalibrate int Head/Axis to Calibrate bit pattern N/A|N/A|N/A|N/A|Head2 Y-Axis|Head2 X-Axis|Head1 Y-Axis|Head1 X-Axis
fieldSize int field size(in user units)
pitchSize int pitch size(in User Units)
logToFile bool If set to TRUE Save jump time cal data to file
calJumpTimeAvgMode CalJumpTimeAvgMode jump time averaging mode
Example
System ClearingMove
Calculates and executes a galvo clearing move.
Syntax
ClearingMove(int Axis, float accel, float accelRatio, float startPos, float endPos)
Parameters
Example
System DeviceType
Returns the device type name.
Syntax
System.DeviceType()
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 171 of 197
Example
-----------This program will display the Device type
System DisableZCompensation
Disables the calculation which is required to change the size of the marking object geometry when the focal length of the laser beam is changed according to the elevation
defined from the marking surface.
Syntax
DisableZCompensation()
Example
--Draws a rectangle in Z = -3
Image.Box(0, 0, 25, 50, 0, -3)
System DisableCmdDataBuffering
Enables or Disables the use of command data output FIFO buffering.
Syntax
DisableCmdDataBuffering(bool disable)
Parameters
disable bool true: Disables FIFO buffering, false: Enables FIFO buffering (default for Scanpack)
Example
System DisableDryRunMode
Disables the dry run mode
Syntax
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 172 of 197
System.DisableDryRunMode( )
Example
System DisableHeadTransforms
Disables the head transform logic for both heads.
Syntax
System.DisableHeadTransforms( )
Example
System DisableSettleChecking
Disables the settle checking mode
Syntax
DisableSettleChecking()
Example
-- This program will describe Z axis compensation
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
--Draws a rectangle in Z = -3
Image.Box(0, 0, 1, 2, 0, -3)
System EnableZCompensation
Enables the calculation which is required to change the size of the marking object geometry when the focal length of the laser beam is changed according to the elevation
defined from the marking surface.
Syntax
EnableZCompensation()
Example
This program will describe Z axis compensation
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 173 of 197
Laser.JumpDelay = 150
Laser.MarkDelay = 200
Draws a rectangle in Z = -3
Image.Box(0, 0, 25, 50, 0, -3)
System EnableDryRunMode
Set the scanning mode to dry run mode.
Syntax
EnableDryRunMode(LaserVariable dryRunLaserProfile)
EnableDryRunMode(LaserVariable dryRunLaserProfile, DryRunMode dryrunMode)
Parameters
Example
System EnableSettleChecking
Enables the settle-checking behavior and sets the parameters for the JumpAndFireList and JumpAndDrillList commands. Used to validate the position of the galvos after a
move is made and before the laser is fired.
Syntax
EnableSettleChecking(SettleCheckMode settleCheckMode,SettleCheckPort settleCheckPort, int settleCheckMask, int settleCheckValue, int settleCheckTimeout, int
settleCheckDelay)
Parameters
Example
System EnableJumpAsLink
Enable or Disable special acceleration limited jump profiles for High speed marking applications.
When enabled, any jump that has a non-zero jump delay will be replaced with an acceleration limited motion profile where the starting velocity is the same as the preceding
vector’s speed (provided that the delay associated with that vector is set to zero), and the end velocity is the same as the vector that is the target of the jump. The next vector
can be a Mark (typical case) or a Jump which will occur if analog skywriting (not ScanPack) is enabled.
Syntax
EnableJumpAsLink(bool status)
Parameters
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 174 of 197
The MarkDelay should be set to zero when using JumpAsLink so that there is a smooth transition from the end of the Mark to the beginning of the link. Otherwise the
MarkDelay will cause a discontinuity in the motion profile.
Note that because the exit velocity of the link is the same as the specified velocity of the joining vector the galvos will be trailing behind by the servo tracking delay. Hence,
the LaserOn and Off delay times should be set to the tracking delay. Alternatively, the laser pipeline delay can be set to the tracking delay and the On/Off delay values set to
zero.
Example
-- Set the units as mm
SetUnits(Units.Millimeters)
-- The following settings are used for any shapes that are created using ScanScript
-- Shapes that are created using the SMD canvas have separate laser properties.
--
-----------------Laser Delay control Settings-------------------
--
-- Delay in time before the laser is turned on/off. When using JumpAsLink
-- the galvos will always be in motion and will be trailing the command
-- by the servo tracking delay which will vary based on the system configuration.
-- We set these values to the tracking delay as a starting point. These numbers
-- may need to be adjusted for best marking quality and to account for the actual
-- laser turn on/off time and servo tracking delay.
Laser.LaserOnDelay = 85 -- usec
Laser.LaserOffDelay = 85 -- usec
Laser.LaserPipeLineDelay = 0 -- usec
-- Set the marking speed
Laser.MarkSpeed = 5000 -- mm/sec
-- We set the mark delay to zero because we want the galvos to be in motion when
-- we transition to the JumpAsLink trajectory. A non-zero mark delay will cause
-- the commands to the galvos to stop for that duration causing motion discontinuities
-- and inconsistent marking results.
Laser.MarkDelay = 0 -- usec
-- This is the target speed for the jump, but the actual speed is governed by the
-- ScanPack Vector Params Link Rate parameter. Use the Device Config Editor to change it.
Laser.JumpSpeed = 10000 -- mm/sec
-- The Jump Delay is only used to trigger the use of JumpAsLink instead of a normal
-- Traditional mode jump. If it is zero, then a traditional mode jump is executed.
-- Otherwise a JumpAsLink profile will be used for the jumps
Laser.JumpDelay = 200 -- usec
-- Sets the laser modulation and power characteristics. Depends on the laser being used.
Laser.Power = 75
Laser.Frequency = 50 -- KHz
Laser.DutyCycle1 = 50 -- %
Laser.DutyCycle2 = 50 -- %
Laser.PolyDelay = 50 -- usec
Laser.VariPolyDelayFlag = false
myHatch = Shapes.Hatch()
myHatch.AddBox(-10, -10, 20, 20, 0)
myHatch.MarkingOrder = MarkingOrder.HatchOnly
linePat = Shapes.HatchPattern.Line()
linePat.LineGap = 0.5
linePat.Angle = 0
linePat.BorderGap = 0.0
linePat.LineHatchStyle = LineHatchStyle.Serpentine
myHatch.AddHatchPattern(linePat)
-- Turn on JumpAsLink
System.EnableJumpAsLink(true)
--
System.SetGalvoCmdMarker() -- Used to trigger data collection for L-II systems
Image.Hatch(myHatch)
System Flush
Flushes currently buffered commands in the device.
Syntax
System.Flush()
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 175 of 197
Example
----This example will demonstrate the Flush command. It will receive the text for the DataMatrix barcode from serial communication.
Laser.MarkDelay = 200
comPort = Io.OpenComPort("com1:")
function Marking(data)
--comPort read data is used as DataMatrix barcode text
var.Text = "Serial"..data
Image.Barcode(var)
Report("Part marking Finished")
end
while true do
--Input coming from PLC
readData = comPort.Read(10, 10000)
Marking(readData)
--Starts marking the buffered instructions
System.Flush()
end
System FriendlyName
Returns the "friendly name" of the controller as a string. The "friendly name" is a name assigned in the Admin Configuration file of the SMC or EC1000. It can be used to
identify the controller that the script is running on.
Syntax
System.FriendlyName
Example
------This program will show the script version and device type.
Laser.MarkDelay = 200
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 176 of 197
System GSBusDisable
This method enables or disables active GSBus command channels driven by the SMC. It is used to "disconnect" the SMC from the GSBus so that TuneMaster-II can be used
to examine and adjust tuning parameters on a connected Lightning-II scanner system. If the argument is set to TRUE, SMC will electrically "disconnect" from GSBus. If the
argument is FALSE, it will reconnect SMC to the GSBus command channels.
Syntax
System.GSBusDisable(bool disabledState)
Parameters
Example
-- This program will demonstrate the System.GSBusDisable method
System.GSBusDisable(true)
Report("GSBus disconnected")
System.GSBusDisable(false)
Report("GSBus re-connected")
System IsStandAlone
Returns whether the job is running on stand alone mode.
Syntax
System.IsStandAlone()
Return Values
Example
--This program will mark only when the system is running on Standalone mode
--Load the "barcode.lsj" file from the card and assign it to the variable "preload"
preload=Io.PreloadJob(location.."barcode.lsj")
if System.IsStandAlone() then
preload.Execute()
else
--Message pop up
end
System MarkingMode
Returns the marking mode of the card as a string.
Syntax
System.MarkingMode
Return Values
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 177 of 197
Note:The EC1000 use the "Traditional" micro-stepping marking mode only . The SMC supports both "Traditional" and trajectory-planned "Scanpack" marking modes.
Example
--This program will print the marking mode of the selected card
Report(System.MarkingMode)
System Path
File System Functions
Syntax
System.Path.LocalJobs /mnt/SMC/Jobs/
System.Path.USBJobs /USBFlash/Jobs/
System.Path.LocalData /mnt/SMC/Data/
System.Path.LocalConfig /mnt/SMC/Config/
System.Path.LocalLog /mnt/SMC/Log/
System.Path.Temp /var/volatile/tmp/
Return Values
Example
--This program will demonstrate the methods text File read-write operation
--System.Path.LocalJobs = "/mnt/SMC/Jobs/
--System.Path.LocalData = "/mnt/SMC/Data/
--System.Path.LocalConfig = "/mnt/SMC/Config/
--System.Path.LocalLog = "/mnt/SMC/Log/
txtFile = File.OpenTextFile(System.Path.LocalJobs,"txtFile.txt", FileMode.Write, Encoding.UTF8)
--Creates string array of size 3
str = Array.StringArray(3)
--First Array string
str[1] = "ScanMaster"
--Second array string
str[2] = "ScanScript"
--Third array string
str[3] = "Cambridge Technology"
for i = 1, str.Length() do
--Writes a string to a file
txtFile.WriteLine(str[i])
i = i+1
end
--Close the write file
txtFile.Close()
--Opens a text file named "readFile" in read-only mode
readFile = File.OpenTextFile(System.Path.LocalJobs,"txtFile.txt", FileMode.Read, Encoding.UTF8)
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 178 of 197
end
System ReceiveCommand
Waits until the given command is received from the ScanMaster™ API and returns the relevant arguments.
Syntax
Parameters
Note: The following sample is a custom program using SM API and cannot use in SMD
Example
---- This program will demonstrate the System.ReceiveCommand method
myText.X = 0
myText.Y = 0
myText.Elevation = 0
myText.Height = 2.5
myText.Font = "Arial"
myText.Angle = 0
function MarkText(text)
myText.Text = text
Image.Text(myText)
end
function OnReceiveText(text)
MarkText(text)
end
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 179 of 197
--This command does not blocks the execution and need to set a call back method to execute when result is available
--Once the "GetNextText" command is received from ScanMaster™ API event handler is called with the argument
System.ReceiveCommandAsync("GetNextText", "OnReceiveText" )
System.Flush()
Sleep(200)
end
System ReceiveCommandAsync
Registers the specified event handler for the given command. Once the command is received from ScanMaster™ API the event handler is called along with the arguments.
Syntax
Parameters
Note: The following sample is a custom program using SM API and cannot use in SMD
Example
------ This program will demonstrate the System.ReceiveCommand method
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
myText.X = 0
myText.Y = 0
myText.Elevation = 0
myText.Height = 2.5
myText.Font = "Arial"
myText.Angle = 0
function MarkText(text)
myText.Text = text
Image.Text(myText)
end
function OnReceiveText(text)
MarkText(text)
end
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 180 of 197
--This command does not blocks the execution and need to set a call back method to execute when result is available
--Once the "GetNextText" command is received from ScanMaster™ API event handler is called with the argument
System.ReceiveCommandAsync("GetNextText", "OnReceiveText" )
-- Wait for the script to start running, i.e. BeginJob event is processed
Laser.WaitForEnd()
for i = 1, 1000 do
Laser.WaitForEnd()
end
System ResetHeadTransform
Resets the transform to unity for the selected head.
Syntax
System.ResetHeadTransform(int HeadNum )
Parameters
Example
System Reboot
Reboots the Controller. Rebooting may take up to 30 seconds to complete.
Syntax
Reboot()
Example
--InterlockHandler function
function InterlockHandler(interlockName)
error("Abort Operation")
Reboot()
end
System ScriptingVersion
Returns the version of the script engine.
Syntax
ScriptingVersion()
Example
----This program will show the script version and device type.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 181 of 197
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
System SendCommand
Sends the command and the arguments to ScanMaster™ API.
Syntax
Parameters
Note: The following sample is a custom program using SM API and cannot use in SMD
Example
---- This program will demonstrate the System.SendCommand method
Units(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
myText.X = 0
myText.Y = 0
myText.Elevation = 0
myText.Height = 2.5
myText.Font = "Arial"
myText.Angle = 0
function MarkText(text)
myText.Text = text
Image.Text(myText)
end
function OnReceiveText(text)
MarkText(text)
end
--This command does not block the execution and need to set a call back method to execute when result is available
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 182 of 197
--Once the "GetNextText" command is received from ScanMaster™ API event handler is called with the argument
System.ReceiveCommandAsync("GetNextText", "OnReceiveText" )
System.Flush()
Sleep(200)
end
System SetActiveCorrectionTable
The EC1000 and SMC supports up to four independent 3-axis correction tables which may be configured such that one pair of tables could be used when the actual laser
processing takes place, and the second pair could be used with a pointer laser. The job parameter ActiveCorrectionTable could be used to dynamically specify the table which
is used for each task.
Syntax
Parameters
Values
Example
------------------- System SetActiveCorrectionTable ------------------------
System SetGalvoCmdMarker
Inserts a marker into the galvo command stream that permits hardware triggering of the Lightning-II probe system.
Syntax
System.SetGalvoCmdMarker()
Example
System SetHeadOffset
Sets the head offsets for the selected head.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 183 of 197
Syntax
Parameters
Example
System SetHeadRotation
Sets the angular field rotation for the selected head.
Syntax
Parameters
Example
System SetHeadScale
Sets the axis scale for the selected head.
Syntax
Parameters
Example
System SetHeadTransform
Sets an arbitrary 2D linear transform matrix for the head.
Syntax
System.SetHeadScale(int HeadNum, float M00, float M01, float M10, float M11 )
Parameters
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 184 of 197
M01 float 2x2 matrix coefficient M01. Must be greater than -2.0 and less than +2.0
M10 float 2x2 matrix coefficient M10. Must be greater than -2.0 and less than +2.0
M11 float 2x2 matrix coefficient M11. Must be greater than -2.0 and less than +2.0
Example
System SetIPGateway
Sets the IP address of the Gateway.
Syntax
System.SetIPGateway(string gatewayIPAddress)
System.SetIPGateway(string gatewayIPAddress, bool append)
Parameters
Example
System SetSystemDateTime
Set the given date and time as current date time of the system.
Syntax
Parameters
Example
-- This program will demonstrate the SetSystemDateTime method.
--create a date time object with the current date time settings
dateTime = DateTime()
--Set the system current date and time
System.SetSystemDateTime(dateTime)
System SyncWithHostTime
Sync the current date time with the system.
Syntax
System.SyncWithHostTime()
Example
-- This program will demonstrate the SyncWithHostTime method.
-- Sync the current date and time with the system
System.SyncWithHostTime()
Serial Number
Serial Number Library supports various serial number marking types such as Date codes, time codes, number sequences etc.…
To create a serial number, first create a Serial number object using the create method and build the desired serial text components using the methods provided.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 185 of 197
Example
snvar = SerialNumber.Create();
snvar.Add(SerialNumber.NewLine())
snvar.Add(textSerialNo);
snvar.Add(ns)
snvar.Add(SerialNumber.NewLine())
for i=0,5 do
local str = snvar.Text()
Report(str)
snvar.CreateNextState();
Sleep(500)
end
Syntax
Parameters
Properties
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 186 of 197
Return Values
Example
snText = Text.Horizontal()
snText.X = -2
snText.Height= 1
snText.Font = "Arial"
snText.Angle = 0
preText = Text.Horizontal()
preText.X = -6
preText.Height= 1
preText.Font = "Arial"
preText.Angle = 0
preText.Text = "SN:"
snvar = SerialNumber.Create();
textPrefix = SerialNumber.FixedLengthText("ABC");
snvar.Add(textPrefix)
dateCode = SerialNumber.DateCode();
dateCode.CodeFormat="[YY][MM][DD]"
snvar.Add(dateCode)
textH = SerialNumber.FixedLengthText("-");
snvar.Add(textH)
ns = SerialNumber.NumberSequence(1,1,1000,4)
ns.CurrentValue = 5
snvar.Add(ns)
for i=0,10 do
local str = snvar.Text()
Report(str)
snText.Text = str
Image.Text( preText)
Image.Text( snText)
snvar.CreateNextState();
end
Syntax
Parameters
Methods
AdjustYear(yearIncrement) Increments the year part of the date code by the amount specified by "yearIncrement"
AdjustMonth(monthIncrement) Increments the month part of the date code by the amount specified by "monthIncrement"
AdjustWeek(weekIncrement) Increments the week part of the date code by the amount specified by "weekIncrement"
AdjustDay(dayIncrement) Increments the day part of the date code by the amount specified by "dayIncrement"
Properties
Codeformat Specifies the Format of the date object. The available formats are
Codeformats
[DD] - Returns the day of the month as a two digit number {01 to 31}
[DDDD] - Long weekday name Eg: Sunday, Monday etc
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 187 of 197
Example
myText = Text.Horizontal()
myText.X = -10
myText.Y = 0
myText.Height = 1
myText.Font = "Arial"
myText.Angle = 0
snDateVar = SerialNumber.Create();
dateCode1 = SerialNumber.DateCode();
dateCode1.CodeFormat="[DD]:[MM]:[YYYY]"
textDateFmt1= SerialNumber.FixedLengthText("Format (DD:MM:YYYY) : ");
dateCode2 = SerialNumber.DateCode();
dateCode2.CodeFormat="[DDDD]:[MMMM]:[YYYY]"
textDateFmt2= SerialNumber.FixedLengthText("Format (DDDD:MMMM:YYYY) : ");
snDateVar.Add(textDateFmt1)
snDateVar.Add(dateCode1)
snDateVar.Add(SerialNumber.NewLine())
snDateVar.Add(textDateFmt2)
snDateVar.Add(dateCode2)
strDateCode = snDateVar.Text()
Report(strDateCode)
myText.Text = strDateCode
Image.Text(myText)
Syntax
Parameters
Methods
AdjustHour(hourIncrement) Increments the hour part of the time code by the amount specified by "hourIncrement"
AdjustMinute(minuteIncrement) Increments the minute part of the time code by the amount specified by "minuteIncrement"
AdjustSecond(secondIncrement) Increments the second part of the time code by the amount specified by "secondIncrement"
Properties
Codeformat Specifies the Format of the time object. The available formats are
Codeformat
Example
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 188 of 197
tText = Text.Horizontal()
tText.X = 5
tText.Y = 3
tText.Height=1
tText.Font = "Arial"
tText.Angle = 0
sntimevar = SerialNumber.Create();
timeCode1 = SerialNumber.TimeCode();
timeCode1.CodeFormat="[hh]:[mm]:[ss]"
textfmt1= SerialNumber.FixedLengthText("Format (hh:mm:ss) : ");
timeCode2 = SerialNumber.TimeCode();
timeCode2.CodeFormat="[HH]:[mm]:[ss] [tt]"
textfmt2= SerialNumber.FixedLengthText("Format (HH:mm:ss:tt) : ");
sntimevar.Add(textfmt1)
sntimevar.Add(timeCode1)
sntimevar.Add(SerialNumber.NewLine())
sntimevar.Add(textfmt2)
sntimevar.Add(timeCode2)
local strTimeCode = snTimevar.Text()
Report(strTimeCode)
tText.Text = strTimeCode
Image.Text(tText)
-- Adjust hour
taText = Text.Horizontal()
taText.X = 5
taText.Y = -3
taText.Height = 1
taText.Font = "Arial"
taText.Angle = 0
snTimeAdjVar = SerialNumber.Create();
timeAdjCode = SerialNumber.TimeCode();
timeAdjCode.CodeFormat="[HH]:[mm]:[ss] [tt]"
timeAdjCode.AdjustHour(2)
snTimeAdjVar.Add(timeAdjCode);
strTimeCode = snTimeAdjVar.Text()
Report(strTimeCode)
taText.Text = strTimeCode
Image.Text(taText)
Syntax
textObject = SerialNumber.FixedLengthTtext([textString])
Parameters
Properties
Return Values
Example
myText = Text.Horizontal()
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 189 of 197
myText.X = -10
myText.Y = 0
myText.Height = 1
myText.Font = "Arial"
myText.Angle = 0
flvar = SerialNumber.Create();
fltext= SerialNumber.FixedLengthText("This is fixed length text ");
flvar.Add(fltext)
Report(flvar.Text())
myText.Text = flvar.Text()
Image.Text(myText)
Syntax
userNameObject = SerialNumber.UserName([userName])
Parameters
userName string Set the user name. If this parameter is not specified the user name is automatically selected from the SMD settings.
Example
myText = Text.Horizontal()
myText.X = 0
myText.Height= 2
myText.Font = "Arial"
myText.Angle = 0
serialString = snvar.Text()
Syntax
newLine = SerialNumber.newline()
Example
myText = Text.Horizontal()
myText.X = 0
myText.Height= 2
myText.Font = "Arial"
myText.Angle = 0
nlvar = SerialNumber.Create();
ns1 = SerialNumber.NumberSequence(1,1,1000,4)
ns2 = SerialNumber.NumberSequence(100,1,1000,4)
nlvar.Add(ns1)
nlvar.Add(SerialNumber.NewLine())
nlvar.Add(ns2)
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 190 of 197
for i=0,10 do
local str = nlvar.Text()
Report(str)
myText.Text = str
Image.Text( myText)
nlvar.CreateNextState();
end
Syntax
Example
snText = Text.Horizontal()
snText.X = -2
snText.Height= 1
snText.Font = "Arial"
snText.Angle = 0
var = SerialNumber.Create()
sn = SerialNumber.NumberSequence();
sn.StartValue = 0;
sn.Increment = 1
var.Add(sn)
SerialNumber.Settings.FileNamePrefix = "sn_job"
local sucess = SerialNumber.LoadState(var)
snText.Text = var.Text()
Image.Text( snText)
else
Report("loading failed")
end
Syntax
SerialNumber.Settings.FileNamePrefix = [Prefix]
Specifies an expiry time for the saved state in days. If the state is saved before the specified time then the state will be ignored.
SerialNumber.SaveState(var)
The current state of the serial number will be saved to a file in the SMC card. The name of the file will be created appending the prefix
(SerialNumber.Settings.FileNamePrefix) to the name of the variable.
Example
snText = Text.Horizontal()
snText.X = -2
snText.Height= 1
snText.Font = "Arial"
snText.Angle = 0
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 191 of 197
var = SerialNumber.Create()
sn = SerialNumber.NumberSequence();
sn.StartValue = 10;
sn.Increment = 1
var.Add(sn)
SerialNumber.Settings.FileNamePrefix = "sn_job"
SerialNumber.Settings.ExpiryTime = 2
for i=0,10 do
Report(var.Text())
snText.Text = var.Text()
Image.Text( snText)
var.CreateNextState()
SerialNumber.SaveState(var)
end
Syntax
Example
snText = Text.Horizontal()
snText.X = -2
snText.Height= 1
snText.Font = "Arial"
snText.Angle = 0
var = SerialNumber.Create()
sn = SerialNumber.NumberSequence();
sn.StartValue = 0;
sn.Increment = 1
var.Add(sn)
SerialNumber.Settings.FileNamePrefix = "sn_job"
SerialNumber.RemoveState(var)
snText.Text = var.Text()
Image.Text( snText)
else
Report("loading failed")
end
Text
Implements Text handling functions for horizontal and arc text
Example
--This program will scan the text "Scan Master Script".
myText = Text.Horizontal()
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 192 of 197
myText.X = -2
myText.Y = 0
-- Z axis elevation of the text
myText.Elevation = 0
myText.Height = 0.1
myText.Font = "Arial"
--Assign "ScanMaster ScanScript" string to text variable
myText.Text = "ScanMaster ScanScript"
myText.Angle = 0
Image.Text(myText)
Embedding Fonts
You need to embed fonts which are not available in the Scanning Card. This is possible through Text Options in Project Settings.
5. Select Embed Format from the right pane and click OK.
Character Gap
B- Character width
When you apply a character gap, it will be inserted between C and A. In the following image the character gap is illustrated by X:
Text Arc
Creates and returns an arc text object.
The following illustrations demonstrate many ways in which ArcText can be aligned:
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 193 of 197
Syntax
arcText = Text.Arc()
Properties
Methods
Return Values
Example
--This program will scan text around a circular path.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 194 of 197
arcText.CenterX = 0
arcText.CenterY = 0
arcText.Radius = 50
arcText.Elevation = 0
arcText.CharacterGap = 0
arcText.Clockwise = true
arcText.Font = "Arial"
arcText.Height = 5.2
arcText.Align = ArcTextAlign.Baseline
arcText.StartAngle = 120
Text Horizontal
Creates and returns a horizontal text object.
Syntax
horizontalText = Text.Horizontal()
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 195 of 197
Properties
Methods
Return Values
Example
--This program will scan the text "Laser Scanning".
myText = Text.Horizontal()
myText.X = -2
myText.Y = 0
-- Z axis elevation of the text
myText.Elevation = 0
myText.Height = 5.5
myText.Font = "Arial"
--Assign "Laser Scanning" string to text variable
myText.Text = "Laser Scanning"
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 196 of 197
myText.Angle = 0
Image.Text(myText)
Process Control
Creates a process control object capable of changing laser processing parameters in real-time.
Dynamic process control utilizes real-time process monitoring signals from the manufacturing process to effect changes in laser processing parameters such as laser power.
Example
--This program will describe the Process Control feature.
--Apply transformation
pc1.Transform(-10,10,4,6)
--Enable feature for this object
pc1.Enable()
ProcessControl Create
Creates and returns a instance of a process control.
Syntax
processControl = PC.Create()
processControl = PC.Create( PCInput pcInput, PCOutput pcOutput, RegionalAdjustPort regionalAdjustPort, )
Parameters
Methods
Return Values
Example
--This program will describe the Process Control feature.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 197 of 197
pc1 = PC.Create()
--Enable regional adjust port
pc1.EnableRegionalAdjust(RegionalAdjustPort.Port0)
--Apply transformation
pc1.Transform(-10,10,4,6)
--Enable feature for this object
pc1.Enable()
ProcessControl Disable
Disable a process control feature.
Syntax
PC.Disable()
Example
--This program will demonstrate how to disable a process control feature.
ProcessControl Enable
Enable a process control feature.
Syntax
PC.Enable()
Example
--This program will demonstrate how to enable a process control feature.
file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024