0% found this document useful (0 votes)
8 views

Scanscript Full

Uploaded by

ragunanth
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Scanscript Full

Uploaded by

ragunanth
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 197

ScanScript Page 1 of 197

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.

l After the first character, can contain letters and numbers

l The name cannot contain empty spaces.

The following keywords are reserved and cannot be used as names:

and break do else elseif while


end false for function if in
local nil not or repeat return
then true until + - *
/ % ^ # == ~=
<= >= < > = (
) [ ] { } ;
: , . .. ...

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

The relational operators in ScanScript™ are:

== 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 These operators always result in false or true.

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:

+ Addition operator (also used for String concatenation)


- Subtraction operator
= Multiplication operator
/ Division operator
% Remainder operator

Logical Operator

Logical operators are mainly used to control the program flow. The logical operators in ScanScript™ are and, or, and not.

l not always returns false or true

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

C++ style function syntax supported

function FunctionName (arguments)


return (value)
end

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.

The following syntax shows a method declaration with an optional parameter:

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:

readFile = File.OpenTextFile("Disk\\test\\txtfile.txt", FileMode.Read, Encoding.UTF8)

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

ScanAll Scans all the images in a particular project.


ScanImage Scans a specified image.
DateTime Scans the system date and/or time based on the given format.
Report Displays any message which is generated, on the Output window.
Sleep Freezes the script execution for a specified number of milliseconds and then continues execution.
SetUnits Changes the currently active unit of measurement.
SetAngleUnits Specify the angle unit. Unit is one of:Radians or Degrees. The default is, Degrees.
Error Stops executing the script and displays the specified error.
ToNumber Converts an argument to a number.
ToString Receives an argument of any type and converts it to a string in a reasonable format.

DateTime
Initializes a new instance of the DateTime structure to a specified number of years, months, days, hours, and minutes.

Syntax

DateTime( int year, int month, int day )


DateTime( int year, int month, int day, int hours, int minutes, int seconds )
DateTime( int year, int month, int day, int hours, int minutes, int seconds, int milliseconds )
DateTime("Format String" )

Parameters

year int Number of years.


month int Number of months
day int Number of days
hours int Number of hours
minutes int Number of minutes
seconds int Number of seconds
milliseconds int Number of milliseconds Properties

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.

Available Date Formats:

[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

Available Time Formats:

[hh] Returns the hour using 12 hour clock


[HH] Returns the hour using 24 hour clock
[mm] Returns minutes in two digits, of the current time
[ss] Returns seconds in two digits, of the current time
[tt] Returns either "am" or "pm" based on the time of the day

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.

String if only the format string provided.

Example
----- This program will scan the system date and time.

--Millimeters mode selected


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Displays the current date and time


currentDateTime = DateTime()
Report(currentDateTime.ToString("[D]/[M]/[YY] [hh]:[mm]:[ss]"))
currentDateTime.AddHours(10);
currentDateTime.AddDays(5);
Report(currentDateTime.ToString("[D]/[M]/[YYYY] [hh]:[mm]:[ss]"))

--Displays the date and time as 31/12/1998 3:35:54


newdDateTime= DateTime(1998,12,31,3,35,54)
Report(newdDateTime.ToString("[D]/[M]/[YYYY] [hh]:[mm]:[ss]"))

Error
Stops executing the script and displays the specified error.

Syntax

Error( string error )

Parameters

error string Error message that will be displayed.

Example

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 5 of 197

--------- This program will demonstrate the error function


--
--
--Millimeters mode selected
SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--InterlockHandler function
function InterlockHandler(interlockName)
error("Abort")
end

--Enable all the interlocks


Interlocks.MasterEnable = true
--Enable interlock on the interlock pin1
Interlocks.Enable(Pin.Din.Interlock1, true)
--Sets polarity of interlock pin1 as high
Interlocks.AssertOnCurrentFlow(Pin.Din.Interlock1, true)

-- Setting interlock handler function


Interlocks.SetInterlockHandler(InterlockHandler)

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

Report( string message )

Parameters

message string The message which will appear on the Output window.

Example
---------- This program will generate random numbers.

--Inch mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Display the generated number between 10 and 100


Report("Generate random number between 10 and 100 "..Math.Random(10, 100))
--Display the generated number lesser than 500
Report("Generate random number bellow 500 "..Math.Random(500))

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

--Scans all Images in the project


ScanAll()

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

Images Images Name of the Image. (Image1, Image2, Image3, etc.,)


Index Integer Index of the image in inserted order ( 0,1,2, etc.,)

Return Values

Example
--This program will scan the image that the user specifies

--Scan Image2 using image name


ScanImage(Images.Image2)

--Access images using index in a loop


for index=0,2 do
ScanImage(index)
end

SetAngleUnits
Specify the units used for angle measurement.

Syntax

SetAngleUnits( AngleUnits unit )

Parameters

unit AngleUnits The angle measurement unit, Radians or Degrees

Example
-------- This program will draw a rectangle with an angle of PI/4 radians

--Unit is set to Millimeters


SetUnits(Units.Millimeters)
--Set angle units as Radians
SetAngleUnits(AngleUnits.Radians)

--Laser Parameter settings


Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Angle is the result of PI/4 radians


angle = Math.PI/4
--Draws a rectangle with a width and height of 25 and 50 starting from (0,0) and with an angle of 45 degree.
Image.Box(0, 0, 25, 50, angle)

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

SetUnits( Units unit )

Parameters

unit Units Unit options are Inches and Millimeters

Example
-------------------- This programme draws a circle using Bits as the unit of measurement.

--Unit is set to Millimeters


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.Jumpspeed = 2000
Laser.Markspeed = 1000
--Delay settings
Laser.Jumpdelay = 150
Laser.Markdelay = 200

--Set units as Millimeters


SetUnits(Units.Millimeters)
--Scan a circle,with a center of (0,0) and a radius of 10 Millimeters
Image.Circle(0, 0, 25)

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

Sleep ( int time )

Parameters

time int Time in millisecond

Example
------ This Example describes scanning serial numbers. By using the sleep command a delay is introduced to the loop.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--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

--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

--Mark the horizontal text as 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

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

ToNumber( string value, int [base] )

Parameters

value string Value to be converted


base int

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".

--Creates an Input Box


inBox = Smd.CreateInputBox()
--Enter a title for the input box
inBox.Title = "User Data"
--Enter upper or lower case alphabetic characters only )
inBox.AddStringInput("Enter name", "Edit", "([a-z]|[A-Z])*")
--Enter Index number
inBox.AddStringInput("Index No")
--Displays the InputBox through ScanMaster™ Designer and waits until the user presses a button.
inBox.ReadInputs()
--Gets the inputs entered by the user.
x1, x2 = inBox.GetInputs()
--Convert strings in conditions to numbers
identification_number = ToNumber(x2)

if identification_number == nil then


--If user entered "Index No" value is not a number, then this message will show
Report("Invalid Index number.")

else
--If the range between 1000-10000
if identification_number >= 1000 and identification_number <= 10000 then

Report("Key '" .. identification_number .. "' is valid.")

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

value The value to convert

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.

ByteArray Creates an instance of a byte array according to the specified length.


DoubleArray Creates an instance of a double array according to the specified length.
IntArray Creates an instance of an integer array according to the specified length.
StringArray Creates an instance of a string array according to the specified length.

The array index starts from 1 and ends at array size.

Array ByteArray
Creates an instance of a byte array according to the specified length.

Syntax

byteArray = Array.ByteArray( int length )

Parameters

length Int The length of the array.

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

Returns an instance of a byte array of size length.

Example
--This program will describe the ByteArray method.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Creates an instance of a ByteArray of size of 3


myArray = Array.ByteArray(3)
--Assign a value to the first array element
myArray[1] = 65
--Assign a value to the second array element
myArray[2] = 90
--Assign a value to the third array element
myArray[3] = 105
--Display the length of the array
Report("Length = "..myArray.Length())
--Display the encoded string
Report(myArray.GetString(Encoding.UTF8))
--Insert an element to index 2
myArray.Insert(2, 70)
--Display the updated array
Report(myArray.GetString(Encoding.UTF8))
--Reverse the array
myArray.Reverse()
--Display the updated array
Report(myArray.GetString(Encoding.UTF8))
--Remove element at index 3
myArray.Remove(3)
--Display the updated array
Report(myArray.GetString(Encoding.UTF8))

Array DoubleArray
Creates an instance of a double array according to the specified length.

Syntax

doubleArray = Array.DoubleArray( int length )

Parameters

length Int The length of the array.

Properties

Insert Inserts an item to the array.e.g. doubleArray.Insert(int index, double value)


Length Returns the length of the array.
Remove Removes an item in the specified index of the array.e.g. doubleArray.Remove(int index)
Reverse Reverse the array.

Return Values

Returns an instance of a double array of size length.

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.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Creates an instance of a DoubleArray of size 6


radi = Array.DoubleArray(6)
--Assign a value to the first array element
radi[1] = 2.5
--Assign a value to the second array element
radi[2] = 5.0
--Assign a value to the third array element
radi[3] = 7.5
--Assign a value to the fourth array element
radi[4] = 10.0
--Assign a value to the fifth array element
radi[5] = 12.5
--Assign a value to the sixth array element
radi[6] = 25

--Display the Array size


size = radi.Length()

--Iterate loop according to the size of the array


for count = 1, size do
--Increment circle radius by 0.1 inch
radius = radi[count]
--Draw a circle
Image.Circle(0, 0, radius)
end

Array IntArray
Creates an instance of an integer array according to the specified length.

Syntax

intArray = Array.IntArray( int length )

Parameters

length Int The length of the array.

Properties

Insert Inserts an item to the array.e.g. intArray.Insert(int index, int value)


Length Returns the length of the array.
Remove Removes an item in the specified index of the array.
Reverse Reverse the array.

Return Values

Returns an instance of an integer array of size length.

Example

--This program will mark 5 circles using different laser power levels from the powerMap Mapping table.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

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

--Assign the length of the array to the Size variable


size = powerMap.Length()
--Define radius variable as 0.5 inch
radius = 12.5
--Iterate loop according to the size of the array
for count = 1, size do
--Power get it from the powerMap mapping table
power = powerMap[count]
--Mark the circle with a specified level of power from the Mapping table
Laser.Power = power
--Draw circle
Image.Circle(0, 0, radius)
--Increment circle radius by 0.5 inch
radius = radius + 12.5
end

Array StringArray
Creates an instance of a string array according to the specified length.

Syntax

stringArray = Array.StringArray( int length )

Parameters

length Int The length of the array.

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

Returns an instance of a string array of size length.

Example

--This program will mark 5 circles using different laser power levels from the powerMap Mapping table.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--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

--Fifth Power value is 6


powerMap[5] = 50

--Assign the length of the array to the Size variable


size = powerMap.Length()
--Define radius variable as 0.5 inch
radius = 12.5
--Iterate loop according to the size of the array
for count = 1, size do
--Power get it from the powerMap mapping table
power = powerMap[count]
--Mark the circle with a specified level of power from the Mapping table
Laser.Power = power
--Draw circle
Image.Circle(0, 0, radius)
--Increment circle radius by 0.5 inch
radius = radius + 12.5
end

Barcodes
Following Barcode types are supported.

Linear Barcodes

Codarbar Scans a Codarbar type barcode


Code128 Scans a Code128 type barcode Sub Types :Code128, Code128A, Code128B, Code128C
Code11 Scans a Code11 type barcode
Code2of5 Scans a Code2of5 type barcode
Code39 Scans a Code39 type barcode
Code93 Scans a Code93 type barcode Sub Types :Code93, Code93FullAscii
EAN Scans a EAN type barcode Sub Types :Ean8, Ean8p2, Ean8p5, Ean13, Ean13p2, Ean13p5
MSI Scans a MSI type barcode
UPCA Scans a UPCA type barcode Sub Types :Upca, Upca2, Upca5
UPCE Scans a UPCE type barcode Sub Types :Upce, Upcep2, Upcep5

2D Barcodes

DataMatrix Scans a DataMatrix type barcode


QRCode Scans a QRCode type barcode
Pdf417 Scans a Pdf417 type barcode
MacroPdf417 Scans a MacroPdf417 type barcode
MicroQrCode Scans a MicroQrCode type barcode

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

Returns an instance of Codabar type Barcode.

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

-- Set the units as Millimeters


SetUnits(Units.Millimeters)
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100
Laser.MarkDelay = 100

--Assign Codabar barcode to variable "var"


var = Barcodes.Codabar()
var = Barcodes.Datamatrix()
-- Barcode height is 14.5
var.Height = 14.5
-- X coordinate is 0.5
var.X = 0.5
-- Y coordinate is 0.5
var.Y = 0.5
--10 degree angle to the canvas
var.Angle = 10
--Set print ratio as 3
var.PrintRatio = 3
--Apply VerticalSerpentine hatch pattern
var.HatchStyle = HatchStyle.VerticalSerpentine
--Barcode includes "C125345" text as the string
var.Text = "C125345"
--0.01 unit hatch line gap
var.LineSpace = 0.01
--Mark Codabar barcode
Image.Barcode(var)

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

Returns an instance of Code2of5 type Barcode

Example
--This program will scan Code2of5 barcode

--Millimeters mode selected


SetUnits(Units.Millimeters)
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 15 of 197

Laser.MarkDelay = 100

--Assign Code2of5 barcode to "var" variable


var = Barcodes.Code2of5()
--Barcode height is 5.5
var.Height = 5.5
--Barcode width is 12.5
var.Width = 12.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
-- Invert the barcode
var.Invert = true
-- Enable quiet zone
var.QuietZone = true
--Apply VerticalSerpentine hatch pattern
var.HatchStyle = HatchStyle.VerticalSerpentine
--Barcode includes "123456" text as the string
var.Text = "123456"
--0.1 unit hatch line gap
var.LineSpace = 0.1
--Mark Code2of5 barcode
Image.Barcode(var)

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

Returns an instance of Code11 type Barcode.

Example
-This program will scan a Code11 barcode

--Millimeters mode selected


SetUnits(Units.Millimeters)
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100
Laser.MarkDelay = 100

--Assign Code11 barcode to "var" variable


var = Barcodes.Code11()
--Barcode height is 5.5
var.Height = 5.5
--Barcode width is 12.5
var.Width = 12.5
--x position of the barcode
var.X = 0.5
--Y position of the barcode
var.Y = 0.5

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 16 of 197

--10 degree angle to the canvas


var.Angle = 10
-- Invert the barcode
var.Invert = true
-- Enable quiet zone
var.QuietZone = true
--Apply Helix hatch pattern
var.HatchStyle = HatchStyle.Helix
--Barcode includes "12345" text as the string
var.Text = "12345"
--0.1 unit hatch line gap
var.LineSpace = 0.1
--Mark Code11 barcode
Image.Barcode(var)

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

Returns an instance of Code39 type Barcode.

Example
------ This program will scan Code39 barcode

--Millimeters mode selected


SetUnits(Units.Millimeters)
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100
Laser.MarkDelay = 100

--Assign Code39 barcode to "var" variable


var = Barcodes.Code39()
--barcode height is 5.5
var.Height = 5.5
--barcode width is 12.5
var.Width = 12.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 "EXCEL01234" text as the string
var.text = "01234"
--0.1 unit hatch line gap
var.lineSpace = 0.1
--Mark Code39 barcode
Image.Barcode(var)

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

subType Code93 Barcode sub type

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

Returns an instance of Code93 type Barcode.

Example

--------- This program will scan Code93 barcode

--Millimeters mode selected


SetUnits(Units.Millimeters)
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100
Laser.MarkDelay = 100
Laser.PolyDelay = 50

--Assign Code93 barcode (subtype Code93FullAscii) to "var" variable


var = Barcodes.Code93(Code93.Code93FullAscii)
--barcode height is 5.5
var.Height = 5.5
--barcode width is 14.4
var.Width = 14.4
--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 = 60
-- Invert the barcode
var.Invert = true
-- Enable quiet zone
var.QuietZone = true
--Apply Horizontal hatch pattern
var.HatchStyle = HatchStyle.Horizontal
--Barcode includes "12X345AB" text as the string
var.Text = "12X345AB"
--0.1 unit hatch line gap
var.LineSpace = 0.1
--Mark Code93 full ASCII subtype barcode
Image.Barcode(var)

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

subType BarcodeSubtypeCode128 Barcode sub type

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

Returns an instance of a Code128 type barcode.

Example
------- This program will scan a Code128 barcode

--Millimeters mode selected


SetUnits(Units.Millimeters)
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100
Laser.MarkDelay = 100

--Assign Code128 barcode to "var" variable (Subtype is Code128A)


var = Barcodes.Code128(Code128.Code128A)
--Barcode height is 5.5
var.Height = 5.50
--Barcode width is 14.5
var.Width = 14.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 VerticalSerpentine hatch pattern
var.HatchStyle = HatchStyle.VerticalSerpentine
--Barcode includes "CODE128A" text as the string
var.Text = "CODE128A"
--0.5 unit hatch line gap
var.LineSpace = 0.5
--Mark Code128 barcode
Image.Barcode(var)

Barcodes DataMatrix

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 19 of 197

This will create an instance of DataMatrix barcode.

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

SetHatchingDirection(HorizontalHatchDirection hatchDirection, HorizontalHatchLineScanDirection hatchLineScanDirection) Sets the hatching Direction


SetHatchingDirection(VerticalHatchDirection hatchDirection , VerticalHatchLineScanDirection hatchLineScanDirection) Sets the hatching Direction

Return Values

Returns an instance of DataMatrix type Barcode.

Example
----- This program will scan a Datamatrix code applying the dot hatch pattern

-- Set the units as Millimeters


SetUnits(Units.Millimeters)
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100
Laser.MarkDelay = 100

-- Assign Datamatrix barcode to variable "var"


var = Barcodes.Datamatrix()
-- Barcode height is 14.5
var.Height = 14.5
-- X coordinate is 0.5
var.X = 0.5
-- Y coordinate is 0.5
var.Y = 0.5
-- Angle of the barcode is 30 degrees
var.Angle = 30
-- Invert the barcode
var.Invert = true
-- Enable quiet zone
var.QuietZone = true
-- Matrix size is 16x16
var.MatrixSize = DataMatrixSize.S16x16
-- Apply 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

subType Ean Barcode sub type

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

Returns an instance of EAN type Barcode.

Example
------ This program will scan EAN barcode

--Millimeters mode selected


SetUnits(Units.Millimeters)
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100
Laser.MarkDelay = 100

--Assign Ean barcode (barcode subtype is Ean8) to variable "var"


var = Barcodes.Ean(Ean.Ean8)
--Barcode height is 5.5
var.Height = 5.5
--Barcode width is 14.5
var.Width = 14.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

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 21 of 197

--Barcode includes "1234567" text as the string


var.Text = "1234567"
--0.1 unit line gap
var.LineSpace = 0.1
--Mark Ean8 barcode
Image.Barcode(var)

Barcodes Hatch Styles


Hatching is essential to create contrast on the laser-marked material surface to meet the reading capabilities of different barcode readers and scanners. SMC provides several
hatching mechanisms and styles to meet the requirements of barcode marking on various material and applications.

The barcode hatching styles are defined in the HatchStyles enumeration.

Following is a brief introduction to the geometry and mechanisms of each hatching style.

Horizontal line hatch

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.

Following barcode types are supported

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.

Following barcode types are supported

Linear Barcodes Data Matrix QR Code Micro QR Code PDF417 Macro PDF417

Vertical line Hatch

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.

Following barcode types are supported

Linear Barcodes Data Matrix QR Code Micro QR Code PDF417 Macro PDF417

Vertical Serpentine Hatch

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.

Following barcode types are supported

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.

Following barcode types are supported

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.

Following barcode types are supported

Linear Barcodes Data Matrix QR Code Micro QR Code PDF417 Macro PDF417

Circle Hatch style

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.

Following barcode types are supported

Linear Barcodes Data Matrix QR Code Micro QR Code PDF417 Macro PDF417

Circle With Dot Hatch Style

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.

Following barcode types are supported

Linear Barcodes Data Matrix QR Code Micro QR Code PDF417 Macro PDF417

Merge Cells Uni Directional Hatch

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.

Following barcode types are supported

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

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.

Following barcode types are supported

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

Angle float Gets or sets the angle of the MacroPdf417 Barcode.


Gets or sets whether the barcode will be automatically increased if the current size cannot accommodate all the
AutoExpand bool
characters.
Gets or sets the compaction mode of the Pdf417 barcode. Refer the Compaction mode page for a list of
CompactionMode MacroPdf417CompactionMode
enumerations.
DotDuration float Duration of the dot in micro seconds when the HatchStyle is HatchStyle.Dot
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 MacroPdf417ErrorCorrectionLevel
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 The gap between adjacent hatch lines
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 MacroPdf417 Barcode.
NumberOfRows int Gets or sets the number of rows of the MacroPdf417 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 Alphanumeric characters, which will get encoded into the Barcode.
Width float The width of the Barcode.
X float The x coordinate of the starting position.
Y float The y coordinate of the starting position.

Methods

SetHatchingDirection(HorizontalHatchDirection hatchDirection, HorizontalHatchLineScanDirection hatchLineScanDirection) Sets the hatching Direction


SetHatchingDirection(VerticalHatchDirection hatchDirection , VerticalHatchLineScanDirection hatchLineScanDirection) Sets the hatching Direction

Return Values

Returns an instance of MacroPdf417-code type Barcode.

Example
---- This program will scan a MacroPdf417 barcode

--Set the units as Millimeters


SetUnits(Units.Millimeters)
--Laser Parameter settings
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100
Laser.MarkDelay = 100

--Assign MacroPdf417 barcode to variable "var"


var = Barcodes.MacroPdf417()
--Barcode height is 14.5
var.Height = 14.5
--X coordinate is 0.5
var.X = 0.5
--y coordinate is 0.5
var.Y = 0.5
--Angle of the barcode is 30 degrees
var.Angle = 30
--Auto expand enabled
var.AutoExpand = true
--Apply horizontal line hatch pattern
var.HatchStyle = HatchStyle.Horizontal
--Sets the line space as 0.1 Millimeters
var.Linespace = 0.1
--Barcode includes "ScanMaster ScanScript" text as the string
var.Text = "ScanMaster ScanScript"
--Set the compaction mode as text
var.CompactionMode = MacroPdf417CompactionMode.TextMode
--Specify the columns of the barcode
var.NumberOfColumns = 8
--Specify the error correction level of the barcode
var.ErrorCorrectionLevel = MacroPdf417ErrorCorrectionLevel.Level1
--Specify the rows of the barcode
var.NumberOfRows = 6
--Scan Pdf417 barcode
Image.Barcode(var)

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

SetHatchingDirection(HorizontalHatchDirection hatchDirection, HorizontalHatchLineScanDirection hatchLineScanDirection) Sets the hatching Direction


SetHatchingDirection(VerticalHatchDirection hatchDirection , VerticalHatchLineScanDirection hatchLineScanDirection) Sets the hatching Direction

Return Values

Returns an instance of MicroQRCode type Barcode.

Example
------ This program will scan a MicroQrCode applying the Dot hatch pattern

--Set the units as Millimeters


SetUnits(Units.Millimeters)
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100
Laser.MarkDelay = 100

--Assign MicroQrCode barcode to variable "var"


var = Barcodes.MicroQRCode()
--Barcode height is 14.4
var.Height = 14.4
--X coordinate is 0.5
var.X = 0.5
--y coordinate is 0.5
var.Y = 0.5
--Angle of the barcode is 30 degrees
var.Angle = 30
--Auto expand enabled
var.AutoExpand = true
--Apply Dot hatch pattern
var.HatchStyle = HatchStyle.Dot
--Sets dot duration as 100
var.DotDuration = 100

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 27 of 197

--Barcode includes "ScanMaster" text as the string


var.Text = "ScanMaster"
--Barcode size
var.CodeSize = MicroQRCodeSize.S15x15
--Specify Default as the encoding code
var.EncodingMode = MicroQRCodeEncodingMode.Default
--Specify M (Medium) as the error correction level
var.ErrorCorrectionLevel = MicroQRCodeErrorCorrectionlevel.M
--Specify the mask pattern
var.MaskPattern = MicroQRCodeMaskPattern.Mask0
--Scan MicroQRCode barcode
Image.Barcode(var)

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

Returns an instance of Msi type Barcode.

Example
-------- This program will scan Msi barcode

--Millimeters mode selected


SetUnits(Units.Millimeters)
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100
Laser.MarkDelay = 100

--Assign Msi barcode to "var" variable


var = Barcodes.Msi()
--Barcode height is 10.5
var.Height = 10.5
--Barcode width is 14.4
var.Width = 14.4
--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
--Applies Horizontal hatch pattern
var.HatchStyle = HatchStyle.Horizontal
--Barcode includes "19820928" text as the string
var.Text = "19820928"
--0.1 unit hatch line gap
var.LineSpace = 0.1
--Mark 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

SetHatchingDirection(HorizontalHatchDirection hatchDirection, HorizontalHatchLineScanDirection hatchLineScanDirection) Sets the hatching Direction


SetHatchingDirection(VerticalHatchDirection hatchDirection , VerticalHatchLineScanDirection hatchLineScanDirection) Sets the hatching Direction

Return Values

Returns an instance of Pdf417-code type Barcode.

Example
------ This program will scan a Pdf417 barcode

--Set the units as Millimeters


SetUnits(Units.Millimeters)
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100
Laser.MarkDelay = 100

--Assign Pdf417 barcode to variable "var"


var = Barcodes.Pdf417()
--Barcode height is 14.4
var.Height = 14.4

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 29 of 197

--X coordinate is 0.5


var.X = 0.5
--y coordinate is 0.5
var.Y = 0.5
--Angle of the barcode is 30 degrees
var.Angle = 30
--Auto expand enabled
var.AutoExpand = true
--Apply horizontal line hatch pattern
var.HatchStyle = HatchStyle.Horizontal
--Sets the line space as 0.1 Millimeters
var.Linespace = 0.1
--Barcode includes "ScanMaster ScanScript" text as the string
var.Text = "ScanMaster ScanScript"
--Set the compaction mode as text
var.CompactionMode = Pdf417CompactionMode.TextMode
--Specify the columns of the barcode
var.NumberOfColumns = 8
--Specify the error correction level of the barcode
var.ErrorCorrectionLevel = Pdf417ErrorCorrectionLevel.Level1
--Specify the rows of the barcode
var.NumberOfRows = 6
--Specify the width of the barcode
var.Width = 3
--Scan Pdf417 barcode
Image.Barcode(var)

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

SetHatchingDirection(HorizontalHatchDirection hatchDirection, HorizontalHatchLineScanDirection hatchLineScanDirection) Sets the hatching Direction


SetHatchingDirection(VerticalHatchDirection hatchDirection , VerticalHatchLineScanDirection hatchLineScanDirection) Sets the hatching Direction

Return Values

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 30 of 197

Returns an instance of QR-code type Barcode.

Example
------ This program will scan a QRCode applying the Dot hatch pattern

--Set the units as Millimeters


SetUnits(Units.Millimeters)
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100
Laser.MarkDelay = 100

--Assign QRCode barcode to variable "var"


var = Barcodes.QRCode()
--Barcode height is 14.4
var.Height = 14.4
--X coordinate is 0.5
var.X = 0.5
--y coordinate is 0.5
var.Y = 0.5
--Angle of the barcode is 30 degrees
var.Angle = 30
--Auto expand enabled
var.AutoExpand = true
--Apply Dot hatch pattern
var.HatchStyle = HatchStyle.Dot
--Sets dot duration as 100
var.DotDuration = 100
--Barcode includes "ScanMaster ScanScript" text as the string
var.Text = "ScanMaster ScanScript"
--QR-code size
var.CodeSize = QRCodeSize.S145x145
--Specify Default as the encoding code
var.EncodingMode = QRCodeEncodingMode.Default
--Specify M (Medium) as the error correction level
var.ErrorCorrectionLevel = QRCodeErrorCorrectionlevel.M
--Specify the mask pattern
var.MaskPattern = QRCodeMaskPattern.Mask5
--Scan QRCode
Image.Barcode(var)

Barcodes Upca
This will create an instance of Upca type barcode.

Syntax

upcaBarcode = Barcodes.Upca ( )
upcaBarcode = Barcodes.Upca ( Upca subType )

Parameters

subType Upca Barcode sub type

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

Returns an instance of Upca type Barcode.

Example
------- This program will scan UPCA barcode

--Millimeters mode selected


SetUnits(Units.Millimeters)
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100
Laser.MarkDelay = 100

--UPCA barcode (barcode subtype is Upcap2)


var = Barcodes.Upca(Upca.Upcap2)
--barcode height is 5.5
var.Height = 5.5
--barcode width is 14.4
var.Width = 14.4
--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
-- Set print ratio as 2
var.PrintRatio = 2
--Apply Horizontal hatch pattern
var.HatchStyle = HatchStyle.Horizontal
--Barcode includes "0134567891455" text as the string
var.Text = "0134567891455"
--0.01 unit line gap
var.LineSpace = 0.01
--Mark Upcpa2 barcode
Image.Barcode(var)

Barcodes Upce
This will create an instance of Upce type barcode.

Syntax

upceBarcode = Barcodes.Upce ( )
upceBarcode = Barcodes.Upce ( Upce subType )

Parameters

subType Upce Barcode sub type

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

Returns an instance of Upce type Barcode.

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

--Millimeters mode selected


SetUnits(Units.Millimeters)
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100
Laser.MarkDelay = 100

--Assign Upce barcode (barcode subtype is Upcep5) to "var" variable


var = Barcodes.Upce(Upce.Upcep5)
--Barcode height is 5.5
var.Height = 5.5
--Barcode width is 14.4
var.Width = 14.4
--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 Helix hatch pattern
var.HatchStyle = HatchStyle.Helix
--Barcode includes "019348567816" text as the string
var.Text = "019348567816"
--0.1 unit line gap
var.LineSpace = 0.1
--Mark Upcep5 barcode
Image.Barcode(var)

BitConverter
Converts base data types to bytes and vice versa.

Following conversions are supported.

GetBytesFromDouble Returns the specified double value as a Byte Array


GetBytesFromFloat Returns the specified float value as a Byte Array
GetBytesFromInt Returns the specified 32-bit signed integer value as a Byte Array
GetBytesFromShort Returns the specified 16-bit signed integer value as a Byte Array
ToDouble Returns a double value converted from eight bytes at a specified position in Byte Array
ToFloat Returns a float value converted from four bytes at a specified position in the Byte Array
ToInt Returns a 32-bit signed integer converted from four bytes at a specified position in the Byte Array
ToShort Returns a 16-bit signed integer converted from four bytes at a specified position in the Byte Array

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

GetBytesFromDouble( double value, [bool isLittleEndian] )

Parameters

value double Value to be converted.


isLittleEndian bool True for little-endian False for big-endian. [ optional]

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 33 of 197

Return Values

Returns a Byte Array of 8 bytes.

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

GetBytesFromFloat( float value, [bool isLittleEndian] )

Parameters

value float Value to be converted.


isLittleEndian bool True for little-endian False for big-endian. [ optional]

Return Values

Returns a Byte Array of 4 bytes.

Example
--This program will demonstrate the BitConverter.GetBytesFromFloat method.

--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)

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

GetBytesFromInt( int value, [bool isLittleEndian] )

Parameters

value int Value to be converted.


isLittleEndian bool True for little-endian False for big-endian. [ optional]

Return Values

Returns a Byte Array of 4 bytes.

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

GetBytesFromShort( int value, [bool isLittleEndian] )

Parameters

value double Value to be converted.


isLittleEndian bool True for little-endian False for big-endian. [ optional]

Return Values

Returns a Byte Array of 2 bytes .

Example
--This program will return the 16-bit integer value as an array of bytes and each element converted into Hexadecimal format.

--The short value


value = 65535
--Convert the value to ByteArray "true" on little-endian systems and "false" on big-endian systems
bytes = BitConverter.GetBytesFromShort(value, true)

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

ToDouble( ByteArray array, int index, [bool isLittleEndian] )

Parameters

array ByteArray Array of 8 bytes.


index int Specific position of the array.
isLittleEndian bool True for little-endian False for big-endian. [ optional]

Return Values

Returns a double value.

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

for i=1, bytes.Length(), 8 do


valueDouble = BitConverter.ToDouble(bytes, i)
--Convert "valueDouble" to ByteArray on a big-endian system
valueByte = BitConverter.GetBytesFromDouble(valueDouble, false)
for i= 1, bytes.Length() do
Report(String.ToHexString(valueByte[i]))
end
end

BitConverter ToFloat
Returns a float value by converting four bytes from a specified position, in the ByteArray.

Syntax

ToFloat( ByteArray array, int index, [bool isLittleEndian] )

Parameters

array ByteArray Array of 4 bytes.


index int Specific position of the array.
isLittleEndian bool True for little-endian False for big-endian. [ optional]

Return Values

Returns a float value.

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)

for i=1, bytes.Length(), 4 do


valueFloat = BitConverter.ToFloat(bytes, i)
bytesFloats = BitConverter.GetBytesFromFloat(valueFloat, true)
for i= 1, bytesFloats.Length() do
--ByteArray element convert to Hexa decimal format and display
Report(String.ToHexString(bytesFloats[i]))
end
end

BitConverter ToInt
Returns a 32-bit signed integer value by converting four bytes from a specified position, in the ByteArray.

Syntax

ToInt( ByteArray array, int index, [bool isLittleEndian] )

Parameters

array ByteArray Array of 4 bytes.


index int Specific position of the array.
isLittleEndian bool True for little-endian False for big-endian. [ optional]

Return Values

Returns a 32-bit signed integer.

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)

for i=1, bytes.Length(), 4 do


valueInt = BitConverter.ToInt(bytes, i)
--Convert "valueInt" to ByteArray on a big-endian system

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 36 of 197

valueByte = BitConverter.GetBytesFromInt (valueInt, false)


for i= 1, bytes.Length() do
--ByteArray element converted to Hexadecimal format and displayed
Report(String.ToHexString(valueByte[i]))
end
end

BitConverter ToShort
Returns a 16-bit signed integer value by converting two bytes from a specified position, in the ByteArray.

Syntax

ToInt( ByteArray array, int index, [bool isLittleEndian] )

Parameters

array ByteArray Array of 2 bytes.


index int Specific position of the array.
isLittleEndian bool True for little-endian False for big-endian. [ optional]

Return Values

Returns a 16-bit signed integer.

Example
--This program will Display the characters according to the ASCII values that the user has defined in the byte array

--Creates a Byte Array


byteAry = Array.ByteArray(6)
--Array elements
byteAry[1] = 83
byteAry[2] = 99
byteAry[3] = 114
byteAry[4] = 105
byteAry[5] = 112
byteAry[6] = 116
--First 4 elements converted to Int32
convertInt = BitConverter.ToInt (byteAry, 1)
--Last 2 elements converted to Short
convertShort = BitConverter.ToShort (byteAry, 5)
--Display Int and Short values
Report(convertInt.." "..convertShort)
--Returns a Byte array from "convertInt"
byteFromIntAry = BitConverter.GetBytesFromInt(convertInt,true)
--Returns a Byte array from "convertShort"
byteFromShortAry = BitConverter.GetBytesFromShort(convertShort,true)
--Display result
Report(byteFromIntAry.GetString()..byteFromShortAry.GetString())

Bit Operation
Following bit operations are supported.

BAnd Bitwise AND Operation


BNot Bitwise NOT Operation
BOr Bitwise OR Operation
BXor Bitwise XOR Operation
GetBit Gets the value of the bit specified by the index.
ShiftLeft Left shift the value by a number of positions specified by num.
RotateLeft Left rotates the value by a number of positions specified by num.
RotateRight Rotates the value to the right by a number of positions specified by num.
ShiftRight Right shift the value by a number of positions specified by num.
SetBit Sets the value of the bit specified by the index.
ToggleEndianness16 Toggle between Little-Endian and Big-Endian by taking 'value' as a 16 bit integer
ToggleEndianness32 Toggle between Little- Endian and Big-Endian by taking 'value' as a 32 bit integer

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

Bit Operation BAnd


Bitwise AND Operation.

Syntax

BAnd( int value 1, int value 2, int value 3,.... )

Parameters

value 1 int Value 1


value 2 int Value 2
value n int Permits any number of values for AND operation (Optional)

Return Values

Returns the Bitwise AND of the given 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))

Bit Operation BNot


Bitwise NOT Operation.

Syntax

BNot( int value )

Parameters

value int The value to be inverted.

Return Values

Returns the inverted value as an integer.

Example
--This program will demonstrate the Bitwise NOT operation.

val1 = 125
--Display the result of the Bitwise NOT operation
Report(BitOp.BNot(val1))

Bit Operation BOr


Bitwise OR Operation.

Syntax

BAnd( int value1, int value2, int value3, )

Parameters

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 38 of 197

value 1 int Value 1


value 2 int Value 2
value n int Permits any number of values for OR operation (Optional)

Return Values

Returns the result of the Bitwise OR operation as an integer.

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))

Bit Operation BXor


Bitwise XOR Operation.

Syntax

BAnd( int value1, int value2, int value3, )

Parameters

value 1 int Value 1


value 2 int Value 2
value n int Permits any number of values for XOR operation (Optional)

Return Values

Returns the result of the BXor operation as an integer.

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))

Bit Operation GetBit


Gets the value of the bit specified by the index.

Syntax

GetBit( int value, int index )

Parameters

value int The bit sequence (as an integer value) to seek.


index int The position of the bit to get

Return Values

Returns a boolean value

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

--Check the second bit of the value 15.


if BitOp.GetBit(15,2) then
Report("test successful")

else
Report("test fail")
end

Bit Operation RotateLeft


Left rotates the value by a number of positions specified by num.

Syntax

RotateLeft( int value, int num )

Parameters

value int The bit sequence (integer value) to be rotated.


num int The number of bit positions to be rotated.

Return Values

The result of the RotateLeft operation as an integer.

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

Bit Operation RotateRight


Rotates the value to the right by a number of positions specified by num.

Syntax

RotateRight( int value, int num )

Parameters

value int The bit sequence (integer value) to be rotated.


num int The number of bit positions to be rotated.

Return Values

The result of the RotateRight operation as an integer.

Example
--This program demonstrates the RotateRight operation.

val = -35
--Display the right rotated value.
Report(BitOp.RotateRight(val, 2))

Bit Operation SetBit


Sets the value of the bit specified by the index.

Syntax

SetBit( int value, int index, bool valueToSet )

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 40 of 197

Parameters

value int The bit sequence (as an integer value) to seek.


index int The position of the bit to get
valueToSet bool If True sets the bit value to 1, or set the bit value to 0 if False.

Return Values

Returns the modified bit sequence as an integer.

Example
--This program will demonstrate the SetBit operation

--255 assigned the to variable "val"


val = 255
--Set the 4th bit of the "val" to false status
Report(BitOp.SetBit(val, 4, false))

Bit Operation ShiftLeft


Left shift the value by a number of positions specified.

Syntax

ShiftLeft( int value, int num )

Parameters

value int The value to be shifted.


num int The number of bits by which the value will be shifted.

Return Values

Returns the left shifted value as an integer.

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

Bit Operation ShiftRight


Right shift the value by a number of positions specified by num.

Syntax

ShiftRight( int value, int num )

Parameters

value int The value to be shifted.


num int The number of bits by which the value will be shifted.

Return Values

Return the right shifted value as an integer.

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.

--For loop increments by 2


for j = 0, 24, 2 do
--Right shift by 1 position
i = BitOp.ShiftRight(j, 1)
--Display the result
Report(j.." "..i)
end

Bit Operation ToggleEndianness16


Toggle between Little-Endian and Big-Endian by taking 'value' as a 16 bit integer.

Syntax

ToggleEndianness32( int value )

Parameters

value int The value to be inverted.

Return Values

Returns the converted value.

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

Bit Operation ToggleEndianness16


Toggle between Little-Endian and Big-Endian by taking 'value' as a 16 bit integer.

Syntax

ToggleEndianness16( int value )

Parameters

value int The value to be inverted.

Return Values

Returns the converted value.

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

Following control structures are supported.

for Generic For loop


function Generic Function block
if Generic If statement
while Generic While loop
repeat Repeat loop iterates over a block of code multiple number of times
break terminates the execution of the block of code, or loop

Example
--This Program will demonstrate how a Rectangular Array is created

--Millimeter mode selected


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 1500

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 = "*"

--Marking function. Do only the necessary things here


function Mark()
Image.Text(myText)
end

--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

--Calling Rectangular Array

RectangularArray(rowOffset, columnOffset, rowNum, colNum, Mark)

break
Implements the break command

Example
--This Example describes scanning serial numbers. When the count reaches 10 it breaks out of the loop

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000

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

function MarkText()--MarkText function


--Text is combination of "SN:" string with number variable
multiText.Text = "SN:"..number
--Mark the horizontal text as 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
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

for index = start index, end index [, step value] do

<Body of loop>

end

Example
--------- This Program will demonstrate how to use the for loop

--Millimeter mode selected


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
Laser.LaserOnDelay = 0
Laser.LaserOffDelay = 0
Laser.PolyDelay = 0

-- 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>

elseif (condition) then

<Statements>

else

<Statements>

end

Example
------- This program will execute the command selected.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

-- Commands
line = 1
box = 2
circle = 3

-- Set the command


command = line

if command == line then


Image.Line(0, 0, 12.5, 12.5)
elseif command == box then
Image.Box(0, 0, 15, 15)
elseif command == circle then
Image.Circle(0, 0, 25)
else
Report("Unknown Command")
end

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:.

--Set the units as Millimeters


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000

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

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000

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

--Loop runs continuously


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

Functions

Syntax

function FunctionName (arguments)

<Statements>

return (value)

end

Example
------- This Program will demonstrate how to define and use functions

--Millimeter mode selected


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
Laser.LaserOnDelay = 0
Laser.LaserOffDelay = 0
Laser.LaserPipelineDelay = 420
Laser.PolyDelay = 0

-- Accepts one argument


-- No return value
function Inform(message)
Report(message)
end

-- Accepts two arguments


-- Returns single bool value
function IsLessThan(value, limit)
return value < limit
end

-- Accepts one argument


-- Returns two arguments, bool and a string
function ValidateTemperature(value)
if IsLessThan(value, 0) then
return false, "Temperature should be greater than zero"
else
return true, nil
end
end

-- Temperature to validate
temperature = -1

-- Capture two return values from the function


isValid, errorMessage = ValidateTemperature(temperature)

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.

Create Creates a directory in the specified path.


Delete Deletes the specified directory.
GetDirectories Returns a String Array which contains the list of directories that are available in the specified path.
Returns a String Array which will contain a list of files that are available in the specified path. Only the matching files will be returned if a wildcard is
GetFiles
provided.

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()

--Open a "binfile.bin" in read mode


binaryFile1 = File.OpenBinaryFile("/mnt/SMC/tmp/binfile.bin", FileMode.Read)
--Seek file from a location specified by the seek origin
binaryFile1.Seek(0, FileSeek.Begin)
--Reads the whole file and returns "byteValue" array
byteValue = binaryFile1.ReadToEnd()
--Display the character corresponds to the ASCII value
charValue = byteValue.Getstring(Encoding.UTF8)
--Gets the string from the byte array encode as UTF8
Report(charValue)
--Close the file
binaryFile1.Close()
--Delete the "User" directory
Directory.Delete("/mnt/SMC/tmp", true)

Directory Create
Creates a directory in the specified path.

Syntax

Directory.Create( string path )

Parameters

path string Location to create the directory.

Return Values

Returns True if the directory is successfully created

Example for SMC


--This program will create a directory and "binfile.bin" file. If the "tmp" directory already exists or if the directory is not successfully created a message will be

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")

if (result == true) then


--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()

--Open a "binfile.bin" in read mode


binaryFile1 = File.OpenBinaryFile("/mnt/SMC/tmp/binfile.bin", FileMode.Read)
--Seek file from a location specified by the seek origin
binaryFile1.Seek(0, FileSeek.Begin)
--Reads the whole file and returns "byteValue" array
byteValue = binaryFile1.ReadToEnd()
--Display the character corresponds to the ASCI value
charValue = byteValue.GetString(Encoding.UTF8)
--Gets the string from the byte array encode as UTF8
Report(charValue)
--Close the file
binaryFile1.Close()

else
-- This message will be displayed
Report("Directory already exist or it is not created")

end

Example for EC1000


--This program will create a directory and "binfile.bin" file. If the "User" directory already exists or if the directory is not successfully created a message will be

--Creates a directory
result = Directory.Create("Disk\\User")

if (result == true) then


--creates a binary file called "binfile" in write mode
binaryFile = File.OpenBinaryFile("Disk\\User\\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()

--Open a "binfile.bin" in read mode


binaryFile1 = File.OpenBinaryFile("Disk\\User\\binfile.bin", FileMode.Read)
--Seek file from a location specified by the seek origin
binaryFile1.Seek(0, FileSeek.Begin)
--Reads the whole file and returns "byteValue" array
byteValue = binaryFile1.ReadToEnd()
--Display the character corresponds to the ASCI value
charValue = byteValue.GetString(Encoding.UTF8)
--Gets the string from the byte array encode as UTF8
Report(charValue)
--Close the file
binaryFile1.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

Delete( string path, [bool forecefully] )

Parameters

path string Location of the directory.


forcefully boolean [Optional] Setting to true will delete the directory even if it's not empty otherwise deletes the directory if it is empty.

Return Values

Example for SMC


--This program will first delete the "/mnt/SMC/tmp" directory if it exists. Next it will create a directory and "binfile.bin" file.

--Deletes the User directory.


Directory.Delete ("/mnt/SMC/tmp")
--Creates a directory
result = Directory.Create("/mnt/SMC/tmp")

if (result == true) then


--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()

--Open a "binfile.bin" in read mode


binaryFile1 = File.OpenBinaryFile("/mnt/SMC/tmp/binfile.bin", FileMode.Read)
--Seek file from a location specified by the seek origin
binaryFile1.Seek(0, FileSeek.Begin)
--Reads the whole file and returns "byteValue" array
byteValue = binaryFile1.ReadToEnd()
--Display the character corresponds to the ASCI value
charValue = byteValue.Getstring(Encoding.UTF8)
--Gets the string from the byte array encode as UTF8
Report(charValue)
--Close the file
binaryFile1.Close()

else
-- This message will be displayed.
Report("Directory already exist or it is not created")

end

Example for EC1000


--This program will first delete the "Disk\\User" directory if it exists. Next it will create a directory and "binfile.bin" file.

--Deletes the User directory.


Directory.Delete ("Disk\\User")

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")

if (result == true) then


--Creates a binary file called "binfile" in write mode
binaryFile = File.OpenBinaryFile("Disk\\User\\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()

--Open a "binfile.bin" in read mode


binaryFile1 = File.OpenBinaryFile("Disk\\User\\binfile.bin", FileMode.Read)
--Seek file from a location specified by the seek origin
binaryFile1.Seek(0, FileSeek.Begin)
--Reads the whole file and returns "byteValue" array
byteValue = binaryFile1.ReadToEnd()
--Display the character corresponds to the ASCI value
charValue = byteValue.Getstring(Encoding.UTF8)
--Gets the string from the byte array encode as UTF8
Report(charValue)
--Close the file
binaryFile1.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

GetDirectories( string path )

Parameters

path string Location of the directory.

Return Values

Returns a string array.

Example SMC
--This program will show the all directories in the given path. Number of directories and their names will be displayed.

--Get all directories in the given path


allDirectories = Directory.GetDirectories("/mnt/SMC")
--Display the directory count
Report(allDirectories.Length())

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.

--Get all directories in the given path


allDirectories = Directory.GetDirectories("Disk\\lec")

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 51 of 197

--Display the directory count


Report(allDirectories.Length())

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

GetFiles( string path, [string wildCard] )

Parameters

path string Location of the directory.


WildCard string filter string

Return Values

Returns a String Array.

Example for SMC


--This Program will show the number of files and their names in the specified directory

--Get all the files within the directory


files = Directory.GetFiles("/mnt/SMC/tmp","*.*")
--Display the number of files in the directory
Report(files.Length())
for i = 1, files.Length() do
--Display their names
Report(files[i])
end

Example for EC1000


--This Program will show the number of files and their names in the specified directory

--Get all the files within the directory


files = Directory.GetFiles("Disk\\lec","*.*")
--Display the number of files in the directory
Report(files.Length())
for i = 1, files.Length() do
--Display their names
Report(files[i])
end

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.

--Set the units as Millimeters


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 52 of 197

--Creates a notify event


event = Events.CreateNotifyEvent("PartCompleted")

function PartCompleted(messageData)
Report("Part #"..messageData.." Completed")
end

for index = 1, 100 do

Image.Circle(0, 0, 25)

--Scheduled the event and pass the index as a parameter


event.Schedule(index)

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

pin Pin The input or output pin of the port


raiseOnLow bool Sets whether the IO event should raise, when the state of the pin is low.
raiseOnHigh bool Sets whether the IO event should raise, when the state of the pin is high.
eventHandlerFunctionName string Function name

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.

--Set the units as Millimeters


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

function OnIoEvent(state)

Report(tostring(state))

end

-- OnIoEvent will call the event handler when the UserIn1 pin conditions are false

ioEvent = Events.CreateIOEvent(Pin.Din.UserIn1, false, false, "OnIoEvent")

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

notifyEvent = Events.CreateNotifyEvent( string eventHandlerFunctionName )

Parameters

eventHandlerFunctionName string The Callback function name

Methods

Close Close the Notify event and release all resources.


Schedule Schedules the event with the given message. Multiple messages can be scheduled without waiting for the previous.

Example
--This program will demonstrate the CreateNotifyEvent method.

--Set the units as Millimeters


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Creates a notify event


event = Events.CreateNotifyEvent("PartCompleted")

function PartCompleted(messageData)
Report("Part #"..messageData.." Completed")
end

for index = 1, 100 do

Image.Circle(0, 0, 25)

--Scheduled the event and pass the index as a parameter


event.Schedule(index)

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

Wait() before scheduling again.

Note:This method is currently supported with the EC1000 and SMC cards only.

Syntax

waitEvent = Events.CreateWaitEvent()

Methods

Close Close the Wait event and release all resources.


Schedule Schedules the event in the marking engine.
Wait Hold execution in the scripting engine.

Return Values

Example
--This program will demonstrates the CreateWaitEvent.

--Millimeters mode is selected


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--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()

--Scans a circle with a radius of 1


Image.Circle(0, 0, 25)
--Schedules the eventOne.
eventOne.Schedule()

Image.Box(-1, -1, 50, 50)


--Schedules the eventTwo.
eventTwo.Schedule()

--Waits until eventOne is notified


eventOne.Wait()

Report("Circle is marked")
--Waits until eventTwo is notified
eventTwo.Wait()

Report("Rectangle is marked")

File
Following functions are supported.

Delete Deletes a file.


OpenBinaryFile Opens a binary file.
OpenTextFile Opens a text file.

Example for SMC


--This program will demonstrate the methods Binary file Open and Read operations

--File location path assigned to location string variable


location = "/mnt/SMC/tmp"
--Opens a binary file name called "binfile" in read-only mode
binaryFile = File.OpenBinaryFile(location.."/binfile.bin", FileMode.Read)
--Gets the current position
pos = binaryFile.Position()
-- Read the file

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 55 of 197

length = binaryFile.Length()

--Check file is at the end


while (not binaryFile.EOF()) do
--Gets the current position
pos = binaryFile.Position()
--Read the byte from the current position
readByte = binaryFile.Read()
--Display the data
Report(readByte)

end
--Close the file
binaryFile.Close()

Example for EC1000


--This program will demonstrate the methods Binary file Open and Read operations

--File location path assigned to location string variable


location = "Disk\\custom"
--Opens a binary file name called "binfile" in read-only mode
binaryFile = File.OpenBinaryFile(location.."\\binfile.bin", FileMode.Read)
--Gets the current position
pos = binaryFile.Position()
-- Read the file
length = binaryFile.Length()

--Check file is at the end


while (not binaryFile.EOF()) do
--Gets the current position
pos = binaryFile.Position()
--Read the byte from the current position
readByte = binaryFile.Read()
--Display the data
Report(readByte)

end
--Close the file
binaryFile.Close()

File Delete
Deletes the specified file.

Syntax

Delete( string path )

Parameters

path string Location of the file.

Return Values

Example for SMC


--This program will demonstrate Open, Read and Delete operations

--File location path assigned to location string variable


location = "/mnt/SMC/tmp"
--Opens a binary file name called "binfile" in read-only mode
binaryFile = File.OpenBinaryFile(location.."/binfile.bin", FileMode.Read)
--Gets the current position
pos = binaryFile.Position()
-- Read the file
length = binaryFile.Length()

--Check file is at the end


while (not binaryFile.EOF()) do

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 56 of 197

--Gets the current position


pos = binaryFile.Position()
--Read the byte from the current position
readByte = binaryFile.Read()
--Display the data
Report(readByte)

end
--Close the file
binaryFile.Close()
--Delete the file
File.Delete("/mnt/SMC/tmp/binfile.bin")

File OpenBinaryFile
Opens the specified binary file.

Syntax

OpenBinaryFile( string path, FileMode mode )

Parameters

path string Location of the binary file.


mode FileMode The mode of operation expected to carryout after opening the file

Methods

Close Close the specified file.


EOF Checks whether the file has reached its end. Returns True when the end of file is reached.
Length Gets the length of the file.
Position Gets the current position of the file stream.
Read Reads
Reads a block of bytes from the file and writes the data into the given array, returns the total number of bytes read into the array. e.g. File.ReadBlock(ByteArray
ReadBlock
array, int count)
ReadToEnd Reads the whole file and return as a ByteArray.
Seek Seeks the file from a location specified by the seekOrigin (Begin, Current, End) at a specified offset.
Write Writes a byte array to the file.

Return Values

Example for SMC


--This program will demonstrate the methods Binary file Open and Read operations

--File location path assigned to location string variable


location = "/mnt/SMC/tmp"
--Opens a binary file name called "binfile" in read-only mode
binaryFile = File.OpenBinaryFile(location.."/binfile.bin", FileMode.Read)
--Gets the current position
pos = binaryFile.Position()
-- Read the file
length = binaryFile.Length()

--Check file is at the end


while (not binaryFile.EOF()) do
--Gets the current position
pos = binaryFile.Position()
--Read the byte from the current position
readByte = binaryFile.Read()
--Display the data
Report(readByte)

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

OpenTextFile( string path, FileMode mode, [Encoding encoding] )


OpenTextFile(string path,string NameOfFile,FileMode mode,[Encoding encoding])

Parameters

path string Location of the binary file.


NameOfFile string Name Of File
mode FileMode The mode of operation expected to carryout after opening the file
encoding Encoding Character encoding for UTF8,Unicode and ANSI.

Methods

Close Close the specified file.


Length Gets the length of the file.
Position Gets the current position of the file stream.
Read Reads the entire file and returns a string.
ReadLine Reads a line from the current position in the file and returns a string.
Seek Seeks the file from a location specified by the seekOrigin (Begin, Current, End) at a specified offset.
Write Writes a string to the specified file.
WriteLine Writes a line of string to the specified file.

Return Values

Returns a reference to the text file.

Example for SMC


--This program will demonstrate the methods text File read-write operation

--Opens a text file named "txtfile" in read-write mode


txtFile = File.OpenTextFile("/mnt/SMC/tmp/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("/mnt/SMC/tmp/txtfile.txt", FileMode.Read, Encoding.UTF8)

--Gets the current position of the file


pos = readFile.Position()
--Gets the length of the file
length = readFile.Length()

--Seek the file from the beginning


readFile.Seek(0,FileSeek.Begin)
--Check file is at the end
while (pos < length) do
--Gets the current position
pos = readFile.Position()
--Read the byte from the current position

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 58 of 197

readValue = readFile.ReadLine()

pos = pos + String.Length(readValue)

--Display the data


Report(readValue.." (Length of the string is "..pos..")")

end

--Close the read file


readFile.Close()

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.

MasterEnable Enable or disable all the interlocks operation.


Enable Enable or disable interlock on the given interlock pin.
AssertOnCurrentFlow Sets the polarity of interlock pin.
SetInterlockHandler Sets the interlock handler function to be called on interlock. The function should accept the interlock name as an argument.

Interlocks AssertOnCurrentFlow
Sets the polarity of the interlock pin defined.

Syntax

AssertOnCurrentFlow( Pin pin, bool enable )

Parameters

pin Pin Interlock pin. e.g. Pin.Din.Interlock1


enable bool Specifies whether the polarity is high or low. High = true, Low = false.

Example
----------- This program will demonstrate the Interlock function

--Millimeter mode selected


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--InterlockHandler function
function InterlockHandler(interlockName)
Report("Interlock triggered. Abort")
System.Abort()
end

--Deactivate interlock operation before setting interlocks


Interlocks.MasterEnable = false
--Enable interlock on the interlock pin1
Interlocks.Enable(Pin.Din.Interlock1, true)
--Sets polarity of interlock pin1 as high
Interlocks.AssertOnCurrentFlow(Pin.Din.Interlock1, true)
-- Setting interlock handler function
Interlocks.SetInterlockHandler(InterlockHandler)
-- Activate interlock operation
Interlocks.MasterEnable = true

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

Enable( Pin pin, bool enable )

Parameters

pin Pin Interlock pin. e.g. Pin.Din.Interlock1


enable bool Specifies whether the polarity is high or low. High = true, Low = false.

Example
----------- This program will demonstrate the Interlock function

--Millimeter mode selected


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--InterlockHandler function
function InterlockHandler(interlockName)
Report("Interlock triggered. Abort")
System.Abort()
end

--Deactivate interlock operation before setting interlocks


Interlocks.MasterEnable = false
--Enable interlock on the interlock pin1
Interlocks.Enable(Pin.Din.Interlock1, true)
--Sets polarity of interlock pin1 as high
Interlocks.AssertOnCurrentFlow(Pin.Din.Interlock1, true)
-- Setting interlock handler function
Interlocks.SetInterlockHandler(InterlockHandler)
-- Activate interlock operation
Interlocks.MasterEnable = true

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

MasterEnable = bool value

Parameters

value bool Enable or disable interlocks. Enable= true

Example

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 60 of 197

----- This program will demonstrate the Interlock function

--Millimeter mode selected


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--InterlockHandler function
function InterlockHandler(interlockName)
Report("Interlock triggered. Abort")
System.Abort()
end

--Deactivate interlock operation before setting interlocks


Interlocks.MasterEnable = false
--Enable interlock on the interlock pin1
Interlocks.Enable(Pin.Din.Interlock1, true)
--Sets polarity of interlock pin1 as high
Interlocks.AssertOnCurrentFlow(Pin.Din.Interlock1, true)
-- Setting interlock handler function
Interlocks.SetInterlockHandler(InterlockHandler)
-- Activate interlock operation
Interlocks.MasterEnable = true

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

SetInterlockHandler( function interlockHandlerFunction(string interlockName) )

Parameters

interlockHandlerFunction function The function to be called when the interlock is triggered

Example
--This program will demonstrate the Interlock function

--Millimeter mode selected


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--InterlockHandler function
function InterlockHandler(interlockName)
Report("Interlock triggered. Abort")
System.Abort()
end

--Deactivate interlock operation before setting interlocks


Interlocks.MasterEnable = false
--Enable interlock on the interlock pin1
Interlocks.Enable(Pin.Din.Interlock1, true)
--Sets polarity of interlock pin1 as high
Interlocks.AssertOnCurrentFlow(Pin.Din.Interlock1, true)
-- Setting interlock handler function
Interlocks.SetInterlockHandler(InterlockHandler)
-- Activate interlock operation
Interlocks.MasterEnable = true

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

Arc Scans an arc according to the given parameters.


Barcode Scans any of the available types of barcodes.
Box Scans a box according to the given parameters.
Circle Scans a circle according to the given parameters.
Dot Scans a dot for a given period of time.
Line Scans a two dimensional line from one point to another.
Line3D Scans a three dimensional line from one point to another.
Polyline3D Scans a three dimensional polyline.
Spiral Scans the spiral object passed as a parameter.
Text Scan the text /arc text passed as a parameter.
MoveTo Moves the galvo to the specified position.

Transform Commands

Rotate Rotates the current transformation matrix by the specified angle.


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 by the specified scale.
Translate Translates the current transformation matrix by the specified offset.
RealtimeTransformEnabled Enables the TranslateRealtime and RotateRealtime commands.
TranslateRealtime Translates the device transformation matrix by the specified offset realtime without going through the instruction buffer.
RotateRealtime Rotates the device transformation matrix by the specified angle realtime without going through the instruction buffer.
ScaleRealtime Scale the device transformation matrix by a specified factor without going through the instruction buffer.
ResetRtTransformMatrix Reset Realtime Transform Matrix.

Example
--This program is used to draw an arc with a radius of 2 and a center point of 0,0

--Set Inches as the Unit


SetUnits(Units.Inches)
--Laser Parameter settings
Laser.JumpSpeed = 250

Laser.MarkSpeed = 150
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Center (0,0), radius 2, start angle 45 and sweep angle 45


Image.Arc(0, 0, 2, 45, 45)

Geometric Commands Image


The following geometric shapes related commands are available in the Image library:

Dot Scans a dot for a given period of time.


Arc Scans an arc according to the specified parameters.
Barcode Scans the barcode passed as a parameter.
Box Scans a box/rectangle according to the given parameters.
Circle Scans a circle according to the given parameters.
Line Marks a two dimensional line from one point to another.
Line 3D Scans a three dimensional line from one point to another.
Polyline 3D Scans a 3D polyline according to the given parameters.
Text Scans the horizontal text/arc text object passed as a parameter.
Spiral Scans the spiral object passed as a parameter.

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

centerX float The x coordinate of the Arc's center


centerY float The y coordinate of the Arc's center
radius float The radius of the Arc
startAngle float The start angle of the Arc
sweepAngle float The sweep angle of the Arc
elevation float The z coordinate of the Arc's center

Example
----- This program is used to draw an arc with a radius of 2 and a center point of 0,0

--Millimeters mode selected


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Center (0,0), radius 2, start angle 45 and sweep angle 45


Image.Arc(0, 0, 50, 45, 45)

Image Barcode
Scans the barcode passed as a parameter.

Syntax

Barcode( Barcode barcodeObj )

Parameters

barcodeObj Barcode Object of type Barcode.

Example
--This program will mark Code93 barcode

--Millimeters mode selected


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Assign Code93 barcode (subtype Code93FullAscii) to "var" variable


var = Barcodes.Code93(Code93.Code93FullAscii)
--barcode height is 0.5

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

lowerLeftX float X coordinate of the lower left corner of the box.


lowerLeftY float Y coordinate of the lower left corner of the box.
width float The width of the box.
height float The height of the box.
angle float The rotational angle that is formed by the bottom of the box with the X axis in current angle units.
elevation float Z coordinate of the lower left corner of the box.

Example
-- This program will draw a rectangle by using the Box command.

--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

--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

Circle( float centerX, float centerY, float radius )


Circle( float centerX, float centerY, float radius, float elevation )
Circle( float centerX, float centerY, float radius, float elevation, float maximumSegmentationError )

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 64 of 197

Parameters

centerX float The x coordinate of the Circle's center.


centerY float The y coordinate of the Circle's center.
radius float The radius of the Circle.
elevation float The z coordinate of the Circle's center

Example
-- This program will draw a circle according to the given parameters

--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

--Circle with center (0,0) and radius 1.


Image.Circle(0, 0, 25)

Image Dot
Scans a dot for a given period of time.

Syntax

Dot( float positionX, float positionY, int duration )


Dot( float positionX, float positionY, int duration, float elevation )

Parameters

positionX float The x coordinate of the dot


positionY float The y coordinate of the dot
duration int Dot duration in microseconds
elevation float The z coordinate of the dot

Example
--This program is used to draw a dot

--Millimeters mode selected


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Scan a dot on the origin (0,0) for 100 microseconds


Image.Dot(0, 0, 100)

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

Line( float X1, float Y1, float X2, float Y2 )

Parameters

X1 float The x coordinate of the line's start point.


Y1 float The y coordinate of the line's start point.
X2 float The x coordinate of the line's end point.
Y2 float The y coordinate of the line's end point.

Example
-- This program will draw a square by using the line command

--Millimeters mode selected


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150

Laser.MarkDelay = 200

--Draws line from (0,0) to (10,0)


Image.Line(0, 0, 10, 0)
--Draws line from (10,0) to (10,10)
Image.Line(1, 0, 10, 10)
--Draws line from (10,10) to (0,10)
Image.Line(10, 10, 0, 10)
--Draws line from (0,10) to (0,0)
Image.Line(0, 10, 0, 0)

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

X1 float The x coordinate of the line's start point.


Y1 float The y coordinate of the line's start point.
Z1 float The z coordinate of the line's start point.
X2 float The x coordinate of the line's end point.
Y2 float The y coordinate of the line's end point.
Z2 float The z coordinate of the line's end point.

Example
-- This program will draw a 3D line by using the line3D command

--Millimeters mode selected


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 66 of 197

Laser.MarkDelay = 200

--Draws a 3D line from (0, 0, 0) to (2, 2, 2)


Image.Line3D(0, 0, 0, 50, 50, 50)

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.

Can specify any number of point arguments (Vertices).

Example
-- This program will draw a 3D polyline

-- 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

--Draws 3D polyline from (0,0,0) to (1,1,0) and to (2,2,2)


Image.Polyline3D(true, 0, 0, 0, 25, 25, 0, 70, 0, 70)

Image Spiral
Scans the spiral object passed as a parameter.

This spiral can be initialized as spiral = Shapes.Spiral().

Syntax

Spiral( Spiral spiral, float maximumSegmentationError )

Parameters

spiral Spiral The spiral object.


maximumSegmentationError float Maximum allowed error from the original curve when scanning

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 67 of 197

Example

-- This program will draw a Spiral

--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

--Creates a spiral shape


spiral = Shapes.Spiral()
--Outer end angle of the spiral in degrees
spiral.Angle = 45
--Spiral center point X coordinate
spiral.CenterX = 0.5
--Spiral center point Y coordinate
spiral.CenterY = -0.5
--spiral is clockwise or not
spiral.Clockwise = true
--Elevation of the Spiral
spiral.Elevation = 0
--Inner radius of the Spiral
spiral.InnerRadius = 6.25
--Number of inner rotations of the spiral
spiral.InnerRotations = 3
--Outer radius of the Spiral
spiral.OuterRadius = 48.0
--Number of outer rotations of the spiral
spiral.OuterRotations = 0
--Direction of the spiral
spiral.Outwards = false
--Pitch of the Spiral
spiral.Pitch = 2.1
--Whether the marking returns back to start of the spiral
spiral.ReturnToStart = false
--Scans the spiral object with a 0.005 segmentation error
Image.Spiral(spiral, 0.015)

Image Text
Scans a horizontal text/arc text object passed as a parameter.

Syntax

Text( Text textObj )

Parameters

textObj Text Object of type Text.

Example
--This program will scan the text "ScanMaster"

--Set 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 = 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

-- Set Inches as the Unit


SetUnits(Units.Millimeters)
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
-- Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

-- Draw a rectangle of height 25 and width of 50


Image.Box(0, 0, 25, 50, 0)
-- Saves the original state
state = Image.SaveTransform()
-- Rotates the rectangle by 45 degrees
Image.Rotate(45)
-- Draw a rectangle of height 25 and width of 50
Image.Box(0, 0, 25, 50, 0)
-- Loads the first state(original state)
Image.LoadTransform(state)
-- Draw a rectangle of height 25 and width of 50
Image.Box(0, 0, 25, 50, 0)

Image MoveTo
Moves the galvo to the specified position.

Syntax

MoveTo( float x, float y, [float z] )

Parameters

x float The x coordinate of the galvos new position

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 69 of 197

y float The y coordinate of the galvos new position


z float The z coordinate of the galvos new position

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

RealtimeTransformEnabled( bool enabled )

Parameters

enabled bool Enable or Disable realtime translation and rotation

Example
---- This program will scan the original and the translated version of "ScanMaster ScanScript" arcText

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Arc text assigned to the variable arcText


arcText = Text.Arc()

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

arcText.Text = "ScanMaster ScanScript"


--Mark the original arc arcText
Image.Text(arcText)

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.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Draw a rectangle of height 25 and width of 50


Image.Box(0, 0, 25, 50, 0)
--Wait until finished
Laser.WaitForEnd()
--Enable the real time transformation commands
Image.RealTimeTransformEnabled(true)
--Enlarge the width by 2 times and the height by 0.5 times
Image.ScaleRealtime(2,0.5)
--Draw a rectangle of height 25 and width of 50
Image.Box(0, 0, 25, 50, 0)
--Reset Realtime Transform Matrix
Image.ResetRtTransformMatrix()
--Draw a rectangle of height 25 and width of 50
Image.Box(0, 0, 25, 50, 0)

Image Rotate
Rotates the current transformation matrix of the device by the given angle.

Syntax

Rotate( float angle )


Rotate( float angle , bool append )

Parameters

angle float The rotation angle (in current angle units).


append bool if true, appends the rotation matrix to the current matrix, else prepends

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

--Draw a rectangle of height 1 and width of 2


Image.Box(0, 0, 25, 50, 0)
--Rotates the rectangle by 45 degrees
Image.Rotate(45)
--Draw a rectangle of height 1 and width of 2
Image.Box(0, 0, 25, 50, 0)

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

RotateRealtime ( float angleInCurrentUnit )

Parameters

angleInCurrentUnit float The rotation angle

Example
-- This program will first draw a rectangle, it will then rotate the rectangle by 45 degrees and scan it.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Draw a rectangle of height 1 and width of 2


Image.Box(0, 0, 25, 50, 0)
--Wait until finished
Laser.WaitForEnd()
--Enable the real time transformation commands
Image.RealTimeTransformEnabled(true)
--Rotates the rectangle by 45 degrees
Image.RotateRealtime(45)
--Draw a rectangle of height 1 and width of 2
Image.Box(0, 0, 25, 50, 0)
--Reset Realtime Transform Matrix
Image.ResetRtTransformMatrix()

Image SaveTransform
Returns the current transformation matrix state of the device.

Syntax

state = Image.SaveTransform()

Return Values

Returns an instance of the transformation state.

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

--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

--Draw a rectangle of height 1 and width of 2


Image.Box(0, 0, 25, 50, 0)
--Saves the original state
state = Image.SaveTransform()
--Rotates the rectangle by 45 degrees
Image.Rotate(45)
--Draw a rectangle of height 1 and width of 2
Image.Box(0, 0, 25, 50, 0)
--Loads the first state(original state)
Image.LoadTransform(state)

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 72 of 197

--Draw a rectangle of height 1 and width of 2


Image.Box(0, 0, 25, 50, 0)

Image Scale
Scales the current transformation matrix of the device.

Syntax

Scale( float scaleX, float scaleY )


Scale( float scaleX, float scaleY ,bool append )

Parameters

scaleX float Scale factor in x direction


scaleY float Scale factor in y direction
append bool If true, appends the scaling matrix to the current matrix, else prepends.

Example
----- This program will scale the Rectangle by a specified factor, and both the scaled and original rectangles will be marked.

--Set units as Millimeters


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--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

ScaleRealtime ( float scaleX, float scaleY )

Parameters

scaleX float Scale factor in x direction


scaleY float Scale factor in y direction

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.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Draw a rectangle of height 25 and width of 50


Image.Box(0, 0, 25, 50, 0)
--Wait until finished
Laser.WaitForEnd()
--Enable the real time transformation commands
Image.RealTimeTransformEnabled(true)
--Enlarge the width by 2 times and the height by 0.5 times
Image.ScaleRealtime(2,0.5)

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 73 of 197

--Draw a rectangle of height 25 and width of 50


Image.Box(0, 0, 25, 50, 0)
--Reset Realtime Transform Matrix
Image.ResetRtTransformMatrix()

Image Translate
Translates the current transformation matrix of the device

Syntax

Translate( float dX, float dY )


Translate( float dX, float dY, float dz )
Translate( float dX, float dY, float dz, bool append )

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

--Set units as Millimeters


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Arc text assigned to the variable arcText


arcText = Text.Arc()
arcText.Radius = 25.4

arcText.Font = "Arial"

arcText.CenterX = 0

arcText.CenterY = 0

arcText.StartAngle = 10

arcText.Height = 2.5

arcText.Elevation = 0

arcText.Align = ArcTextAlign.Baseline

arcText.Text = "ScanMaster ScanScript"


--Mark the original arcText
Image.Text(arcText)
--Translate the arcText
Image.Translate(1, 0.8)
--Mark the translated arcText
Image.Text(arcText)

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

TranslateRealtime ( float dx, float dy, float dz )

Parameters

dX float The distance along the x axis


dY float The distance along the y axis

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 74 of 197

dz float The distance along the z axis

Example
-- This program will scan the original and the translated version of "ScanMaster ScanScript" arcText

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Arc Text assigned to the variable arcText


arcText = Text.Arc()

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

arcText.Text = "ScanMaster ScanScript"


--Mark the original arc arcText
Image.Text(arcText)

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

OpenComPort Opens the specified communication Port.


PreloadJob Loads the job file.
PreloadVectorImage Loads the static vector image file.
ReadPort Returns the state of the port as an integer value.
ReadPin Returns the state of the pin as a boolean value.
WaitForIo Wait for the digital port value to be set.
WriteAnalog Commands the analog output port to a new value.
WriteDigital Commands the digital output port to a new value.

Example
--This program will demonstrate Serial communication (via RS232)

--Open Com2 port


port1 = Io.OpenComPort("Com2:")
------------------Com2 properties---------------------------------
--Set the baud rate as 9600
port1.Baud = Baud.Br9600
--Used no parity condition (Options : None, Odd, Even)
port1.Parity = Parity.None
--Sets the com port 8 data bits (Options : 5,6,7)
port1.Data = 8
--Sets the com port stop bits as 1 (Options: 1, 1.5, 2)
port1.StopBits = 1
--Off the com port flow control
port1.FlowControl = FlowControl.Off
------------------Writing data to the port-------------------------

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)

if(readData == nil) then


--If Com2 does not receive any data then display the "Read Timed out" message
Report("Read Timed out")

else
--Else show the received data
Report("Read Data:"..readData)

end
--Close Com2 port
port1.close()

IO OpenComPort
Opens the specified communication Port.

Syntax

OpenComPort( string portName )

Parameters

portName string port name should be COM1, COM2,

Properties

Baud Baud Baud rate to be use


FlowControl FlowControl Flow control
Parity Parity Parity value
StopBits int Stop bits (Eg: 1, 1.5, 2)
Data int Data bits (Eg: 5,6,7)

Methods

BytesToRead Returns the number of bytes of data in the receive buffer.


Close Close the port.
IsOpened Returns true if Com port is already opened.
Open Opens the comport. If already opened returns an error.
Read Reads the given amount of characters from the port.
ReadBytes Reads the given amount bytes from the port.
Write Writes the given string to the port.
WriteBytes Writes the given byte array to the port.

Example
--This program will demonstrate Serial communication (via RS232)

--Open Com2 port


port1 = Io.OpenComPort("Com2:")
------------------Com2 properties---------------------------------
--Set the baud rate as 9600
port1.Baud = Baud.Br9600
--Used no parity condition (Options : None, Odd, Even)
port1.Parity = Parity.None
--Sets the com port 8 data bits (Options : 5,6,7)
port1.Data = 8
--Sets the com port stop bits as 1 (Options: 1, 1.5, 2)
port1.StopBits = 1
--Off the com port flow control
port1.FlowControl = FlowControl.Off
------------------Writing data to the port-------------------------
--Writes "This is text" string to the port and assign it to the variable length.
length = port1.Write("This is text", 100)
--Display the result
Report("The length of the string is "..length)
------------------Reads data from the port------------------------

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 76 of 197

--Reads the 5 characters from the port


readData = port1.Read(5,5000)

if(readData == nil) then


--If Com2 does not receive any data then display the "Read Timed out" message
Report("Read Timed out")

else
--Else show the received data
Report("Read Data:"..readData)

end
--Close Com2 port
port1.close()

IO PreloadJob
Loads the specified job file.

Syntax

PreloadJob( string jobFileName )

Parameters

jobFileName string The path or the name of the job file.

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

Returns an instance of a job.

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

PreloadVectorImage( string staticVectorImageName )

Parameters

staticVectorImageName string The path or the name of the vector image.

Methods

Execute Execute the preloaded vector image.

Return Values

Returns an instance of a vector image.

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 77 of 197

Example for SMC


--This program will demonstrate loading a vector image and scanning it.

--Set units as Millimeters


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000

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()

Example for EC1000


--This program will demonstrate loading a vector image and scanning it.

--Set units as inches


SetUnits(Units.Inches)
--Laser Parameter settings
Laser.JumpSpeed = 250

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

ReadPin( Pin pin )

Parameters

pin Pin The input or output pin.

Return Values

Returns a boolean value.

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.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150

Laser.MarkDelay = 200

--Assign DataMatrix code to "var" variable


var = Barcodes.DataMatrix()

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)

Report("Part marking Finished")

end

while true do
--Check the sensor output
if (Io.ReadPin(Pin.Din.UserIn1)) then

Report("Accepted the part Start Marking")

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

ReadPort( Port port )

Parameters

port Port The input or output port.

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.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Assign DataMatrix code to "var" variable


var = Barcodes.DataMatrix()

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)

Report("Part marking Finished")

end

while true do
--Check the sensor output
if (Io.ReadPort(port.AuxiliaryIn) > 255) then

Report("Accepted the part Start Marking")

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

WaitForIO( Pin pin, Trigger trigger, int timeoutInMicroSec, int debounceInMilliSec )


WaitForIO( Pin pin, Trigger trigger, int timeoutInMicroSec, int debounceInMilliSec, bool flushImmediate )

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

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Loop runs continuously

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

WriteAnalog( Port port, int value )

Parameters

port Port The specific analog port to write the value.


value Int Port value

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.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Define horizontal text object


lineText = Text.Horizontal()

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)

Report("Part marking Finished")

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

WriteDigital( Port port, int value )

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 81 of 197

WriteDigital( Port port, int value, bool flushImmediate )

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.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Define horizontal text object


lineText = Text.Horizontal()

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)

Report("Part marking Finished")

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

AxisDisable Disables galvo axes on heads


BeamOn Turns the beam on
BeamOff Turns the beam off
BreakAngle Set the break angle
CreateProfile Creates an instance of a laser profile object.
DutyCycle1/DutyCycle2 Set Dutycycle for Channel1 or 2 as a percentage
Frequency Set Laser modulation frequency in Khz
JumpDelay Set the jump delay during marking
JumpSpeed Set the jump speed of the laser in the current unit of measurement
PointerEnable Enables the guide laser pointer
LaserOnDelay Set the laser on delay
LaserOffDelay Set the laser off delay
LaserPipeLineDelay Set the laser pipe line delay.
MarkDelay Set the mark delay
MarkSpeed Set the marking speed in the current unit of measurement
MaxRadialError Set the maximum radial error

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 82 of 197

PointerDisable Disables the guide laser pointer


PolyDelay Set the polygon delay in microseconds
Power Set the power level of the laser as a percentage
PulseWaveform Set the pulse waveform
SetVelocityCompensation Changes the average laser power in real-time based on the simulated velocity of the scanners
Sleep Stops the execution of FPGA commands for a specified period of microseconds.
SetLissajousWobble Sets a Lissajous wobble pattern for wobble function.
Timer Contains methods to accurately measure elapsed time
VariPolyDelayFlag Enables variable polygon delay if value is set to true, or else this option will be disabled
WaitForEnd Blocks the script execution until the laser has finished processing the instructions it has received.
WobbleEnabled Enables or disables the wobble function. Enable "Wobble" to mark thicker lines by Wobbling the laser beam
WobbleMode Set the mode of wobble behavior
WobbleThickness Sets the Wobble thickness in the current unit of measurement
WobbleOverlap Sets the wobble overlap percentage
WobblePeriod Sets the wobble period in micro-seconds in WobbleMode = 2

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

--Millimeters mode is selected


SetUnits(Units.Millimeters)
-- Laser Parameter settings

--Start the timer


Stopwatch.Start()
-----------------Laser Delay control Settings-------------------
--Delay in time before the laser is turned off
Laser.LaserOffDelay = 0
--Delay in time before the laser is turned on when marking relative to micro-vector generation. A negative value means that LaserOn is asserted before micro
Laser.LaserOnDelay = 0
--Set the time that all laser signals are time shifted relative to the issuance of galvo position commands.
Laser.LaserPipelineDelay = 3200
-----------------Laser Motion Delay Setting--------------
--Set the delay in time at the end of a laser jump
Laser.JumpDelay = 100
--Set the delay in time at the end of a series of marks
Laser.MarkDelay = 100
--Set the delay in time at the junction of two marks
Laser.PolyDelay = 0
--Variable polygon delay disabled. (true = enabled, false = disabled)
Laser.VariPolyDelayFlag = false
----------------Laser Marking Settings------------------
--Set Laser Modulation frequency
Laser.Frequency = 6
--Set laser jump speed in inch/sec
Laser.JumpSpeed = 2500
--Set Laser Marking speed in inch/sec
Laser.MarkSpeed = 1500
--Set channel 1 duty cycle as a percentage
Laser.Dutycycle1 = 0

--Draw a box with a width and height of 1 Cm


Image.Box(0, 0, 10, 10, 0)

--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

Laser.AxisDisable( int head1Axes, int head2Axes )

Parameters

head1Axes int Axes of the head one


head2Axes int Axes of the head two

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

--Set the units as Millimeters


SetUnits(Units.Millimeters)
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100
Laser.MarkDelay = 100

--Open the Com3 port


port1 = Io.OpenComPort("Com3:")
--Set the baud rate as 9600
port1.Baud = Baud.Br9600
--Used noparity condition (Options : None, Odd, Even)
port1.Parity = Parity.None
--Sets the com port to 8 data bits (Options : 5,6,7)
port1.Data = 8
--Sets the com port stop bits as 1 (Options: 1, 1.5, 2)
--Off the com port flow control
port1.FlowControl = FlowControl.Off

function xytableMove(xValue, yValue)


port1.Write(xValue.." "..yValue, 100)
end

--Sets table position


tableX = 15
tableY = 10
for i = 1,10 do
--Laser beam on
Laser.BeamOn()
--Moves the table (cutting operation)
xytableMove(tableX, tableY)
Sleep(1000)
Laser.WaitForEnd()
--Laser beam off
Laser.BeamOff()
--Table is brought back to the home position
xytableMove(0,0)
end
port1.Close()

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

--Set the units as Millimeters


SetUnits(Units.Millimeters)
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 84 of 197

Laser.JumpDelay = 100
Laser.MarkDelay = 100

--Open the Com3 port


port1 = Io.OpenComPort("Com3:")
--Set the baud rate as 9600
port1.Baud = Baud.Br9600
--Used noparity condition (Options : None, Odd, Even)
port1.Parity = Parity.None
--Sets the com port to 8 data bits (Options : 5,6,7)
port1.Data = 8
--Sets the com port stop bits as 1 (Options: 1, 1.5, 2)
--Off the com port flow control
port1.FlowControl = FlowControl.Off

function xytableMove(xValue, yValue)


port1.Write(xValue.." "..yValue, 100)
end

--Sets table position


tableX = 10.5
tableY = 10
for i = 1,10 do
--Laser beam on
Laser.BeamOn()
--Moves the table (cutting operation)
xytableMove(tableX, tableY)
Sleep(1000)
Laser.WaitForEnd()
--Laser beam off
Laser.BeamOff()
--Table is brought back to the home position
xytableMove(0,0)
end
port1.Close()

Laser BreakAngle
Sets the Break Angle.

Syntax

BreakAngle = float value

Parameters

value float The break angle in the specified unit.

Example

--This program demonstrates how to set the break angle.

--Set the units as Millimeters


SetUnits(Units.Millimeters)
--Sets the break angle
Laser.BreakAngle = 30

--Draw a box with a width and height of 1 Millimeters


Image.Box(0, 0, 25.4, 25.4, 0)

--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

--Millimeters mode is selected


SetUnits(Units.Millimeters)
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100
Laser.MarkDelay = 100

--Set 50% Duty cycle for Channel 1


Laser.DutyCycle1 = 50
--Scans a rectangle with a width of 1 and a height of 2
Image.Box(0, 0, 25, 50, 0)
--Set 10% Duty cycle for channel 1
Laser.Dutycycle1 = 10
--Scans a circle with a radius of 1
Image.Circle(0, 0, 25)
--Set 80% Duty cycle for Channel 2
Laser.Dutycycle2 = 80
--Scans an arc with a center of (0,0), radius 2, start angle 45 and sweep angle 45
Image.Arc(0, 0, 50, 45, 45)

Laser Frequency
Set the laser modulation frequency in KHz.

Syntax

Frequency = int value (Laser modulation frequency in KHz)

Example
--This program will mark a Circle and a Box with the different Modulation frequencies.

--Millimeters mode is selected


SetUnits(Units.Millimeters)
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100
Laser.MarkDelay = 100
--Sets laser modulation frequency as 10 kHz
Laser.Frequency = 10

--Draws a 25 Millimeters radius circle with 10kHz frequency


Image.Circle(0, 0, 25)
--Sets laser modulation frequency as 20 kHz
Laser.Frequency = 20
--Draws a rectangle with a 20kHz frequency
Image.Box(-12.5, -12.5, 50, 25, 30)

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

JumpDelay = int value (Jump delay in microseconds.)

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

--Set the units as Millimeters


SetUnits(Units.Millimeters)
--Start the timer
Stopwatch.Start()
-----------------Laser Delay control Settings-------------------
--Delay in time before the laser is turned off
Laser.LaserOffDelay = 0
--Delay in time before the laser is turned on when marking relative to micro-vector generation. A negative value means that LASERON is asserted before micro
Laser.LaserOnDelay = 0
--Set the time that all laser signals are time shifted relative to the issuance of galvo position commands.
Laser.LaserPipelineDelay = 3200
-----------------Laser Motion Delay Setting--------------
--Set the delay in time at the end of a laser jump
Laser.JumpDelay = 60
--Set the delay in time at the end of a series of marks
Laser.MarkDelay = 60
--Set the delay in time at the junction of two marks
Laser.PolyDelay = 0
--Variable polygon delay disabled. (true = enabled, false = disabled)
Laser.VariPolyDelayFlag = false
----------------Laser Marking Settings------------------
--Set Laser Modulation frequency
Laser.Frequency = 6
--Set laser jump speed in mm/sec
Laser.JumpSpeed = 250
--Set Laser Marking speed in mm/sec
Laser.MarkSpeed = 150
--Set channel 1 duty cycle as a percentage
Laser.Dutycycle1 = 50

--Draw a box with a width and height of 25 Millimeters


Image.Box(0, 0, 25, 25, 0)

--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

JumpSpeed = int value

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

--Set the units as Millimeters


SetUnits(Units.Millimeters)
--Start the timer
Stopwatch.Start()
-----------------Laser Delay control Settings-------------------
--Delay in time before the laser is turned off
Laser.LaserOffDelay = 0
--Delay in time before the laser is turned on when marking relative to micro-vector generation. A negative value means that LASERON is asserted before micro
Laser.LaserOnDelay = 0
--Set the time that all laser signals are time shifted relative to the issuance of galvo position commands.
Laser.LaserPipelineDelay = 3200
-----------------Laser Motion Delay Setting--------------
--Set the delay in time at the end of a laser jump
Laser.JumpDelay = 60
--Set the delay in time at the end of a series of marks
Laser.MarkDelay = 60
--Set the delay in time at the junction of two marks
Laser.PolyDelay = 0
--Variable polygon delay disabled. (true = enabled, false = disabled)
Laser.VariPolyDelayFlag = false
----------------Laser Marking Settings------------------
--Set Laser Modulation frequency
Laser.Frequency = 6
--Set laser jump speed in mm/sec
Laser.JumpSpeed = 250
--Set Laser Marking speed in mm/sec
Laser.MarkSpeed = 150
--Set channel 1 duty cycle as a percentage
Laser.Dutycycle1 = 50

--Draw a box with a width and height of 25 mm


Image.Box(0, 0, 25, 25, 0)

--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

LaserOffDelay = int value (Laser off delay time in microseconds.)

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

--Set the units as Millimeters


SetUnits(Units.Millimeters)
--Start the timer
Stopwatch.Start()
-----------------Laser Delay control Settings-------------------
--Delay in time before the laser is turned off
Laser.LaserOffDelay = 0
--Delay in time before the laser is turned on when marking relative to micro-vector generation. A negative value means that LASERON is asserted before micro
Laser.LaserOnDelay = 0
--Set the time that all laser signals are time shifted relative to the issuance of galvo position commands.
Laser.LaserPipelineDelay = 3200
-----------------Laser Motion Delay Setting--------------
--Set the delay in time at the end of a laser jump
Laser.JumpDelay = 60
--Set the delay in time at the end of a series of marks
Laser.MarkDelay = 60
--Set the delay in time at the junction of two marks
Laser.PolyDelay = 0
--Variable polygon delay disabled. (true = enabled, false = disabled)
Laser.VariPolyDelayFlag = false
----------------Laser Marking Settings------------------
--Set Laser Modulation frequency
Laser.Frequency = 6
--Set laser jump speed in mm/sec
Laser.JumpSpeed = 250
--Set Laser Marking speed in mm/sec
Laser.MarkSpeed = 150
--Set channel 1 duty cycle as a percentage
Laser.Dutycycle1 = 50

--Draw a box with a width and height of 25 Millimeters


Image.Box(0, 0, 25, 25, 0)

--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

LaserOnDelay = int value (Laser on delay time in microseconds.)

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

--Set the units as Millimeters


SetUnits(Units.Millimeters)
Stopwatch.Start()--Start the timer
-----------------Laser Delay control Settings-------------------
--Delay in time before the laser is turned off
Laser.LaserOffDelay = 0
--Delay in time before the laser is turned on when marking relative to micro-vector generation. A negative value means that LASERON is asserted before micro
Laser.LaserOnDelay = 0
--Set the time that all laser signals are time shifted relative to the issuance of galvo position commands.
Laser.LaserPipelineDelay = 3200
-----------------Laser Motion Delay Setting--------------
--Set the delay in time at the end of a laser jump
Laser.JumpDelay = 60
--Set the delay in time at the end of a series of marks
Laser.MarkDelay = 60
--Set the delay in time at the junction of two marks
Laser.PolyDelay = 0
--Variable polygon delay disabled. (true = enabled, false = disabled)
Laser.VariPolyDelayFlag = false
----------------Laser Marking Settings------------------
--Set Laser Modulation frequency
Laser.Frequency = 6
--Set laser jump speed in mm/sec
Laser.JumpSpeed = 250
--Set Laser Marking speed in mm/sec
Laser.MarkSpeed = 150
--Set channel 1 duty cycle as a percentage
Laser.Dutycycle1 = 50

--Draw a box with a width and height of 1 Millimeters


Image.Box(0, 0, 25, 25, 0)

--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

LaserPipeLineDelay = int value (Laser Pipeline Delay time in microseconds.)

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

--Set the units as Millimeters


SetUnits(Units.Millimeters)
--Start the timer
Stopwatch.Start()
-----------------Laser Delay control Settings-------------------
--Delay in time before the laser is turned off
Laser.LaserOffDelay = 0
--Delay in time before the laser is turned on when marking relative to micro-vector generation. A negative value means that LASERON is asserted before micro
Laser.LaserOnDelay = 0
--Set the time that all laser signals are time shifted relative to the issuance of galvo position commands.
Laser.LaserPipelineDelay = 3200
-----------------Laser Motion Delay Setting--------------
--Set the delay in time at the end of a laser jump
Laser.JumpDelay = 60
--Set the delay in time at the end of a series of marks
Laser.MarkDelay = 60
--Set the delay in time at the junction of two marks
Laser.PolyDelay = 0
--Variable polygon delay disabled. (true = enabled, false = disabled)
Laser.VariPolyDelayFlag = false
----------------Laser Marking Settings------------------
--Set Laser Modulation frequency
Laser.Frequency = 6
--Set laser jump speed in mm/sec
Laser.JumpSpeed = 250
--Set Laser Marking speed in mm/sec
Laser.MarkSpeed = 150
--Set channel 1 duty cycle as a percentage
Laser.Dutycycle1 = 50

--Draw a box with a width and height of 25 mm


Image.Box(0, 0, 25, 25, 0)

--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

MarkDelay = int value (Laser marking delay time in microseconds.)

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

--Set the units as Millimeters


SetUnits(Units.Millimeters)

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 91 of 197

--Start the timer


Stopwatch.Start()
-----------------Laser Delay control Settings-------------------
--Delay in time before the laser is turned off
Laser.LaserOffDelay = 0
--Delay in time before the laser is turned on when marking relative to micro-vector generation. A negative value means that LASERON is asserted before micro
Laser.LaserOnDelay = 0
--Set the time that all laser signals are time shifted relative to the issuance of galvo position commands.
Laser.LaserPipelineDelay = 3200
-----------------Laser Motion Delay Setting--------------
--Set the delay in time at the end of a laser jump
Laser.JumpDelay = 60
--Set the delay in time at the end of a series of marks
Laser.MarkDelay = 60
--Set the delay in time at the junction of two marks
Laser.PolyDelay = 0
--Variable polygon delay disabled. (true = enabled, false = disabled)
Laser.VariPolyDelayFlag = false
----------------Laser Marking Settings------------------
--Set Laser Modulation frequency
Laser.Frequency = 6
--Set laser jump speed in mm/sec
Laser.JumpSpeed = 250
--Set Laser Marking speed in mm/sec
Laser.MarkSpeed = 150
--Set channel 1 duty cycle as a percentage
Laser.Dutycycle1 = 50

--Draw a box with a width and height of 25 Millimeters


Image.Box(0, 0, 25, 25, 0)

--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

MarkSpeed = int value (Marking speed in current units.)

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

--Set the units as Millimeters


SetUnits(Units.Millimeters)
--Start the timer
Stopwatch.Start()
-----------------Laser Delay control Settings-------------------
--Delay in time before the laser is turned off
Laser.LaserOffDelay = 0
--Delay in time before the laser is turned on when marking relative to micro-vector generation. A negative value means that LASERON is asserted before micro
Laser.LaserOnDelay = 0
--Set the time that all laser signals are time shifted relative to the issuance of galvo position commands.
Laser.LaserPipelineDelay = 3200
-----------------Laser Motion Delay Setting--------------
--Set the delay in time at the end of a laser jump
Laser.JumpDelay = 60
--Set the delay in time at the end of a series of marks
Laser.MarkDelay = 60
--Set the delay in time at the junction of two marks
Laser.PolyDelay = 0
--Variable polygon delay disabled. (true = enabled, false = disabled)
Laser.VariPolyDelayFlag = false
----------------Laser Marking Settings------------------
--Set Laser Modulation frequency
Laser.Frequency = 6
--Set laser jump speed in mm/sec
Laser.JumpSpeed = 250
--Set Laser Marking speed in mm/sec
Laser.MarkSpeed = 150
--Set channel 1 duty cycle as a percentage
Laser.Dutycycle1 = 50

--Draw a box with a width and height of 25 Millimeters

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 92 of 197

Image.Box(0, 0, 25, 25, 0)

--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.

--Set the units as Millimeters


SetUnits(Units.Millimeters)
--Sets the maximum radial error
Laser.MaxRadialError = 0.5

--Draw a box with a width and height of 25 Millimeters


Image.Box(0, 0, 25, 25, 0)

--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.

--Set the units as Millimeters


SetUnits(Units.Millimeters)

-- Laser Parameter settings


Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100
Laser.MarkDelay = 100

Laser.PointerEnable()--Enable the Laser Pointer


for i = 0,10 do
Image.Circle(0,0,25)
end
Laser.PointerDisable()--Disable 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

--Set the units as Millimeters


SetUnits(Units.Millimeters)

-- Laser Parameter settings


Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100
Laser.MarkDelay = 100

Laser.PointerEnable() --Enable the laser pointer


for i = 0,10 do
Image.Circle(0,0,25)
end
Laser.PointerDisable()--Disable the 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

PolyDelay = int value (Polygon delay in microseconds)

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

--Set the units as Millimeters


SetUnits(Units.Millimeters)
--Start the timer
Stopwatch.Start()
-----------------Laser Delay control Settings-------------------
--Delay in time before the laser is turned off
Laser.LaserOffDelay = 0
--Delay in time before the laser is turned on when marking relative to micro-vector generation. A negative value means that LASERON is asserted before micro
Laser.LaserOnDelay = 0
--Set the time that all laser signals are time shifted relative to the issuance of galvo position commands.
Laser.LaserPipelineDelay = 3200
-----------------Laser Motion Delay Setting--------------
--Set the delay in time at the end of a laser jump
Laser.JumpDelay = 60
--Set the delay in time at the end of a series of marks
Laser.MarkDelay = 60
--Set the delay in time at the junction of two marks
Laser.PolyDelay = 0
--Variable polygon delay disabled. (true = enabled, false = disabled)
Laser.VariPolyDelayFlag = false
----------------Laser Marking Settings------------------

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 94 of 197

--Set Laser Modulation frequency


Laser.Frequency = 6
--Set laser jump speed in mm/sec
Laser.JumpSpeed = 250
--Set Laser Marking speed in mm/sec
Laser.MarkSpeed = 150
--Set channel 1 duty cycle as a percentage
Laser.Dutycycle1 = 50

--Draw a box with a width and height of 25 Millimeters


Image.Box(0, 0, 25, 25, 0)

--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

Power = int value (Laser power as a percentage)

Example

----This program will mark a rectangle and a circle, with different power levels.

--Millimeters mode is selected


SetUnits(Units.Millimeters)
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100
Laser.MarkDelay = 100

--Set Laser power to 50%


Laser.Power = 50
--Scan a rectangle with a width and height of 1 and 2 with a power level of 50%
Image.Box(0, 0, 25, 50, 0)
--Set Laser power to 20%
Laser.Power = 20
--Scan a circle by applying a 20% power level.
Image.Circle(0, 0, 50)

Laser PulseWaveform
Sets the pulse waveform of the laser. This is required only for SPI lasers.

The pulse waveform value is assigned to digital port of the controller.

Syntax

Laser.PulseWaveform = int value (The pulse waveform in the specified unit)

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

SetVelocityCompensation( VelocityCompensation velocityCompensation, int limit, int aggressiveness )

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

-- Set Millimeters as the Unit


SetUnits(Units.Millimeters)
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100
Laser.MarkDelay = 100

--Set Velocity Compensation


Laser.SetVelocityCompensation(VelocityCompensation.Dutycycle, 10, 800)
--Draws 3D polyline from (0,0,0) to (1,1,0) and to (2,2,2)
Image.Polyline3D(true, 0, 0, 0, 25, 25, 0, 50, 50, 50)

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

Note: Calling SetLissajousWobble with no arguments disables this function.

Example
--This program marks a Square inside a square with Lissajous wobble pattern enabled and disabled

-- Set the units as mm


SetUnits(Units.Millimeters)

-- Laser Parameter settings


Laser.JumpSpeed = 1000
Laser.MarkSpeed = 500
-- Delay settings
Laser.JumpDelay = 200
Laser.MarkDelay = 200

-- Set the wobble thickness in mm for x axis direction


wbtknsx = 0.25

-- Set the wobble thickness in mm for y axis direction


wbtknsy = 0.25

-- Set the X axis frequency in KHz


hzx = 2.5

-- Set the Y axis frequency in KHz


hzy = 3.0

-- Set the phase relationship in X & Y patterns in degrees


ph = 90

-- Set the Lissajous wobble pattern


Laser.SetLissajousWobble(wbtknsx,wbtknsy,hzx,hzy,ph)

System.SetGalvoCmdMarker()
-- Scans a square
Image.Box(0, 0, 30, 30, 0)

-- Disable Lissajous wobble pattern


Laser.SetLissajousWobble()

-- Scans a square inside


Image.Box(10, 10, 10, 10, 0)

Laser Sleep
Put the laser on stand by mode for a given amount of time in microseconds.

Syntax

Sleep( int sleepTime )

Parameters

sleepTime int Sleep time in microseconds.

Example
-----This Example describes marking with serial numbers. Using the Sleep command a delay is introduced to the loop.

--Set the units as Millimeters


SetUnits(Units.Millimeters)
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100
Laser.MarkDelay = 100

--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

Pause Pause the timer


Resume Resume the timer
Start Starts the timer
Stop Stops the timer
Time Gets the recorded time in milliseconds. To get the recorded time you must first stop the timer.

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

--Set the units as Millimeters


SetUnits(Units.Millimeters)
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100
Laser.MarkDelay = 100

--Creates a Ring Text object


arcText = Text.Arc()

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

arcText.Text = "ScanMaster ScanScript"

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

--Set the units as Millimeters


SetUnits(Units.Millimeters)
--Start the timer
Stopwatch.Start()
-----------------Laser Delay control Settings-------------------
--Delay in time before the laser is turned off
Laser.LaserOffDelay = 0
--Delay in time before the laser is turned on when marking relative to micro-vector generation. A negative value means that LASERON is asserted before micro
Laser.LaserOnDelay = 0
--Set the time that all laser signals are time shifted relative to the issuance of galvo position commands.
Laser.LaserPipelineDelay = 3200
-----------------Laser Motion Delay Setting--------------
--Set the delay in time at the end of a laser jump
Laser.JumpDelay = 60
--Set the delay in time at the end of a series of marks
Laser.MarkDelay = 60
--Set the delay in time at the junction of two marks
Laser.PolyDelay = 0
--Variable polygon delay disabled. (true = enabled, false = disabled)
Laser.VariPolyDelayFlag = false
----------------Laser Marking Settings------------------
--Set Laser Modulation frequency
Laser.Frequency = 6
--Set laser jump speed in mm/sec
Laser.JumpSpeed = 250
--Set Laser Marking speed in mm/sec

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

--Draw a box with a width and height of 25 Millimeters


Image.Box(0, 0, 25, 25, 0)

--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

--Set the units as Millimeters


SetUnits(Units.Millimeters)
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100
Laser.MarkDelay = 100

--Starts Stop Watch


StopWatch.Start()
--Assigns Datamatrix to "var" variable
var = Barcodes.DataMatrix()
--Barcode height is 12.5
var.Height = 12.5
--Matrix size is 16x16
var.MatrixSize = DataMatrixSize.S16x16
--Dot hatch style is used (Options:horizontal,VerticalSerpentine,helix)
var.HatchStyle = Hatchstyle.Dot
--Dot duration is 10000
var.DotDuration = 10000
--Options: default,industry,macro_05,macro_06
var.Format = DataMatrixFormat.Industry
--Initializes the count variable
count = 0
--While loop starts. loop runs 10 times
while count < 10 do
--Sets text for datamatrix
var.Text = "Serial"..count
--Marks datamatrix barcode
Image.Barcode(var)
--Increments the count by 1
count = count + 1
--Introduces the delay between each marking
Sleep(1000)
--End of Loop
end
--Waits until finshed
Laser.WaitForEnd()
-- Displays the "Marking Completed" message and next line shows the marking time in milliseconds
Report("Marking Complete ".."Marking Time:"..StopWatch.Time().. "ms")

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

Laser.WobbleEnabled = bool value (Enables/disables wobble if value is set to true/false)

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.

--Millimeters mode is selected


SetUnits(Units.Millimeters)
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100
Laser.MarkDelay = 100

--0.1 Millimeters wobble thickness (line width)


Laser.WobbleThickness = 0.1
--Enable Wobble
Laser.WobbleEnabled = true
--Wobble overlap percentage is 80%
Laser.WobbleOverlap = 80
--Scans a rectangle with a width of 1 and a height of 2
Image.Box(0, 0, 25, 50, 0)
--Disable Wobble
Laser.WobbleEnabled = false
--Draw a circle without line width
Image.Circle(0, 0, 25)

Laser WobbleMode
Sets the wobble mode. Use the WobbleMode enumeration to choose the desired wobble mode.

Syntax

Laser.WobbleMode = int [WobbleMode]

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.

--Millimeters mode is selected


SetUnits(Units.Millimeters)
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100
Laser.MarkDelay = 100

--0.1 Millimeters wobble thickness (line width)


Laser.WobbleThickness = 0.1
--Set the Wobble mode to constant period
Laser.WobbleMode = 2
--Specify the wobble period in usec
Laser.WobblePeriod = 1000
--Enable Wobble
Laser.WobbleEnabled = true
--Scans a rectangle with a width of 1 and a height of 2
Image.Box(0, 0, 25, 50, 0)
--Disable Wobble
Laser.WobbleEnabled = false

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 101 of 197

--Draw a circle without wobble


Image.Circle(0, 0, 25)

Laser WobbleOverlap
Sets the wobble overlap percentage.

Syntax

Laser.WobbleOverlap = int value (Wobble overlap as a percentage)

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.

--Millimeters mode is selected


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--0.1 Millimeters wobble thickness (line width)


Laser.WobbleThickness = 0.1
--Enable Wobble
Laser.WobbleEnabled = true
--Wobble overlap percentage is 80%
Laser.WobbleOverlap = 80
--Scans a rectangle with a width of 1 and a height of 2
Image.Box(0, 0, 25, 50, 0)
--Disable Wobble
Laser.WobbleEnabled = false
--Draw a circle without line width
Image.Circle(0, 0, 25)

Laser WobblePeriod
Sets the wobble period when Laser.WobbleMode = 2 is selected.

Syntax

Laser.WobblePeriod = int value (Wobble period in micro-seconds)

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.

--Millimeters mode is selected


SetUnits(Units.Millimeters)
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100
Laser.MarkDelay = 100

--0.1 Millimeters wobble thickness (line width)


Laser.WobbleThickness = 0.1
--Set the Wobble mode to constant period
Laser.WobbleMode = 2
--Specify the wobble period in usec
Laser.WobblePeriod = 1000
--Enable Wobble
Laser.WobbleEnabled = true
--Scans a rectangle with a width of 1 and a height of 2

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 102 of 197

Image.Box(0, 0, 25, 50, 0)


--Disable Wobble
Laser.WobbleEnabled = false
--Draw a circle without wobble
Image.Circle(0, 0, 25)

Laser WobbleThickness
Sets the Wobble thickness. Thickness of a line is determined by the value given for Wobble Thickness.

Syntax

Laser.WobbleThickness = int value (Wobble thickness in the specified unit of measurement)

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.

--Millimeters mode is selected


SetUnits(Units.Millimeters)
-- Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 100
Laser.MarkDelay = 100

--0.1 Millimeters wobble thickness (line width)


Laser.WobbleThickness = 0.1
--Enable Wobble
Laser.WobbleEnabled = true
--Wobble overlap percentage is 80%
Laser.WobbleOverlap = 80
--Scans a rectangle with a width of 1 and a height of 2
Image.Box(0, 0, 25, 50, 0)
--Disable Wobble
Laser.WobbleEnabled = false
--Draw a circle without line width
Image.Circle(0, 0, 25)

Motion

GetCurrentPosition Get current position of a motor.


GetMotionStatus Get motion status of a motor.
MoveAbsolute Move a motor to specifc position.
MoveRelative Move reltative a motor.
SetCurrentPosition Set current postion.
SetMoveParams Set some configurations for motor.
Stop Stop motor when executed.
WaitForMotion Waits until motor stops.

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

Motion.GetCurrentPosition( string friendly name )


Motion.GetCurrentPosition( int channel )

Parameters

Friendly Name string Friendly name assigned to a motor


channel int Channel no of a motor

Return Values

Returns location of a motor.

Example
--This program will demonstrate the Motion.GetCurrentPosition method

--Get Current Position


--Channel 0 with Friendly Name X
location = Motion.GetCurrentPosition(0)
--location = Motion.GetCurrentPosition(X)
Report(location)

Motion GetMotionStatus
Gets the status of the motion of a given motor. Returns 1 or 0 to indicate the movement of the motor.

Syntax

Motion.GetMotionStatus( string friendly name )


Motion.GetMotionStatus( int channel )

Parameters

Friendly Name string Friendly name assigned to a motor


channel int Channel no of a motor

Return Values

1 if Moving , 0 if Stoped

Example
--This program will demonstrate the Motion.GetMotionStatus method

--Get Motion Status


--Channel 0 with Friendly Name X
status = Motion.GetMotionStatus(0)
--status = Motion.GetMotionStatus(X)
--Return Motion Status. (1) Moving - (0) Stop
Report(status)

Motion MoveAbsolute
Moves a given motor to a specific location.

Syntax

Motion.MoveAbsolute( string friendly name, float position, [ bool waitForMotion] )


Motion.MoveAbsolute( int channel, float position, [ bool waitForMotion] )

Parameters

Friendly Name string Friendly name assigned to a motor


channel int Channel no of a motor
Position float Final move to Position of the motor
waitForMotion bool Blocks the script until the motion completes. "False" by default.

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

--Channel 0 with Friendly Name X


--Location = 0
--If Position is less than 0, a motor will move to home position (HomeOffSet).
Motion.MoveAbsolute(0,0)
--Motion.MoveAbsolute(X,0,true)
--Motion.MoveAbsolute(X,0,false)

Motion MoveRelative
Moves a given motor to a relative position.

Syntax

Motion.MoveRelative( string friendly name, float distance, [ bool waitForMotion] )


Motion.MoveRelative( int channel, float distance, [ bool waitForMotion] )

Parameters

Friendly Name string Friendly name assigned to a motor


channel int Channel no of a motor
Distance float Distance to move from the present position of the motor (+) Move forward / (-) Move backward
waitForMotion bool Blocks the script until the motion completes. "False" by default.

Return Values

Example
--This program will demonstrate the Motion.MoveRelative method

--Channel 0 with Friendly Name X


--Distance to travel = 20
Motion.MoveRelative(0,20)
--Motion.MoveRelative(X,20,true)
--Motion.MoveRelative(X,20,false)

Motion SetCurrentPosition
Sets the current position of the motor.

Syntax

Motion.SetCurrentPosition( string friendly name, float position )


Motion.SetCurrentPosition( int channel, float position )

Parameters

Friendly Name string Friendly name assigned to a motor


channel int Channel no of a motor
position float Current position to set

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

--Channel 0 with Friendly Name X


--Set/Override current position of a motor
Motion.SetCurrentPosition(0,0)
--Motion.SetCurrentPosition(X,0)

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

Friendly Name string Friendly name assigned to a motor


channel int Channel no of a motor
Velocity float Maximum velocity in milimeter(s).
Accelerate float The acceleration in milimeter(s) per sec².
De-accelerate float The de-acceleration in milimeter(s) per sec².

Return Values

Example
--This program will demonstrate the Motion.SetMoveParams method

--Set configurations for a motion


--Channel 0 with Friendly Name X
--Maximum Velocity = 20 mm/s
--Accelerate = 500 mm/s².
--De-accelerate interval = 500 mm/s².
Motion.SetMoveParams(0,20,500,500)
--Motion.SetMoveParams(X,20,500,500)

Motion Stop
Stops a motion command executed on a given motor.

Syntax

Motion.Stop( string friendly name )


Motion.Stop( int channel )

Parameters

Friendly Name string Friendly name assigned to a motor


channel int Channel no of a motor

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

Motion.WaitForMotion( string friendly name )


Motion.WaitForMotion( int channel )

Parameters

Friendly Name string Friendly name assigned to a motor


channel int Channel no of a motor

Return Values

Example
--This program will demonstrate the Motion.WaitForMotion method

--Wait for motor until it stops


--Channel 0 with Friendly Name X
Motion.WaitForMotion(0)
--Motion.WaitForMotion(X)

Math

Abs Returns the absolute number of the specified number


Acos Returns the angle whose cosine is the specified number
Asin Returns the angle whose sine is the specified number
Atan Returns the angle whose tangent is the specified number
Atan2 Return the angle whose tangent is the quotient of the two specified numbers
Ceil Returns the smallest integer larger than or equal to specified number
Cos Returns the cos value of the passed
Deg Converts radians in to degrees
Exp Returns e raised to the specified power
Floor Returns the largest integer less than or equal to specified number
Fmod Returns the remainder of the division of x by y that rounds the quotient towards zero
Log10 Return the base 10 logarithm of a given number.
Log Returns the natural (base e) logarithm of the specified number
Max Return the maximum value
Min Return the minimum value
PI Ratio of the circumference of a circle to its diameter, specified by the constant, PI.
Pow Returns the specified number raised to specified power
Rad Convert degrees to radians
Random Returns a random value.
Round Changes any given number to the nearest round number
Sin Return the sine value for a given value in radians or degrees
Sqrt Return the square root of a given number
Tan Returns the tan value of the angle passed

Math Abs
Return the absolute number of a given value.

Syntax

Abs ( float val )

Parameters

val float Absolute value.

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.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--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

Acos ( float val )

Parameters

val float A number representing a cosine.

Return Values

Returns the angle whose cosine is the specified.

Example
------ This will draw the rectangle and calculate the angle in the hypotenuse by applying trigonometric functions.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Set angle units
SetAngleUnits(AngleUnits.Radians)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Assign height as 33.2 inch


height = 33.2
--Assign width as 63.5 inch
width = 63.5
--Draw box according to the parameters assigned
Image.Box(0, 0, width, height, 0)
--Calculate hypotenuse using the Pythagoras method
hypotenuse = Math.Sqrt(Math.Pow(height,2) + Math.Pow(width,2))
--Display the distance
Report("Hypotenuse distance is "..hypotenuse)
--Calculate the angle theta (inverse of tan) in radians
theta = Math.Atan(height/width)
--Display the theta value
Report("Angle theta is "..theta.." in radians")
--Calculate the angle alpha (inverse of cosine) in radians
alpha = Math.Acos(height/hypotenuse)
--Display alpha angle
Report("Angle alpha is "..alpha.." in radians")
--Display the theta angle by converting to degree.
Report("Angle theta is".. Math.Deg(theta).." in degrees")

Math Asin

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 108 of 197

Returns the angle whose sine is the specified number.

Syntax

Asin ( float val )

Parameters

val float A number representing a sine.

Return Values

An angle, measured in radians or degrees depending on the current angle unit.

Example
----This program will generate random numbers and calculate the angle (radians and degrees) by using the Math.Asin function.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Set angle units
SetAngleUnits(AngleUnits.Radians)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Generate random number between 0 and 1


randomNum = Math.Random()
--Display the generated number
Report("Random Number is "..randomNum)
--Calculate angle value by using sine inverse
anglerad = Math.Asin(randomNum)
--Display the angle in radians
Report("Angle is "..anglerad.." radians")
--Display the angle in degrees
Report("Angle is "..Math.Deg(anglerad).." degrees")

Math Atan
Returns the angle whose tangent is the specified number.

Syntax

Atan ( float value )

Parameters

value float The quotient of two numbers (Sine/Cos).

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.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Set angle units
SetAngleUnits(AngleUnits.Radians)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Assign height as 33.3 inch


height = 33.3

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 109 of 197

--Assign width as 63.5 inch


width = 63.5
--Draw box according to the parameters assigned
Image.Box(0, 0, width, height, 0)
--Calculate hypotenuse using the Pythagoras method
hypotenuse = Math.Sqrt(Math.Pow(height,2) + Math.Pow(width,2))
--Display the distance
Report("Hypotenuse distance is "..hypotenuse)
--Calculate the angle theta (inverse of tan) in radians
theta = Math.Atan(height/width)
--Display the theta value
Report("Angle theta is "..theta.." in radians")
--Calculate the angle alpha (inverse of cosine) in radians
alpha = Math.Acos(height/hypotenuse)
--Display alpha angle
Report("Angle alpha is "..alpha.." in radians")
--Display the theta angle by converting to degree.
Report("Angle theta is ".. Math.Deg(theta).." in degrees")

Math Atan2
Return the angle whose tangent is the quotient of the two specified numbers.

Syntax

Atan2 ( float y, float x )

Parameters

x float The x coordinate of a point


y float The y coordinate of a point

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

--Millimeters mode used


SetUnits(Units.Millimeters)
--Set angle units
SetAngleUnits(AngleUnits.Radians)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Assign value to theta


theta = 45
--Returns theta in to radians
thetaRad = Math.Rad(theta)
--Sin value of angle theta
sinTheta = Math.Sin(thetaRad)
--Cos value of angle theta
cosTheta = Math.Cos(thetaRad)
--Inverse Tangent value in radians
Report("Theta is "..Math.Atan2(sinTheta,cosTheta))

Math Ceil
Returns the smallest integer larger than or equal to specified number.

Syntax

Ceil( float val )

Parameters

val float A specified number.

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 110 of 197

Return Values

The smallest integer that is greater than or equal to val.

Example
----- This will display the greater and smaller integer values

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Assign a decimal number to the value variable


value = 1.83
--Display the greatest integer value less than or equal to the number (in this case 2)
Report("Integer value greater than "..value.."is "..Math.Ceil(value))
--Display the smallest integer value less than or equal to the number (in this case 1)
Report("Integer value smaller than "..value.."is "..Math.Floor(value))

Math Cos
Returns the cos value of the angle according to the unit specified in SetAngleUnits.

Syntax

Cos( float angle )

Parameters

angle float The angle. This may be in Radians or Degrees.

Return Values

The cosine of angle.

Example
----- This will display the radians, cosine, sine and the tangent values of a theta angle of 45

--Millimeters mode used


SetUnits(Units.Millimeters)
--Set angle units
SetAngleUnits(AngleUnits.Radians)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Assign value to variable theta


theta = 45
--Returns the equivalent of theta in radians
thetaRad = Math.Rad(theta)
--Display the equivalent value of theta in radians
Report("Angle "..theta.."convert to "..thetaRad.." radians")
--The equivalent Cosine value of theta
Report("Cosine value is "..Math.Cos(thetaRad))
--The equivalent Sine value of theta
Report("Sine value is "..Math.Sin(thetaRad))
--Tangent value of theta
Report("Tangent value is "..Math.Tan(thetaRad))

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

Deg( float radians )

Parameters

radians float The radian value.

Return Values

Returns the calculated value in degrees.

Example
---- This will draw the rectangle and calculate the angle in the hypotenuse by applying trigonometric functions.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Set angle units
SetAngleUnits(AngleUnits.Radians)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Assign height as 33.3 inch


height = 33.3
--Assign width as 62.5 inch
width = 62.5
--Draw box according to the parameters assigned
Image.Box(0, 0, width, height, 0)
--Calculate hypotenuse using the Pythagoras method
hypotenuse = Math.Sqrt(Math.Pow(height,2) + Math.Pow(width,2))
--Display the distance
Report("Hypotenuse distance is "..hypotenuse)
--Calculate the angle theta (inverse of tan) in radians
theta = Math.Atan(height/width)
--Display the theta value
Report("Angle theta is "..theta.." in radians")
--Calculate the angle alpha (inverse of cosine) in radians
alpha = Math.Acos(height/hypotenuse)
--Display alpha angle
Report("Angle alpha is "..alpha.." in radians")
--Display the theta angle by converting to degree.
Report("Angle theta is".. Math.Deg(theta).." in degrees")

Math Exp
Returns 'e' raised to the specified power.

Syntax

Exp( float val )

Parameters

val float The number representing the power.

Return Values

Returns the number e raised to the power of val.

Example
------ This will display the Exponential values up to the power of 10 along with its natural logarithmic value

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings

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

Floor( float val )

Parameters

val float A specified number.

Return Values

The largest integer less than or equal to val.

Example
----- This will display the greater and smaller integer values

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Assign a decimal number to the value variable


value = 1.83
--Display the greatest integer value less than or equal to the number (in this case 2)
Report("Integer value greater than "..value.." is "..Math.Ceil(value))
--Display the smallest integer value less than or equal to the number (in this case 1)
Report("Integer value smaller than "..value.." is "..Math.Floor(value))

Math Fmod
Returns the remainder of the division of two numbers that rounds the quotient towards zero.

Syntax

Fmod( float x, float y )

Parameters

x float A specified number.


y float A specified number. It has to be a positive.

Return Values

Returns the remainder of x/y.

Example

-----This will display the integer and fractional part of a given number.

--Millimeters mode used


SetUnits(Units.Millimeters)

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 113 of 197

--Laser Parameter settings


Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Display the integer and fractional part of the remainder


Report(Math.Fmod(10,3.4))

Math Log
Returns the natural (base e) logarithm of the specified number.

Syntax

Log( float val )

Parameters

val float A number whose logarithm is to be found.

Return Values

The natural logarithm of val.

Example
------This will display the Exponential value until power of 10 and its natural logarithm value

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
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).."\t"..Math.Log(Math.Exp(index)))
end

Math Log10
Return the base 10 logarithm of a given number.

Syntax

Log10( float val )

Parameters

val float A number whose logarithm is to be found.

Return Values

The base 10 log of val.

Example
------ This will display ten raised to the power value from -5 to 5 and its base 10 logarithm value

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000

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

Max( float val1 float val2 [float val3,...] )

Note: You may pass any number of arguments.

Parameters

val1,val2 float numbers to compare

Return Values

Returns the parameter which is greater

Example
------This program will display the maximum and the minimum values from a list of numbers.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--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

Min( float val1, float val2, [float val3,...] )

Note: You may pass any number of arguments.

Parameters

val1,val2 float numbers to compare

Return Values

Returns the parameter which is smaller.

Example

----This program will display the maximum and the minimum values from a list of numbers.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

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

Returns the value of PI.

Example
------ This Program will scan "ScanMaster" as a polar array.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 100
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--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"

--Polar array text radius


radi = 10

--Angle between string


angleGap = 30
--End Angle calculation
endAngle = Math.Deg(Math.PI*2)-angleGap

for i=0, endAngle, angleGap do


--theta angle calculation
theta = math.Deg(Math.PI/2)-i

myText.Angle = i

--text X position calculation


myText.X = radi*Math.Cos(Math.Rad(i))+(height/2)*Math.cos(Math.Rad(theta))
--text Y position calculation
myText.Y = radi*Math.Sin(Math.Rad(i))-(height/2)*Math.sin(Math.Rad(theta))

--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

Pow( float x, float y )

Parameters

x float The first value. This will be raised to the power of y.


y float The second value. The x value will be raised to the power by this value.

Return Values

Returns the value of x^y as a float.

Example
--This will draw the rectangle and calculate the angle in the hypotenuse by applying trigonometric functions.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Set angle units
SetAngleUnits(AngleUnits.Radians)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Assign height as 1.3 inch


height = 28.3
--Assign width as 2.5 inch
width = 40.5
--Draw box according to the parameters assign
Image.Box(0, 0, width, height, 0)
--Calculate hypotenuse using the Pythagoras method
hypotenuse = Math.Sqrt(Math.Pow(height,2) + Math.Pow(width,2))
--Display the distance
Report("Hypotenuse distance is "..hypotenuse)
--Calculate the angle theta (inverse of tan) in radians
theta = Math.Atan(height/width)
--Display the theta value
Report("Angle theta is "..theta.." in radians")
--Calculate the angle alpha (inverse of cosine) in radians
alpha = Math.Acos(height/hypotenuse)
--Display alpha angle
Report("Angle alpha is "..alpha.." in radians")
--Display the theta angle by converting to degree.
Report("Angle theta is ".. Math.Deg(theta).." in degrees")

Math Rad
Convert degrees to radians.

Syntax

Rad( float anglenDegrees )

Parameters

anglenDegrees float The number in degrees.

Return Values

The equivalent number in radians.

Example
------ This will display the radians, cosine, sine and the tangent values of a theta angle of 45

--Inch mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings

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

--Returns the equivalent of theta in radians


thetaRad = Math.Rad(theta)
--Display the equivalent value of theta in radians
Report("Angle "..theta.."convert to "..thetaRad.." radians")
--The equivalent Cosine value of theta
Report("Cosine value is "..Math.Cos(thetaRad))
--The equivalent Sine value of theta
Report("Sine value is "..Math.Sin(thetaRad))
--Tangent value of theta
Report("Tangent value is "..Math.Tan(thetaRad))

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

min int The lower limit of the range.


max int The upper limit of the range.

Return Values

If no argument is specified, returns a random value between 0 and 1 excluding zero.

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

-------- This program will generate random numbers.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

-- Generates a number between 10 and 100 and displays it.


Report("Generate a random number between 10 and 100 "..Math.Random(10,100))
--Generates a number lesser than 500 and displays it.
Report("Generate a random number below 500 "..Math.Random(500))

Math Round
Changes any given number to the nearest round number

Syntax

Math.Round( float val )


Math.Round( float val, int decimal )
Math.Round( float val , int decimal, MidpointRounding rounding )

Parameters

val float The value that is rounded to the nearest value

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

Returns a round value

Example
------This program will demonstrate the Math.Round() method.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

beforeValue = 123.45
afterValue1 = Math.Round(beforeValue,1, MidpointRounding.AwayFromZero)
afterValue2 = Math.Round(beforeValue,1, MidpointRounding.ToEven)
afterValue3 = Math.Round(beforeValue)

Report("Original Value is "..beforeValue)


Report("Rounds Up Value is "..afterValue1)
Report("Rounds to even value is "..afterValue2)
Report("Default rounding value is "..afterValue3)

Math Sin
Return the sine value for a given value in the specified unit in SetAngleUnits.

Syntax

Sin( float angle )

Parameters

angle float An angle, measured in Radians or Degrees.

Return Values

The sine of angle.

Example
----This will display the radians, cosine, sine and the tangent values of a theta angle of 45

--Millimeters mode used


SetUnits(Units.Millimeters)
--Set angle units
SetAngleUnits(AngleUnits.Radians)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Assign value to variable theta


theta = 45
--Returns the equivalent of theta in radians
thetaRad = Math.Rad(theta)
--Display the equivalent value of theta in radians
Report("Angle "..theta.." convert to "..thetaRad.." radians")
--The equivalent Cosine value of theta
Report("Cosine value is "..Math.Cos(thetaRad))
--The equivalent Sine value of theta
Report("Sine value is "..Math.Sin(thetaRad))
--Tangent value of theta

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 119 of 197

Report("Tangent value is "..Math.Tan(thetaRad))

Math Sqrt
Return the square root of a given number.

Syntax

Sqrt( float val )

Parameters

val float The value to be calculated. It has to be a Zero or positive number.

Return Values

Returns the square root of val.

Example
-----This will draw the rectangle and calculate the angle in the hypotenuse by applying trigonometric functions.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Set angle units
SetAngleUnits(AngleUnits.Radians)
--Laser Parameter settings
Laser.JumpSpeed = 300
Laser.MarkSpeed = 150
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Assign height as 28.3 inch


height = 28.3
--Assign width as 50.5 inch
width = 50.5
--Draw box according to the parameters assign
Image.Box(0, 0, width, height, 0)
--Calculate hypotenuse using the Pythagoras method
hypotenuse = Math.Sqrt(Math.Pow(height,2) + Math.Pow(width,2))
--Display the distance
Report("Hypotenuse distance is "..hypotenuse)
--Calculate the angle theta (inverse of tan) in radians
theta = Math.Atan(height/width)
--Display the theta value
Report("Angle theta is "..theta.." in radians")
--Calculate the angle alpha (inverse of cosine) in radians
alpha = Math.Acos(height/hypotenuse)
--Display the alpha angle
Report("Angle alpha is "..alpha.." in radians")
--Display the theta angle by converting to degree.
Report("Angle theta is ".. Math.Deg(theta).." in degrees")

Math Tan
Returns the tan value of the angle passed according to the unit set in SetAngleUnits.

Syntax

Tan( float angle )

Parameters

angle float An angle, measured in radians or degrees.

Return Values

The tangent of angle.

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

--Millimeters mode used


SetUnits(Units.Millimeters)
--Set angle units
SetAngleUnits(AngleUnits.Radians)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
--Assign value to variable theta
theta = 45
--Returns the equivalent of theta in radians
thetaRad = Math.Rad(theta)
--Display the equivalent value of theta in radians
Report("Angle "..theta.."convert to "..thetaRad.." radians")
--The equivalent Cosine value of theta
Report("Cosine value is "..Math.Cos(thetaRad))
--The equivalent Sine value of theta
Report("Sine value is "..Math.Sin(thetaRad))
--Tangent value of theta
Report("Tangent value is "..Math.Tan(thetaRad))

MOTF(Mark On The Fly)


Marking On The Fly (MOTF) support is provided through the use of several configuration and activation commands. Motion tracking in either the X, Y or both axis can be
configured using a digital quadrature input, or by simulating the motion in situations where an encoder feedback is not available but the motion speed is relatively constant.

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.

Typical MOTF Job Flow

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

Initialize Initialize the Scan controller for Marking-on-the-fly.


ResetTracking Reset all counters used in the MOTF model.
StartTracking MOTF compensation is activated for all geometric shapes.
StopTrackingAndJump Stops MOTF compensation and jump to reset location.
TriggerOnIO Sets the trigger source for the part sensing trigger port
WaitForCount Wait for HW encoder counter to reach or exceed a specific value. (Deprecated)
WaitForDistance This command will wait for a distance (in user units) to reach or exceed a specific value.
WaitForTriggerCount Wait for the trigger condition to be satisfied and then the count to be met or exceeded. (Deprecated)
WaitForTriggerDistance Wait for the trigger to be satisfied and then the distance to be met or exceeded.
EnableLaserRegulation Enables laser parameter regulation as a function of MOTF speed.
EnableSpeedRegulation Enables marking speed regulation as a function of MOTF speed.
DisableSpeedRegulation Disables speed regulation.
DisableLaserRegulation Disables laser regulation.
CenterOfRotation Sets the center of rotation for rotary MOTF operation.
DelayCompensation Sets a compensation value in usec for delays in MOTF system. (Deprecated)
PosFFCompEnable Sets the method of the MOTF velocity-derived galvo position feed-forward compensation.

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.

--Inch mode used


SetUnits(Units.Inches)
--Laser Parameter settings
Laser.JumpSpeed = 300
Laser.MarkSpeed = 150
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--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

CalFactor = float value

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

Return the calibration factor for the encoder.

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

-- Initialize the MOTF settings


MOTF.Initialize()

-- Initialize laser/scan-head settings


Laser.MarkSpeed = 1000
Laser.MarkDelay = 200
Laser.JumpSpeed = 3000
Laser.JumpDelay = 200
Laser.Frequency = 20
Laser.DutyCycle1 = 50
Laser.Power = 50
Laser.LaserOnDelay = 75
Laser.LaserOffDelay = 125
Laser.PolyDelay = 50
Laser.VariPolyDelayFlag = true

-- Wait for this web travel before marking


partDistance = 50.

-- Wait for start signal


IO.WaitForIo(Pin.Din.UserIn1,Trigger.Edge.Rising, 0, 0, true)

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 122 of 197

-- Initialize to wait the initial distance


MOTF.ResetTracking()
System.Flush()
-- Repeat until aborted via external signal
while IO.ReadPin(Pin.Din.UserIn4) == false do
MOTF.WaitForDistance(partDistance)
-- Counters are automatically reset when WaitForDistance() releases
MOTF.StartTracking(Tracking.WhileMarking)
Image.Circle(0, 0, 20)
MOTF.StopTrackingAndJump(0, 0, 0, 200)
Laser.WaitForEnd()
-- Counters are still counting and distance being measured
end

Report ("Job Finished")

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

CalFactor0 = float value

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

Return the calibration factor for the encoder.

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

-- Initialize the MOTF settings


MOTF.Initialize()

-- Initialize laser/scan-head settings


Laser.MarkSpeed = 1000
Laser.MarkDelay = 200
Laser.JumpSpeed = 3000
Laser.JumpDelay = 200
Laser.Frequency = 20
Laser.DutyCycle1 = 50
Laser.Power = 50
Laser.LaserOnDelay = 75
Laser.LaserOffDelay = 125
Laser.PolyDelay = 50
Laser.VariPolyDelayFlag = true

-- Wait for this web travel before marking


partDistance = 50.

-- Wait for start signal


IO.WaitForIo(Pin.Din.UserIn1,Trigger.Edge.Rising, 0, 0, true)

-- Initialize to wait the initial distance


MOTF.ResetTracking()
System.Flush()
-- Repeat until aborted via external signal

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 123 of 197

while IO.ReadPin(Pin.Din.UserIn4) == false do


MOTF.WaitForDistance(partDistance)
-- Counters are automatically reset when WaitForDistance() releases
MOTF.StartTracking(Tracking.WhileMarking)
Image.Circle(0, 0, 20)
MOTF.StopTrackingAndJump(0, 0, 0, 200)
Laser.WaitForEnd()
-- Counters are still counting and distance being measured
end

Report ("Job Finished")

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

CalFactor1 = float value

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

Return the calibration factor for the encoder.

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

-- Initialize the MOTF settings


MOTF.Initialize()

-- Initialize laser/scan-head settings


Laser.MarkSpeed = 1000
Laser.MarkDelay = 200
Laser.JumpSpeed = 3000
Laser.JumpDelay = 200
Laser.Frequency = 20
Laser.DutyCycle1 = 50
Laser.Power = 50
Laser.LaserOnDelay = 75
Laser.LaserOffDelay = 125
Laser.PolyDelay = 50
Laser.VariPolyDelayFlag = true

-- Wait for this web travel before marking


partDistance = 50.

-- Wait for start signal


IO.WaitForIo(Pin.Din.UserIn1,Trigger.Edge.Rising, 0, 0, true)

-- Initialize to wait the initial distance


MOTF.ResetTracking()
System.Flush()
-- Repeat until aborted via external signal
while IO.ReadPin(Pin.Din.UserIn4) == false do
MOTF.WaitForDistance(partDistance)
-- Counters are automatically reset when WaitForDistance() releases
MOTF.StartTracking(Tracking.WhileMarking)

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

Report ("Job Finished")

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

x float X coordinate of the center of rotation


y float Y coordinate of the center of rotation

Example
-- This sample marks a square on a rotating platen where the center
-- of rotation is displaced from the scan head origin.

-- Define the encoder resolution. Note that this will be converted


-- to micro-radians which will represent the incremental adjustment
-- capability of the galvos.
-- Note that 1 micro-radian is 1 micron of displacement at 1 meter

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

-- The encoder should be attached to port MOTF 0


MOTF.Mode = Encoder.ExternalRotary
-- Increasing counts track this rotation as viewed from above.
-- Clock-Wise (CW) is also available.
MOTF.Direction = Direction.RotaryCCWDirection
-- Define the center of rotation relative to the optical origin of the scan head
MOTF.CenterOfRotation(200, 200)
MOTF.Initialize()

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 125 of 197

-- Initialize laser/scan-head settings


Laser.MarkSpeed = 2000
Laser.MarkDelay = 200
Laser.JumpSpeed = 3000
Laser.JumpDelay = 200
Laser.Frequency = 20
Laser.DutyCycle1 = 50
Laser.Power = 50
Laser.LaserOnDelay = 75
Laser.LaserOffDelay = 125
Laser.PolyDelay = 50
Laser.VariPolyDelayFlag = true

-- Space the marks around the rotating work-surface


AngleToWaitBetweenMarksInDegrees = 90
AngleToWaitBetweenMarksInMicroRads = ((AngleToWaitBetweenMarksInDegrees / 180)
* 3.14159) * 1000000
Report("AngleToWaitBetweenMarksInMicroRads = " .. AngleToWaitBetweenMarksInMicroRads)

-- Wait for the start signal


IO.WaitForIo(Pin.Din.UserIn1,Trigger.Edge.Rising, 0, 0, true)

-- Initialize to wait the initial distance


MOTF.ResetTracking()
System.Flush()
-- Repeat until aborted via external signal
while IO.ReadPin(Pin.Din.UserIn4) == false do
MOTF.WaitForCount(AngleToWaitBetweenMarksInMicroRads)
-- Counters are automatically reset when WaitForCount() releases
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
end

Report ("Job Finished")

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

delay int The delay in usec to be compensated.

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

-- Initialize the MOTF settings


MOTF.Initialize()

-- Initialize laser/scan-head settings


Laser.MarkSpeed = 1000
Laser.MarkDelay = 200
Laser.JumpSpeed = 3000
Laser.JumpDelay = 200

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

-- Wait for this web travel before marking


partDistance = 50.

-- Compensate for 20usec of lag from the release of WaitForDistance


-- to when marking starts
MOTF.DelayCompensation(20)

-- Wait for start signal


IO.WaitForIo(Pin.Din.UserIn1,Trigger.Edge.Rising, 0, 0, true)

-- Initialize to wait the initial distance


MOTF.ResetTracking()
System.Flush()
-- Repeat until aborted via external signal
while IO.ReadPin(Pin.Din.UserIn4) == false do
MOTF.WaitForDistance(partDistance)
-- Counters are automatically reset when WaitForDistance() releases
MOTF.StartTracking(Tracking.WhileMarking)
Image.Circle(0, 0, 20)
MOTF.StopTrackingAndJump(0, 0, 0, 200)
Laser.WaitForEnd()
-- Counters are still counting and distance being measured
end

Report ("Job Finished")

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

direction Direction Sets MOTF orientation and direction.

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

-- Initialize the MOTF settings


MOTF.Initialize()

-- Initialize laser/scan-head settings


Laser.MarkSpeed = 1000
Laser.MarkDelay = 200
Laser.JumpSpeed = 3000
Laser.JumpDelay = 200
Laser.Frequency = 20
Laser.DutyCycle1 = 50
Laser.Power = 50
Laser.LaserOnDelay = 75
Laser.LaserOffDelay = 125
Laser.PolyDelay = 50
Laser.VariPolyDelayFlag = true

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 127 of 197

-- Wait for this web travel before marking


partDistance = 50.

-- Wait for start signal


IO.WaitForIo(Pin.Din.UserIn1,Trigger.Edge.Rising, 0, 0, true)

-- Initialize to wait the initial distance


MOTF.ResetTracking()
System.Flush()
-- Repeat until aborted via external signal
while IO.ReadPin(Pin.Din.UserIn4) == false do
MOTF.WaitForDistance(partDistance)
-- Counters are automatically reset when WaitForDistance() releases
MOTF.StartTracking(Tracking.WhileMarking)
Image.Circle(0, 0, 20)
MOTF.StopTrackingAndJump(0, 0, 0, 200)
Laser.WaitForEnd()
-- Counters are still counting and distance being measured
end

Report ("Job Finished")

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

-- Initialize the MOTF settings


MOTF.Initialize()

-- Initialize laser/scan-head settings


Laser.MarkSpeed = 5000
Laser.MarkDelay = 200
Laser.JumpSpeed = 10000
Laser.JumpDelay = 200
Laser.Frequency = 20
Laser.DutyCycle1 = 90
Laser.Power = 50
Laser.LaserOnDelay = 75
Laser.LaserOffDelay = 125
Laser.PolyDelay = 50
Laser.VariPolyDelayFlag = true

-- Initialize Laser Regulation


minWebSpeedInMmPerSec = 0
maxWebSpeedInMmPerSec = 500
laserPropertyScaleAtMinWebSpeedInPct = 10
laserPropertyScaleAtMaxWebSpeedInPct = 100

MOTF.EnableLaserRegulation(minWebSpeedInMmPerSec, maxWebSpeedInMmPerSec,
laserPropertyScaleAtMinWebSpeedInPct, laserPropertyScaleAtMaxWebSpeedInPct,
LaserRegMode.DutyCycle)

-- Wait for this web travel before marking


partDistance = 50.

-- Wait here for the start signal


IO.WaitForIo(Pin.Din.UserIn1,Trigger.Edge.Rising, 0, 0, true)

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 128 of 197

-- Initialize to wait the initial distance


MOTF.ResetTracking()
System.Flush()
-- Repeat until aborted via external signal
while IO.ReadPin(Pin.Din.UserIn4) == false do
MOTF.WaitForDistance(partDistance)
-- Counters are automatically reset when WaitForDistance() releases
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

Report ("Job Finished")


-- Turn off laser reglation
MOTF.DisableLaserRegulation()

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

-- Initialize the MOTF settings


MOTF.Initialize()

-- Initialize laser/scan-head settings


Laser.MarkSpeed = 5000
Laser.MarkDelay = 200
Laser.JumpSpeed = 10000
Laser.JumpDelay = 200
Laser.Frequency = 20
Laser.DutyCycle1 = 50
Laser.Power = 50
Laser.LaserOnDelay = 75
Laser.LaserOffDelay = 125
Laser.PolyDelay = 50
Laser.VariPolyDelayFlag = true

-- Initialize MarkSpeed Regulation


minWebSpeedInMmPerSec = 0
maxWebSpeedInMmPerSec = 500
speedScaleAtMinWebSpeedInPct = 5
speedScaleAtMaxWebSpeedInPct = 100

MOTF.EnableSpeedRegulation(minWebSpeedInMmPerSec, maxWebSpeedInMmPerSec,
speedScaleAtMinWebSpeedInPct, speedScaleAtMaxWebSpeedInPct)

-- Wait for this web travel before marking


partDistance = 50.

-- Wait for start signal


IO.WaitForIo(Pin.Din.UserIn1,Trigger.Edge.Rising, 0, 0, true)

-- Initialize to wait the initial distance


MOTF.ResetTracking()
System.Flush()
-- Repeat until aborted via external signal
while IO.ReadPin(Pin.Din.UserIn4) == false do
MOTF.WaitForDistance(partDistance)
-- Counters are automatically reset when WaitForDistance() releases

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

Report ("Job Finished")


-- Turn off speed regulation
MOTF.DisableSpeedRegulation()

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

-- Initialize the MOTF settings


MOTF.Initialize()

-- Initialize laser/scan-head settings


Laser.MarkSpeed = 5000
Laser.MarkDelay = 200
Laser.JumpSpeed = 10000
Laser.JumpDelay = 200
Laser.Frequency = 20
Laser.DutyCycle1 = 90
Laser.Power = 50
Laser.LaserOnDelay = 75
Laser.LaserOffDelay = 125
Laser.PolyDelay = 50
Laser.VariPolyDelayFlag = true

-- Initialize Laser Regulation


minWebSpeedInMmPerSec = 0
maxWebSpeedInMmPerSec = 500
laserPropertyScaleAtMinWebSpeedInPct = 10
laserPropertyScaleAtMaxWebSpeedInPct = 100

MOTF.EnableLaserRegulation(minWebSpeedInMmPerSec, maxWebSpeedInMmPerSec,
laserPropertyScaleAtMinWebSpeedInPct, laserPropertyScaleAtMaxWebSpeedInPct,
LaserRegMode.DutyCycle)

-- Wait for this web travel before marking


partDistance = 50.

-- Wait here for the start signal


IO.WaitForIo(Pin.Din.UserIn1,Trigger.Edge.Rising, 0, 0, true)

-- Initialize to wait the initial distance


MOTF.ResetTracking()
System.Flush()
-- Repeat until aborted via external signal
while IO.ReadPin(Pin.Din.UserIn4) == false do
MOTF.WaitForDistance(partDistance)
-- Counters are automatically reset when WaitForDistance() releases
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

Report ("Job Finished")


-- Turn off laser reglation
MOTF.DisableLaserRegulation()

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

EnableSpeedRegulation( float motfSpeedMin, float motfSpeedMax, float markSpeedScaleMinPct, float markSpeedScaleMaxPct )

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

-- Initialize the MOTF settings


MOTF.Initialize()

-- Initialize laser/scan-head settings


Laser.MarkSpeed = 5000
Laser.MarkDelay = 200
Laser.JumpSpeed = 10000
Laser.JumpDelay = 200
Laser.Frequency = 20
Laser.DutyCycle1 = 50
Laser.Power = 50
Laser.LaserOnDelay = 75
Laser.LaserOffDelay = 125
Laser.PolyDelay = 50
Laser.VariPolyDelayFlag = true

-- Initialize MarkSpeed Regulation


minWebSpeedInMmPerSec = 0
maxWebSpeedInMmPerSec = 500
speedScaleAtMinWebSpeedInPct = 5
speedScaleAtMaxWebSpeedInPct = 100

MOTF.EnableSpeedRegulation(minWebSpeedInMmPerSec, maxWebSpeedInMmPerSec,

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 132 of 197

speedScaleAtMinWebSpeedInPct, speedScaleAtMaxWebSpeedInPct)

-- Wait for this web travel before marking


partDistance = 50.

-- Wait for start signal


IO.WaitForIo(Pin.Din.UserIn1,Trigger.Edge.Rising, 0, 0, true)

-- Initialize to wait the initial distance


MOTF.ResetTracking()
System.Flush()
-- Repeat until aborted via external signal
while IO.ReadPin(Pin.Din.UserIn4) == false do
MOTF.WaitForDistance(partDistance)
-- Counters are automatically reset when WaitForDistance() releases
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

Report ("Job Finished")


-- Turn off speed regulation
MOTF.DisableSpeedRegulation()

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

-- Initialize the MOTF settings


MOTF.Initialize()

-- Initialize laser/scan-head settings


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

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 133 of 197

--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

--Loop run continuously

-- Wait for this web travel before marking


partDistance = 50.

-- Wait for start signal


IO.WaitForIo(Pin.Din.UserIn1,Trigger.Edge.Rising, 0, 0, true)

-- Initialize to wait the initial distance


MOTF.ResetTracking()
System.Flush()
-- Repeat until aborted via external signal
while IO.ReadPin(Pin.Din.UserIn4) == false do
MOTF.WaitForDistance(partDistance)
-- Counters are automatically reset when WaitForDistance() releases
MOTF.StartTracking(Tracking.WhileMarking)
MarkBarcode()
MOTF.StopTrackingAndJump(0, 0, 0, 200)
Laser.WaitForEnd()
-- Counters are still counting and distance being measured
end

Report ("Job Finished")

Motf Mode
Sets how MOTF position information is derived.

Syntax

Motf.Mode = Encoder.<mode>

Parameters

mode Encoder Sets the how to track position inputs

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

-- Initialize the MOTF settings


MOTF.Initialize()

-- Initialize laser/scan-head settings

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

--Loop run continuously

-- Wait for this web travel before marking


partDistance = 50.

-- Wait for start signal


IO.WaitForIo(Pin.Din.UserIn1,Trigger.Edge.Rising, 0, 0, true)

-- Initialize to wait the initial distance


MOTF.ResetTracking()
System.Flush()
-- Repeat until aborted via external signal
while IO.ReadPin(Pin.Din.UserIn4) == false do
MOTF.WaitForDistance(partDistance)
-- Counters are automatically reset when WaitForDistance() releases
MOTF.StartTracking(Tracking.WhileMarking)
MarkBarcode()
MOTF.StopTrackingAndJump(0, 0, 0, 200)
Laser.WaitForEnd()
-- Counters are still counting and distance being measured
end

Report ("Job Finished")

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

PosFFCompEnable( int method)

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)

-- MOTF & Stage Initialization part


MOTF.Direction = Direction.DualAxisPlusDirection
MOTF.Mode = Encoder.ExternalDualAxis
-- OVerride the default setting of 2 for testing only
MOTF.PosFFCompEnable(1)
-- MOTF CalFactor is automatically calculated from data in the SyncMasterConfig file
MOTF.Initialize()

-- SyncMaster initialization
SyncMaster.Connect()
SyncMaster.Initialize()

-- Optional stage homing.


-- Argument "false" means home the stage if not already done
-- Argument "true" means always home the stage
Stage.Home(false)

-- 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)

-- Enable SyncMaster operation


SyncMaster.Enable()

-- Enable SMC tracking of the XY stage


MOTF.ResetTracking() -- zero out the counters
MOTF.StartTracking(Tracking.Continuously) -- begin continuous tracking

-- 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)

-- Pause here and wait for all marking operations to finish


Laser.WaitForEnd()

-- Disable SyncMaster operation


SyncMaster.Disable()

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

-- 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

-- Initialize the MOTF settings


MOTF.Initialize()

-- Initialize laser/scan-head settings


Laser.MarkSpeed = 1000
Laser.MarkDelay = 200
Laser.JumpSpeed = 3000
Laser.JumpDelay = 200
Laser.Frequency = 20
Laser.DutyCycle1 = 50
Laser.Power = 50
Laser.LaserOnDelay = 75
Laser.LaserOffDelay = 125
Laser.PolyDelay = 50
Laser.VariPolyDelayFlag = true

-- Wait for this web travel before marking


partDistance = 50.

-- Wait for start signal


IO.WaitForIo(Pin.Din.UserIn1,Trigger.Edge.Rising, 0, 0, true)

-- Initialize to wait the initial distance


MOTF.ResetTracking()
System.Flush()
-- Repeat until aborted via external signal
while IO.ReadPin(Pin.Din.UserIn4) == false do
MOTF.WaitForDistance(partDistance)
-- Counters are automatically reset when WaitForDistance() releases
MOTF.StartTracking(Tracking.WhileMarking)
Image.Circle(0, 0, 20)
MOTF.StopTrackingAndJump(0, 0, 0, 200)
Laser.WaitForEnd()
-- Counters are still counting and distance being measured
end

Report ("Job Finished")

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

-- Initialize the MOTF settings


MOTF.Initialize()

-- Initialize laser/scan-head settings


Laser.MarkSpeed = 1000
Laser.MarkDelay = 200
Laser.JumpSpeed = 3000
Laser.JumpDelay = 200

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

-- Wait for this web travel before marking


partDistance = 50.

-- Wait for start signal


IO.WaitForIo(Pin.Din.UserIn1,Trigger.Edge.Rising, 0, 0, true)

-- Initialize to wait the initial distance


MOTF.ResetTracking()
System.Flush()
-- Repeat until aborted via external signal
while IO.ReadPin(Pin.Din.UserIn4) == false do
MOTF.WaitForDistance(partDistance)
-- Counters are automatically reset when WaitForDistance() releases
MOTF.StartTracking(Tracking.WhileMarking)
Image.Circle(0, 0, 20)
MOTF.StopTrackingAndJump(0, 0, 0, 200)
Laser.WaitForEnd()
-- Counters are still counting and distance being measured
end

Report ("Job Finished")

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

StopTrackingAndJump(float x, float y, float z, int delayInMs)

Parameters

x float The x coordinate of the reset location


y float The y coordinate of the reset location.
z float The z coordinate of the reset location.
delayInMs int The jump delay in milliseconds.

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

-- Initialize the MOTF settings


MOTF.Initialize()

-- Initialize laser/scan-head settings


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

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

--Loop run continuously

-- Wait for this web travel before marking


partDistance = 50.

-- Wait for start signal


IO.WaitForIo(Pin.Din.UserIn1,Trigger.Edge.Rising, 0, 0, true)

-- Initialize to wait the initial distance


MOTF.ResetTracking()
System.Flush()
-- Repeat until aborted via external signal
while IO.ReadPin(Pin.Din.UserIn4) == false do
MOTF.WaitForDistance(partDistance)
-- Counters are automatically reset when WaitForDistance() releases
MOTF.StartTracking(Tracking.WhileMarking)
MarkBarcode()
MOTF.StopTrackingAndJump(0, 0, 0, 200)
Laser.WaitForEnd()
-- Counters are still counting and distance being measured
end

Report ("Job Finished")

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

TriggerOnIO(Pin pin,Trigger trigger,float distanceThreshold)

Parameters

pin Pin The input pin.


trigger Trigger The external signal (pulse).
float distanceThreshold After a reset, the distance that the MOTF system must travel before the trigger is armed.

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

-- 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)

-- Initialize the MOTF settings


MOTF.Initialize()

-- Initialize laser/scan-head settings


Laser.MarkSpeed = 1000
Laser.MarkDelay = 200
Laser.JumpSpeed = 3000
Laser.JumpDelay = 200
Laser.Frequency = 20
Laser.DutyCycle1 = 50
Laser.Power = 50
Laser.LaserOnDelay = 75
Laser.LaserOffDelay = 125
Laser.PolyDelay = 50
Laser.VariPolyDelayFlag = true

-- Wait for start signal


IO.WaitForIo(Pin.Din.UserIn1,Trigger.Edge.Rising, 0, 0, true)

-- Wait for this web travel before marking


triggerDistance = 50.

-- Repeat until aborted via external signal


while IO.ReadPin(Pin.Din.UserIn4) == false do
MOTF.WaitForTriggerDistance(triggerDistance)
MOTF.ResetTracking()
MOTF.StartTracking(Tracking.WhileMarking)
Image.Circle(0, 0, 20)
MOTF.StopTrackingAndJump(0, 0, 0, 200)
Laser.WaitForEnd()
end

Report ("Job Finished")

Motf WaitForCount
NOTE: This method is deprecated. Please use MOTF.WaitForDistance()

Wait for scaled HW encoder counter to reach or exceed a specific value.

Syntax

WaitForCount ( int scaledEncoderCounts )


WaitForCount ( int scaledEncoderCounts , bool isAbsolute )

Parameters

scaledEncoderCounts int Scaled encoder count.


isAbsolute bool Count is absolute or relative to the last position when StopTrackingAndJump is called. Default False.

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.CalFactor = System.CalFactorY * encoderLinResInMmPerCount

-- Initialize the MOTF settings


MOTF.Initialize()

-- Initialize laser/scan-head settings


Laser.MarkSpeed = 1000
Laser.MarkDelay = 200
Laser.JumpSpeed = 3000
Laser.JumpDelay = 200
Laser.Frequency = 20
Laser.DutyCycle1 = 50
Laser.Power = 50
Laser.LaserOnDelay = 75
Laser.LaserOffDelay = 125
Laser.PolyDelay = 50
Laser.VariPolyDelayFlag = true

-- Wait for this web travel before marking


partDistanceInMm = 50.
partDistanceInBits = partDistanceInMm * System.CalFactorY

-- Wait for start signal


IO.WaitForIo(Pin.Din.UserIn1,Trigger.Edge.Rising, 0, 0, true)

-- Initialize to wait the initial distance


MOTF.ResetTracking()
System.Flush()
-- Repeat until aborted via external signal
while IO.ReadPin(Pin.Din.UserIn4) == false do
-- Using MOTF CalFactor scaled counts which are galvo bits
MOTF.WaitForCount(partDistanceInBits)
-- Counters are automatically reset when WaitForCount() releases
MOTF.StartTracking(Tracking.WhileMarking)
Image.Circle(0, 0, 20)
MOTF.StopTrackingAndJump(0, 0, 0, 200)
Laser.WaitForEnd()
-- Counters are still counting and distance being measured
end

Report ("Job Finished")

Motf WaitForCounterPort
When in DualAxis tracking, sets the MOTF port that will be used for the WaitForCount, WaitForDistance, WaitForTriggerCount, WaitForTriggerDistance commands.

Syntax

MOTF.WaitForCounterPort = CounterPort port

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

-- Wait for the X axis encoder port values


MOTF.WaitForCounterPort(CounterPort.Port0)

-- Initialize the MOTF settings


MOTF.Initialize()

-- Initialize laser/scan-head settings


Laser.MarkSpeed = 1000
Laser.MarkDelay = 200
Laser.JumpSpeed = 3000
Laser.JumpDelay = 200
Laser.Frequency = 20
Laser.DutyCycle1 = 50
Laser.Power = 50
Laser.LaserOnDelay = 75
Laser.LaserOffDelay = 125
Laser.PolyDelay = 50
Laser.VariPolyDelayFlag = true

-- Wait for this web travel before marking


partDistance = 50.

-- Wait for start signal


IO.WaitForIo(Pin.Din.UserIn1,Trigger.Edge.Rising, 0, 0, true)

-- Initialize to wait the initial distance


MOTF.ResetTracking()
System.Flush()
-- Repeat until aborted via external signal
while IO.ReadPin(Pin.Din.UserIn4) == false do
MOTF.WaitForDistance(partDistance)
-- Counters are automatically reset when WaitForDistance() releases
MOTF.StartTracking(Tracking.WhileMarking)
Image.Circle(0, 0, 20)
MOTF.StopTrackingAndJump(0, 0, 0, 200)
Laser.WaitForEnd()
-- Counters are still counting and distance being measured
end

Report ("Job Finished")

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

WaitForDistance( float distance )


WaitForDistance( float distance, bool isAbsolute )

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

-- Bits/Mm * Mm/Count -> Bits/Count


MOTF.CalFactor = System.CalFactorY *
encoderLinResInMmPerCount

-- Initialize the MOTF settings


MOTF.Initialize()

-- Initialize laser/scan-head settings


Laser.MarkSpeed = 1000
Laser.MarkDelay = 200
Laser.JumpSpeed = 3000
Laser.JumpDelay = 200
Laser.Frequency = 20
Laser.DutyCycle1 = 50
Laser.Power = 50
Laser.LaserOnDelay = 75
Laser.LaserOffDelay = 125
Laser.PolyDelay = 50
Laser.VariPolyDelayFlag = true

-- Wait for this web travel before marking


partDistance = 50.

-- Wait for start signal


IO.WaitForIo(Pin.Din.UserIn1,Trigger.Edge.Rising, 0, 0, true)

-- Initialize to wait the initial distance


MOTF.ResetTracking()
System.Flush()
-- Repeat until aborted via external signal
while IO.ReadPin(Pin.Din.UserIn4) == false do
MOTF.WaitForDistance(partDistance)
-- Counters are automatically reset when WaitForDistance() releases
MOTF.StartTracking(Tracking.WhileMarking)
Image.Circle(0, 0, 20)
MOTF.StopTrackingAndJump(0, 0, 0, 200)
Laser.WaitForEnd()
-- Counters are still counting and distance being measured
end

Report ("Job Finished")

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

WaitForTriggerCount( int scaledEncoderCounts )

Parameters

scaledEncoderCounts int Scaled encoder count.

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)

-- Initialize the MOTF settings


MOTF.Initialize()

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 143 of 197

-- Initialize laser/scan-head settings


Laser.MarkSpeed = 1000
Laser.MarkDelay = 200
Laser.JumpSpeed = 3000
Laser.JumpDelay = 200
Laser.Frequency = 20
Laser.DutyCycle1 = 50
Laser.Power = 50
Laser.LaserOnDelay = 75
Laser.LaserOffDelay = 125
Laser.PolyDelay = 50
Laser.VariPolyDelayFlag = true

-- Wait for start signal


IO.WaitForIo(Pin.Din.UserIn1,Trigger.Edge.Rising, 0, 0, true)

-- Wait for this web travel before marking


triggerDistance = 50.

-- Repeat until aborted via external signal


while IO.ReadPin(Pin.Din.UserIn4) == false do
MOTF.WaitForTriggerDistance(triggerDistance)
MOTF.ResetTracking()
MOTF.StartTracking(Tracking.WhileMarking)
Image.Circle(0, 0, 20)
MOTF.StopTrackingAndJump(0, 0, 0, 200)
Laser.WaitForEnd()
end

Report ("Job Finished")

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

WaitForTriggerDistance( float distance )

Parameters

distance float Distance between each marking.

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)

-- Initialize the MOTF settings


MOTF.Initialize()

-- Initialize laser/scan-head settings


Laser.MarkSpeed = 1000
Laser.MarkDelay = 200
Laser.JumpSpeed = 3000
Laser.JumpDelay = 200
Laser.Frequency = 20
Laser.DutyCycle1 = 50
Laser.Power = 50
Laser.LaserOnDelay = 75
Laser.LaserOffDelay = 125
Laser.PolyDelay = 50
Laser.VariPolyDelayFlag = true

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 144 of 197

-- Wait for start signal


IO.WaitForIo(Pin.Din.UserIn1,Trigger.Edge.Rising, 0, 0, true)

-- Wait for this web travel before marking


triggerDistance = 50.

-- Repeat until aborted via external signal


while IO.ReadPin(Pin.Din.UserIn4) == false do
MOTF.WaitForTriggerDistance(triggerDistance)
MOTF.ResetTracking()
MOTF.StartTracking(Tracking.WhileMarking)
Image.Circle(0, 0, 20)
MOTF.StopTrackingAndJump(0, 0, 0, 200)
Laser.WaitForEnd()
end

Report ("Job Finished")

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

--"Scan Master Tcp Communication" string is assigned to variable sendingBytes.


sendingStr = "Scan Master Tcp Communication"
--Convert the string to bytes and assign it to the byteText variable
byteText = String.GetBytes(sendingStr)
--Connects to the Tcp server IP/hostname and the port and returns an instance of tcpSocket
tcpSocket = Network.OpenTcpSocket("192.168.1.102", 5033)
--Sends byteText data to the tcpSocket
tcpSocket.Send(byteText)
--Receive 10 number bytes from tcpSocket,time out is 100000ms. Assign to data variable
data = tcpSocket.Receive(10,10000)
--Display the received data from tcpSocket
Report(data.getstring())
--Disconnects the tcpSocket connection
tcpSocket.Close()

Network OpenTcpSocket
Connects to a TCP server with the specified IP/Host name and Port.

Syntax

Network.OpenTcpSocket( string ip, int port, bool isServer )


Network.OpenTcpSocket( string ip, int port, bool isServer, Function errorFunction )

Parameters

ip string The IP/Host name of the TCP server.


port int Port number of the TCP server.
isServer bool Optional flag to indicate that the SMC should connect as a TCP/IP server. Default is as Client.
errorFunction function An optional function which displays an error message.

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

Returns an instance of TcpSocket.

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

--"Scan Master Tcp Communication" string is assigned to variable sendingBytes.


sendingStr = "Scan Master Tcp Communication"
--Convert the string to bytes and assign it to the byteText variable
byteText = String.GetBytes(sendingStr)
--Connects to the Tcp server IP/hostname and the port and returns an instance of tcpSocket
tcpSocket = Network.OpenTcpSocket("192.168.1.102",5033)
--Sends byteText data to the tcpSocket
tcpSocket.Send(byteText)
--Receive 10 bytes from tcpSocket,time out is 10000ms.
data = tcpSocket.Receive(10,10000)
--Display the received data from tcpSocket
Report(data.getstring())
--Disconnects the tcpSocket connection
tcpSocket.Close()

Shapes
The Shapes library supports the following shapes

Spiral Creates a spiral shape.


Hatch Creates a hatch shape
HatchPattern Creates a hatch pattern

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

--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

--Creates a spiral shape


spiral = Shapes.Spiral()
--Outer end angle of the spiral in degrees
spiral.Angle = 45
--Spiral center point X coordinate
spiral.CenterX = 0.5

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 146 of 197

--Spiral center point Y coordinate


spiral.CenterY = -0.5
--spiral is clockwise or not
spiral.Clockwise = true
--Elevation of the Spiral
spiral.Elevation = 0
--Inner radius of the Spiral
spiral.InnerRadius = 6.25
--Number of inner rotations of the spiral
spiral.InnerRotations = 3
--Outer radius of the Spiral
spiral.OuterRadius = 35.8
--Number of outer rotations of the spiral
spiral.OuterRotations = 0
--Direction of the spiral
spiral.Outwards = false
--Pitch of the Spiral
spiral.Pitch = 2.5
--Whether the marking returns back to start of the spiral
spiral.ReturnToStart = false
--Scans the spiral object with a 0.005 segmentation error
Image.Spiral(spiral, 0.005)

Shape Hatch
Creates an instance of a Hatch shape.

Syntax

hatch = Shapes.Hatch()

Methods

AddHatchPattern(LineHatchPattern linePattern) Adds a hatch pattern to the hatch shape


AddHatchPattern(OffsetHatchPattern OffsetPattern)
AddHatchPattern(OffsetInOutHatchPattern OffsetinoutPattern)
AddHatchPattern(IncrementalHatchPattern IncrementalPattern)
AddHatchPattern(HelixHatchPattern helixPattern)
AddLine(float startPointX,float startPointY,float endPointX,float endPointY) Adds an outline line to the hatch shape
AddBox(float lowerLeftCorner,float lowerLeftCornerY, float width, float height, float angle) Adds an outline box to the hatch shape
AddBox(float lowerLeftCorner,float lowerLeftC ornerY, float lowerLeftCornerZ, float width, float height, float angle)
AddPolyline2D(bool closeFlag,float x1,float y1,float x2,float y2, float arg1, arg2, ...) Adds an outline polyline to the hatch shape
AddPolyline(bool closeFlag,float x1,float y1,float z1,float x2,float y2,float z2, float arg1, arg2,arg3, ...)
AddArc(float centerX,float centerY, float radius , float startAngle , float sweepAngle) Adds an outline arc to the hatch shape
AddArc(float centerX,float centerY, float centerZ, float radius , float startAngle , float sweepAngle)
AddCircle(float centerX,float centerY, float radius) Adds an outline circle to the hatch shape
AddCircle(float centerX,float centerY,float centerZ, float radius)

Properties

MarkingOrder Marking order for the hatch shape

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

LineHatchPattern Creates a line hatch pattern


OffsetHatchPattern Creates an Offset hatch pattern
OffsetInOutHatchPattern Creates an Offset in out hatch pattern
IncrementalHatchPattern Creates an Incremental hatch pattern
HelixHatchPattern Creates a Helix hatch pattern

Return Values

Returns a Hatch Pattern

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.

The Smd type exposes the following commands:

CreateInputBox Creates an InputBox.


ClearOutputWindow Clears the ScanMaster™ Designer output window.
MessageBox Displays a message box on 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.

--Set the units as Millimeters


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Display message in output window


Report("ScanMaster Designer")
Report("ScanMaster ScanScript")
Report("ScanMaster API")
Sleep(2000)
--Clear output window
Smd.ClearOutputWindow()
System.Flush()
Sleep(2000)

--Displays message
Report("Cleared the Output window")

Smd CreateInputBox
Creates an InputBox.

Syntax

inbox = Smd.CreateInputBox()

Methods

AddStringInput Adds an input text box which accepts a string.


AddIntegerInput Adds an input text box which accepts integers.
AddFloatInput Adds an input text box which accepts float values.
ReadInputs Displays the InputBox through ScanMaster™ Designer and waits until the user presses a button.
GetInputs Gets the inputs entered by the user.*This method is capable of getting multiple inputs. This will depend on the number of controls being used in the program.
Title Sets the title of the input box

Return Values

Returns an instance of Inbox.

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

--Set the units as Millimeters


SetUnits(Units.Millimeters)
SetAngleUnits(AngleUnits.Degrees)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Horizontal Text
myText = Text.Horizontal()

myText.Elevation = 0

myText.Height = 12.5

myText.Font = "Arial"

myText.Angle = 0

--Creates an Input Box


inBox = Smd.CreateInputBox()
--Enter a title for the input box
inBox.Title = "User Data"
--Adds an input text box which accepts a String
inBox.AddStringInput("Enter Name")
--Adds an input text box which accepts an integer
inBox.AddIntegerInput("Index Number")

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)

Message box example from above sample.

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

Smd.MessageBox( string message )


Smd.MessageBox( string message, string title )
Smd.MessageBox( string message, string title, Smd.MessageBoxButton button )
Smd.MessageBox( string message, string title, Smd.MessageBoxButton button, Smd.MessageBoxIcon icon )

Parameters

message string Message to be displayed. This is a mandatory argument.


title string Title of the message box
button Smd.MessageBoxButton enumerations The button type
icon Smd.MessageBoxIcon enumerations

Message box icon enumerations.

Error

Information

Question

Warning

Message box button enumerations.

OK
OKCancel
AbortRetryIgnore
YesNoCancel
YesNo
RetryCancel

Return Values

Returns a String representing the pressed button type. Ex: Yes,No

Example
--This example will demonstrate the CreateMessageBox method

--Set the units as Millimeters


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Create message box


message = Smd.MessageBox("Do You wish to apply the default parameters?", "SMD Message", Smd.MessageBoxButton.YesNo, Smd.MessageBoxIcon.Question)

if (message == "Yes") then


--Display the button type that was pressed
Report("User Pressed Yes Button")

else

Report("User Pressed No Button")

end

Message box example from above sample.

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.

Start Starts the stopwatch.


Pause Pauses the recording
Resume Resume recording again
Time Reports the elapsed time.

Example
--This program will scan an Arc text 10 times and it will display the time it takes to scan it each time.

--Inch mode used


SetUnits(Units.Inches)
--Laser Parameter settings
Laser.JumpSpeed = 250
Laser.MarkSpeed = 150
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
Laser.PolyDelay = 50

--Creates a Ring Text object


arcText = Text.Arc()
arcText.CenterX = 0
arcText.CenterY = 0
arcText.Radius = 2
arcText.Elevation = 0
arcText.CharacterGap = 0.0
arcText.Clockwise = true
arcText.Font = "Arial"
arcText.Height = 0.2
arcText.Align = ArcTextAlign.Baseline
arcText.StartAngle = 120
arcText.Text = "ScanMaster ScanScript"

--Initializes the Count variable


count = 1
--While loop start. loop run 10 times
while count<10 do
--Starts the timer
Stopwatch.Start()
Image.Text(arcText)
--Waits until finished
Laser.WaitForEnd()
--Displays per cycle time
Report("Marking Time:" ..Stopwatch.Time().."ms per cycle")
--Increments the Count by 1
count = count + 1
--Loop end
end

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.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000

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

--Creates a Ring Text object


arcText = Text.Arc()
arcText.CenterX = 0
arcText.CenterY = 0
arcText.Radius = 50
arcText.Elevation = 0
arcText.CharacterGap = 0.0
arcText.Clockwise = true
arcText.Font = "Arial"
arcText.Height = 5.2
arcText.Align = ArcTextAlign.Baseline
arcText.StartAngle = 120
arcText.Text = "ScanMaster ScanScript"

--Initializes the Count variable


count = 1

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

--Displays per cycle time


Report("Average Marking Time:" ..(Stopwatch.Time() / count).."ms per cycle")

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.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
Laser.PolyDelay = 50

--Creates a Ring Text object


arcText = Text.Arc()
arcText.CenterX = 0
arcText.CenterY = 0
arcText.Radius = 50
arcText.Elevation = 0
arcText.CharacterGap = 0.0
arcText.Clockwise = true
arcText.Font = "Arial"
arcText.Height = 5.2
arcText.Align = ArcTextAlign.Baseline
arcText.StartAngle = 120
arcText.Text = "ScanMaster ScanScript"

--Initializes the Count variable


count = 1

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

--Displays per cycle time


Report("Average Marking Time:" ..(Stopwatch.Time() / count).."ms per cycle")

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.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
Laser.PolyDelay = 50

--Creates a Ring Text object


arcText = Text.Arc()
arcText.CenterX = 0
arcText.CenterY = 0
arcText.Radius = 50
arcText.Elevation = 0
arcText.CharacterGap = 0.0
arcText.Clockwise = true
arcText.Font = "Arial"
arcText.Height = 5.2
arcText.Align = ArcTextAlign.Baseline
arcText.StartAngle = 120
arcText.Text = "ScanMaster ScanScript"

--Initializes the Count variable


count = 1

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

--Displays per cycle time


Report("Average Marking Time:" ..(Stopwatch.Time() / count).."ms per cycle")

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.

--Millimeters mode used


SetUnits(Units.Millimeters)

--Laser Parameter settings


Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200
Laser.PolyDelay = 50

--Creates a Ring Text object


arcText = Text.Arc()
arcText.CenterX = 0
arcText.CenterY = 0
arcText.Radius = 40
arcText.Elevation = 0
arcText.CharacterGap = 0.0
arcText.Clockwise = true
arcText.Font = "Arial"
arcText.Height = 10
arcText.Align = ArcTextAlign.Baseline
arcText.StartAngle = 120
arcText.Text = "ScanMaster ScanScript"

--Initializes the Count variable


count = 1
--While loop start. loop run 10 times
while count<10 do
--Starts the timer
Stopwatch.Start()
Image.Text(arcText)
--Waits until finished
Laser.WaitForEnd()
--Displays per cycle time
Report("Marking Time:" ..Stopwatch.Time().."ms per cycle")
--Increments the Count by 1
count = count + 1
--Loop end
end

String

CharacterAt Gets the character specified by the index.


Concat Concatenates two specified instances of String.
EndsWith Determines whether the end of this string instance matches the specified String.
Format Create a formatted string from the format and arguments provided.
GetBytes Retrieves a Byte Array from the String.
IndexOf Gets the index of a substring.
LastIndexOf Gets the last index of a substring.
Length Gets the length of the String.
Replace Finds a specified substring and replaces it with a given String.
Split Splits the String with a given delimiter.
StartsWith Determines whether the beginning of the String matches the specified String.
Substring Gets a substring from the specified String.
ToHexString Returns the Hexadecimal representation
ToLower Converts the given String to Lowercase.
ToUpper Converts the given String to Uppercase.
Trim Removes white spaces at the beginning and the end of the string.
TrimLeft Removes white spaces on the left hand side of the String.
TrimRight Removes the white spaces at the end of the 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 assigned to the variable "str"


str = "ScanMaster ScanScript"
for i = 1, String.Length(str),2 do
--Display the characters of the above string
Report(String.CharacterAt(str, i))
end

String CharacterAt
Gets the character specified by the index.

Syntax

CharacterAt( string str, int index )

Parameters

str string The string to seek.


index int The position of the character in the specified str string.

Return Values

Returns a character.

Example
--This program will display the characters that the user specifies.

--String assigned to the variable "str"


str = "ScanMaster ScanScript"
for i = 1, String.Length(str), 2 do
Report(String.CharacterAt(str, i)) --Display the characters of the above string
end

String Concat
Concatenates two specified Strings. You can also use the concatenate operator ".." to concatenate strings.

Syntax

Concat( string str1, string str2 )

Parameters

str1 string The first string to concatenate.


str1 string The second string to concatenate.

Return Values

Returns the concatenated string.

Example
------- This program will describe the String.Concat method.The program will concatenate two strings and mark as arc text.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--First string assigned to variable "str1"


str1 = "ScanMaster ScanScript"
--Second string assigned to variable "str2"
str2 = "Version 1.1"

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 159 of 197

--Creates an ArcText object


arcText = Text.Arc()
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
--Concatenates the two strings
arcText.Text = String.Concat(str1, str2)

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

EndsWith( string str, string strToCheck )

Parameters

str string The string to seek.


strToCheck string The character or string to find at the end of the str string.

Return Values

Returns a boolean value (True/False)

Example
--This program will demonstrate the EndsWith method. The program will check the end character of the specified string and report the results.

--Checks whether the last character is "t"


if String.EndsWith("test","t") then
--Display this message if the last character is "t"
Report("test successful")

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

String.Format( string formatString, arg1, arg2, ... )

Parameters

formatString string The formatted string


arg1, arg2,... Arguments to use for formatting the string.

The syntax of a formatting argument as follows

%[Flags][Width].[Precision]Specifier

Flags

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 160 of 197

0 Left-pads the number with zeroes (0)


+ Precede the result with a plus or minus sign (+ or -) even for positive numbers. By default, only negative numbers are preceded with a - sign.
- Left-justify within the given field width; Right justification is the default
space If no sign is going to be written, a blank space is inserted before the value.
Used with o, x or X specifiers the value is preceded with 0, 0x or 0X respectively for values other than zero.

# 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.

A precision of 0 means that no character is written for the value 0.

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.

Specifier Description Input Output


s String of characters String.Format ("%-12s%+10.8s", "ScanMaster", "Designer1") ScanMaster$$$$Designer
c Character String.Format("%c", 65) A
d Signed decimal integer String.Format("%+5.3d", 3.141592) $+003
i Signed integer String.Format("%+5.3i", 3.141592) $+003
f Decimal floating point String.Format("%+07.3f", 3.141592) +03.142
e Scientific notation (mantissa/exponent) using e character String.Format("%+7.3e", 314.1592) +3.142e+002
E Scientific notation (mantissa/exponent) using E character String.Format("%+7.3E", 314.1592) +3.142E+002
g Use the shorter of %e or %f String.Format("%#7.3g", 314.1592) $$$314.
G Use the shorter of %E or %f String.Format("%#7.3G", 314.1592) $$$314.
u Unsigned decimal integer String.Format("%5.3u", 314.1592) $$314
o Signed octal String.Format("%#5.3o", 314.1592) $0472
x Unsigned hexadecimal integer String.Format("%#5.3x", 314.1592) 0x13a
X Unsigned hexadecimal integer (capital letters) String.Format("%#5.3X", 314.1592) 0X13A

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.

arg1 = "ScanMaster Designer"


arg2 = 65
arg3 = Math.PI

--Formatted string for string type


retString1 = String.Format("%-10.6s", arg1)
--Displays "ScanMa "
Report(retString1)

--Formatted string for char type


retString2 = String.Format("%10c", arg2)
--Displays " A"
Report(retString2)

--Formatted string for float type


retString3 = String.Format("%+010.6f", arg3)
--Displays "+03.141593"
Report(retString3)

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

GetBytes( string str, [Encoding enc] )

Parameters

str string The string to be converted.


Encoding Encoding Desired encoding type, default UTF8

Return Values

Returns an instance of the byte array.

Example SMC
--This program will demonstrate the GetBytes method.

--File location path assigned to location string variable


location = "/mnt/SMC/custom"
--Opens a binary file name called "myfile" in write mode
file1 = File.OpenBinaryFile(location.."/myfile", FileMode.Write)
--Write "ScanMaster ScanScript" string to "myfile"
file1.Write(String.GetBytes("ScanMaster ScanScript"))

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.

--File location path assigned to location string variable


location = "Disk\\custom"
--Opens a binary file name called "myfile" in write mode
file1 = File.OpenBinaryFile(location.."\\myfile", FileMode.Write)
--Write "ScanMaster ScanScript" string to "myfile"
file1.Write(String.GetBytes("ScanMaster ScanScript"))

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

IndexOf( string str, string substring )

Parameters

str string The specified string to seek.


substring string The sub string to locate in str string.

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.

--File location path assigned to location string variable


location = "/mnt/SMC/custom"
--Opens a binary file name called "myfile" in write mode
file1 = File.OpenBinaryFile(location.."/myfile", FileMode.Write)
--Write "ScanMaster ScanScript" string to "myfile"
file1.Write(String.GetBytes("ScanMaster ScanScript"))
--close the written file
file1.Close()
f1= File.OpenBinaryFile(location.."/myfile", FileMode.Read)
-- Read the whole file and returns a byte array
readFile = f1.ReadToEnd()
--Display the file size
Report(f1.Length())
--Display the contents of the file
Report(readFile.GetString())
--Display the index of "Mas" in the specified string
Report(string.IndexOf(readFile.GetString(),"Mas"))

Example EC1000
--This program will demonstrate the Indexof method.

--File location path assigned to location string variable


location = "Disk\\custom"
--Opens a binary file name called "myfile" in write mode
file1 = File.OpenBinaryFile(location.."\\myfile", FileMode.Write)
--Write "ScanMaster ScanScript" string to "myfile"
file1.Write(String.GetBytes("ScanMaster ScanScript"))
--close the written file
file1.Close()
f1= File.OpenBinaryFile("Disk\\custom\\myfile", FileMode.Read)
-- Read the whole file and returns a byte array
readFile = f1.ReadToEnd()
--Display the file size
Report(f1.Length())
--Display the contents of the file
Report(readFile.GetString())
--Display the index of "Mas" in the specified string
Report(string.IndexOf(readFile.GetString(),"Mas"))

String LastIndexOf
Gets the last index of a substring.

Syntax

LastIndexOf( string str, string substring )

Parameters

str string The specified string to seek.


substring string The sub string to locate in str string.

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 location path assigned to location string variable


location = "/mnt/SMC/custom"

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 163 of 197

--Opens a binary file name called "myfile" in write mode


file1 = File.OpenBinaryFile(location.."/myfile", FileMode.Write)
--Write "ScanMaster ScanScript" string to "myfile"
file1.Write(String.GetBytes("ScanMaster ScanScript"))
--Close the written file
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())
--Display the index of "c" in the specified string
Report(string.LastIndexOf(readFile.GetString(),"c"))

Example EC1000
--This program will demonstrate the LastIndexOf method.

--File location path assigned to location string variable


location = "Disk\\custom"
--Opens a binary file name called "myfile" in write mode
file1 = File.OpenBinaryFile(location.."\\myfile", FileMode.Write)
--Write "ScanMaster ScanScript" string to "myfile"
file1.Write(String.GetBytes("ScanMaster ScanScript"))
--Close the written file
file1.Close()
f1= File.OpenBinaryFile("Disk\\custom\\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())
--Display the index of "c" in the specified string
Report(string.LastIndexOf(readFile.GetString(),"c"))

String Length
Gets the length of the specified String.

Syntax

Length( string str )

Parameters

str string The string to seek.

Return Values

The number of characters in the specified string.

Example
--This program will demonstrate the String.Length method.

--String assign to variable "str"


str = "ScanMaster ScanScript"
for i = 1, String.Length(str),2 do
Report(String.CharacterAt(str,i))--Display the specified characters of string str
end

String Replace
Finds a specified substring and replaces it with a given String.

Syntax

Replace( string str, string find, string replace )

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 164 of 197

Parameters

str string The string to seek.


find string The specified substring to be located in str.
replace string The string that will replace the substring.

Return Values

Returns an instance of the modified string.

Example
--This program will demonstrate the String.Replace method.

--"ScanMaster ScanScript"string assigned to variable "str"


str = "ScanMaster ScanScript"
--Display the replaced string
Report(String.Replace(str,"Script", "Version 1.1"))

String Split
Splits the String with a given delimiter.

Syntax

Split( string str, string delimiter )

Parameters

str string The string to be split.


delimiter string The specified delimiter to split str.

Return Values

Returns an instance of a string array.

Example
--This Program will demonstrate the String.Split method.

--Split the string from the space


strArray = String.Split("ScanMaster ScanScript", " ")
--Insert "Version 1.1" string to the array
strArray.Insert(2, "Version 1.1")

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

StartsWith( string str, string strToCheck )

Parameters

str string The string to seek.


strToCheck string The sub string to be searched for in str.

Return Values

Return a boolean value.

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.

--"ScanMaster ScanScript" string assigned to variable "str"


str = "ScanMaster ScanScript"
--Check for the string "Scan" at the start of the "str" string
if (String.StartsWith(str, "Scan")) then
Report("Test is True")
else
Report("Test is False")
end

String Substring
Gets the substring from the specified String. The substring starts at a specified character position and has a specified length.

Syntax

Substring( string str, int startIndex, int length )

Parameters

str string The String to seek.


startIndex int The starting character position of the substring.
length int The number of characters in the substring.

Return Values

extracted substring

Example
--This Program will demonstrate the Substring operation.

--String assign to variable "str"


str = "ScanMaster ScanScript"
--Display three characters starting from the 5th character.
Report(String.Substring(str, 5, 3))

String ToHexString
Returns the Hexadecimal representation of the Integer that was passed as the argument.

Syntax

ToHexString( int value )

Parameters

value int The value to be converted to Hexadecimal.

Return Values

Returns a Hexadecimal value as a string.

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"

--For loop increments by 2


for j = 0, 49, 2 do
--Left shift by 3 position
i = BitOp.ShiftLeft(j, 3)
--Display the result j,i and the hexadecimal value of the Left shifted value
Report(j.." "..i.." "..String.ToHexString(i))
end

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

ToLower( string str )

Parameters

str string The string to convert to lowercase.

Return Values

A string in lowercase.

Example
--This program will demonstrate the ToLower method.

--String assign to variable "str"


str = "ScanMaster ScanScript"
--Display the lowercase version of the string.
Report(String.ToLower(str))

String ToUpper
Converts the given String to Uppercase.

Syntax

ToUpper( string str )

Parameters

str string The string to convert to Uppercase.

Return Values

A string in Uppercase.

Example
--This program will demonstrate the ToUpper method.

--String assign to variable "str"


str = "ScanMaster ScanScript"
--Display the uppercase version of the string.
Report(String.ToUpper(str))

String Trim
Removes white spaces at the beginning and the end of the string.

Syntax

Trim( string str, )

Parameters

str string The string to be trimmed.

Return Values

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 167 of 197

Returns a trimmed string.

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

TrimLeft( string str )

Parameters

str string The string to be trimmed.

Return Values

Returns a trimmed string.

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

TrimRight( string str )

Parameters

str string The string to be trimmed.

Return Values

Returns a trimmed string.

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

MarkingMode Gets the marking mode of the card (traditional/scanpack).


FriendlyName Gets the Friendly name of the system as a string
CalFactorX Gets the X Cal Factor in bits/mm(24 bit).
CalFactorY Gets the Y Cal Factor in bits/mm(24 bit).
CalFactorZ11 Gets the Z Cal Factor in bits/mm(24 bit).

Methods

Abort This method aborts the system when executed.


Beep Generate a tone
CalibrateJumpTime Performs the jump time calibration for open loop via hole drilling
ClearingMove Calculates and executes a galvo clearing move.
DeviceType Returns the device type name.
DisableHeadTransforms Disables the head transform logic for both heads.
DisableZCompensation Disables Z axis compensation
DisableSettleChecking Disables the settle checking
DisableDryRunMode Disables the dry run mode
DisableCmdDataBuffering Enables or Disables the use of command data output FIFO buffering.
EnableSettleChecking Enables the settle checking and sets the parameters
EnableZCompensation Enables Z axis compensation
EnableDryRunMode Set the scanning mode to dry run mode.
EnableJumpAsLink Enables or Disables the use of Scanpack links in place of traditional jumps.
Flush Flushes currently buffered commands to the device.
IsStandAlone Returns whether the job is running on stand alone mode.
ReceiveCommand Waits until the given command is received from the ScanMaster™ API and returns the relevant arguments.
ReceiveCommandAsync Registers the specified event handler for the given command.
ResetHeadTransform Resets the transform to unity for the selected head.
ScriptingVersion Returns the version of the script engine.
Reboot Reboots the controller
SendCommand Sends the command and the arguments to ScanMaster™ API.
SetActiveCorrectiontable Sets the Currently active Correction table.
SetSystemDateTime Sets the controller date and time
SetHeadOffset Sets the head offsets for the selected head.
SetHeadScale Sets the axis scale for the selected head.
SetHeadRotation Sets the angular field rotation for the selected head.
SetHeadTransform Sets an arbitrary 2D linear transform matrix for the head.
SetGalvoCmdMarker Inserts a marker into the galvo command stream that permits hardware triggering of the Lightning-II probe system.
SetIPGateway
CalFactor Gets the system calibration factor for a specified axis
GSBusDisable Disable or enable active diving of the GSBus by the SMC
SyncWithHostTime Sync the current time with the system
Path Local file system functions

Example
--This example will demonstrate the Flush command. It will receive the text for the DataMatrix barcode from serial communication.

--Inch mode used


SetUnits(Units.Inches)
--Laser Parameter settings
Laser.JumpSpeed = 250
Laser.MarkSpeed = 150
--Delay settings
Laser.JumpDelay = 150

Laser.MarkDelay = 200

--Assign Datamatrix code to "var" variable


var = Barcodes.DataMatrix()
--Barcode height is 0.5
var.Height = 1
--x position of the barcode
var.X = 0.5
--Y position of the barcode
var.Y = 0.5
--Matrix size is 16x16
var.MatrixSize = DataMatrixSize.S16x16
--Apply Dot hatch pattern
var.HatchStyle = HatchStyle.Dot
--Pulse duration is 100us
var.DotDuration = 100
--Options: default,industry,macro_05,macro_06
var.Format = DataMatrixFormat.Industry

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

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

for i = 10.0, 30, 2.5 do


Image.Circle(0, 0, i)

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.

Note: This is supported only on the SMC.

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.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Print the cal factors


Report("The X and Y calibration factors are: "..System.CalFactorX .." and ".. System.CalFactorY)

System CalibrateJumpTime
Performs the jump time calibration for open loop via hole drilling

Syntax

EnableSettleChecking(int HeadToCalibrate,int fieldSize, int pitchSize, bool logToFile, CalJumpTimeAvgMode calJumpTimeAvgMode)

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

Axis int Select the axis to clear: 0 = X, 1 = Y, 2 = Z


accel float Max acceleration at turn-around in mm/sec^2
accelRatio float Ratio of starting acceleration to the max acceleration
startPos float Field position for the start of the move.
endPos float Field position for the turn-around

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

--Millimeters mode used


SetUnits(Units.Millimeters)

--Laser Parameter settings


Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Display the Device type name


Report(System.DeviceType())

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

------ This program will describe Z axis compensation


--
--Set the units as Millimeters
SetUnits(Units.Millimeters)
SetAngleUnits(AngleUnits.Degrees)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Draws a rectangle in Z = 0 (correct focal point)


Image.Box(0, 0, 25, 50, 0, 0)

--Enabling the Z compensation


System.EnableZCompensation()

--Draws a rectangle in Z = -3
Image.Box(0, 0, 25, 50, 0, -3)

--Disable the Z compensation


System.DisableZCompensation()

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

--Millimeters mode used


SetUnits(Units.Millimeters)

--Laser Parameter settings


Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000

--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Draws a rectangle in Z = 0 (correct focal point)


Image.Box(0, 0, 1, 2, 0, 0)

--Enabling the Z compensation


System.EnableZCompensation()

--Draws a rectangle in Z = -3
Image.Box(0, 0, 1, 2, 0, -3)

--Disable the Z compensation


System.DisableZCompensation()

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

Set the units as Millimeters


SetUnits(Units.Millimeters)
SetAngleUnits(AngleUnits.Degrees)
Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
Delays settings

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 = 0 (correct focal point)


Image.Box(0, 0, 25, 50, 0, 0)

Enabling the Z compensation


System.EnableZCompensation()

Draws a rectangle in Z = -3
Image.Box(0, 0, 25, 50, 0, -3)

Disable the Z compensation


System.DisableZCompensation()

System EnableDryRunMode
Set the scanning mode to dry run mode.

Syntax

EnableDryRunMode(LaserVariable dryRunLaserProfile)
EnableDryRunMode(LaserVariable dryRunLaserProfile, DryRunMode dryrunMode)

Parameters

dryRunLaserProfile LaserVariable Laser parameters to use during the dry running


dryrunMode DryRunMode Dry run mode

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

settleCheckMode SettleCheckMode Selects the checking behavior.


settleCheckPort SettleCheckPort Ports used to validate the settle-checking behavior
settleCheckMask int Bits to consider (hex) in 32-bit units
settleCheckValue int Bit values when settled (hex) in 32-bit units
settleCheckTimeout int defines how long to wait (in usec) for value to match the mask.
settleCheckDelay int How long to wait (in μsecs) before checking for settling after initiating a jump.

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

status bool Enable or Disable Jump as link processing

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

-- We create a bi-directional hatch to illustrate the JumpAsLink behavior

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.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150

Laser.MarkDelay = 200

--Assign Datamatrix code to "var" variable


var = Barcodes.DataMatrix()
--Barcode height is 0.5
var.Height = 25
--x position of the barcode
var.X = 0.5
--Y position of the barcode
var.Y = 0.5
--Matrix size is 16x16
var.MatrixSize = DataMatrixSize.S16x16
--Apply Dot hatch pattern
var.HatchStyle = HatchStyle.Dot
--Pulse duration is 100us
var.DotDuration = 100
--Options: default,industry,macro_05,macro_06
var.Format = DataMatrixFormat.Industry

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.

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150

Laser.MarkDelay = 200

--Device friendly name and type


Report("The System friendly name is: "..System.FriendlyName.." and Device type is: "..System.DeviceType())

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

disabledState bool Enable or Disable Gbus channels

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

Returns a boolean value (True/False).

Example
--This program will mark only when the system is running on Standalone mode

--Location of job files


if (System.DeviceType() == "SMC") then
location = "/mnt/SMC/Jobs/"
elseif (System.DeviceType() == "EC1000") then
location = "Disk\\lec\\jobs\\"
else
location = "D:\\test\\jobs\\"
end

--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

Smd.MessageBox("System is not running on Standalone mode","Job Marking",Smd.MessageBoxButton.OK,Smd.MessageBoxIcon.Error)

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

Returns the marking mode as traditional/scanpack.

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

Returns a string of the path for each system folder location

Example
--This program will demonstrate the methods text File read-write operation

--Opens a text file named "txtfile" in read-write mode

--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)

--Gets the current position of the file


pos = readFile.Position()
--Gets the length of the file
length = readFile.Length()

--Seek the file from the beginning


readFile.Seek(0,FileSeek.Begin)
--Check file is at the end
while (pos < length) do
--Gets the current position
pos = readFile.Position()
--Read the byte from the current position
readValue = readFile.ReadLine()

pos = pos + String.Length(readValue)

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 178 of 197

--Display the data


Report(readValue.." (Length of the string is "..pos..")")

end

--Close the read file


readFile.Close()

System ReceiveCommand
Waits until the given command is received from the ScanMaster™ API and returns the relevant arguments.

Syntax

arg1 = System.ReceiveCommand( string command )

Parameters

command string The command sent by the ScanMaster™ API

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

--Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Creates a horizontal text string


myText = Text.Horizontal()

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

--Send the "GetNextText" string command to ScanMaster™ API


System.SendCommand("GetNextText")

--Following command blocks until the command is received from API


--Received command string is assign to "textRecived" variable
textRecived = System.ReceiveCommand("GetNextText")
--MarkText function calling
MarkText(textRecived)

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" )

-- To wait the script running


for i = 1, 1000 do

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

System.ReceiveCommandAsync( string command string eventHandlerName )

Parameters

command string The command sent by the ScanMaster™ API


eventHandlerName string Event handler name in the script

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

----Millimeters mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000

--Delays settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Creates a horizontal text string


myText = Text.Horizontal()

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

--Send the "GetNextText" string command to ScanMaster API


System.SendCommand("GetNextText")

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 180 of 197

--Following command blocks until the command is received from API


--Received command string is assign to "textRecived" variable
textRecived = System.ReceiveCommand("GetNextText")
--MarkText function calling
MarkText(textRecived)

--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

HeadNum int Select the Head Number(Either 1 or 2)

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.

--Inch mode used


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000

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

--Script version and device type


Report("The Script version is "..System.ScriptingVersion().." and Device type is "..System.DeviceType())

System SendCommand
Sends the command and the arguments to ScanMaster™ API.

Syntax

System.SendCommand( string command [, string arg1, string arg2,...] )

Note: you can pass as many arguments as required

Parameters

command string The command that is passed to the API


arg1 string Arguments related to the command
arg2 string Arguments related to the command

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

--Creates a horizontal text string


myText = Text.Horizontal()

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

--Send the "GetNextText" string command to ScanMaster™ API


System.SendCommand("GetNextText")

--Following command blocks until the command is received from API


--Received command string is assign to "textRecived" variable
textRecived = System.ReceiveCommand("GetNextText")
--MarkText function calling
MarkText(textRecived)

--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" )

-- To wait the script running


for i = 1, 1000 do

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

System.SetActiveCorrectionTable( int CorrectionTable )

Parameters

CorrectionTable int correction table pair to use

Values

1 correction table 1 and 3


2 correction table 2 and 4

Note:This method is currently supported with the EC1000 card only.

Example
------------------- System SetActiveCorrectionTable ------------------------

----- This program will demonstrate the SetActiveCorrectiontable method.

--Unit is set to Millimeters


SetUnits(Units.Millimeters)
--Set angle units as Radians
SetAngleUnits(AngleUnits.Radians)

--Laser Parameter settingS


Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Set the Active correction table 1 and 3


System.SetActiveCorrectionTable(1)
--Marking the 1 inch Box
Image.Box(0, 0, 25, 25)
--Set the Active correction table 2 and 4
System.SetActiveCorrectionTable(2)
--Tracing the 1 inch box
Image.Box(0, 0, 25, 25)

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

System.SetHeadOffset (int HeadNum, int xOffset, int yOffset)

Parameters

HeadNum int Select the Head Number(Either 1 or 2)


xOffset int X Offset in User Units
yOffset int Y Offset in User Units

Example

System SetHeadRotation
Sets the angular field rotation for the selected head.

Syntax

System.SetHeadScale(int HeadNum, float rotation, bool [incremental])

Parameters

HeadNum int Select the Head Number(Either 1 or 2)


rotation float Rotation in degrees
incremental bool Optional argument. If true, then apply the scaling incrementally

Example

System SetHeadScale
Sets the axis scale for the selected head.

Syntax

System.SetHeadScale(int HeadNum, int xScale, int yScale, bool [incremental])

Parameters

HeadNum int Select the Head Number(Either 1 or 2)


xScale int X Offset in User Units
yScale int Y Offset in User Units
incremental bool Optional argument. If true, then apply the scaling incrementally

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

HeadNum int Select the Head Number(Either 1 or 2)


M00 float 2x2 matrix coefficient M00. Must be greater than -2.0 and less than +2.0

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

gatewayIPAddress string IP address of the gateway.


append bool All the existing nameservers will be deleted before setting the given IP if Append is False.

Example

System SetSystemDateTime
Set the given date and time as current date time of the system.

Syntax

System.SetSystemDateTime( DateTime dateTime )

Parameters

dateTime DateTime new date & time

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

Following methods are supported

Create Creates a Serial Number object.


NumberSequence Creates an instance of a NumberSequence object.
FixedLengthText Creates an instance of a fixed text string.
UserName Creates an instance of a user name object.
DateCode Creates an instance of a date code object.
TimeCode Creates an instance of a time code object.
SaveState Save the current state of the specified variable.
LoadState load the state of the specified variable from the last snap taken.
RemoveState Removes the snap of the specified serialization variable.

The serial number object supports following functions

Add(NumberSequence numberSequence) Add a number sequence to serial variable


Add(FixedLengthText fixedLengthText) Add a fixed length text to serial variable
Add(UserName username) Add a User name to serial variable
Add(DateCode datecode) Add a Date code to serial variable
Add(TimeCode timecode) Add a Time code to serial variable
CreateNextState() Increment the serial number to the next state.
Text Gets the present output from the object

Example
snvar = SerialNumber.Create();

textSerialNo = SerialNumber.FixedLengthText("Serial # : ");


ns = SerialNumber.NumberSequence(100000,1)

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

Serial Number Number Sequence


Creates a number sequence with the given start number and increment.

Syntax

number = SerialNumber.NumberSequence (startingValue, Increment, [EndValue], [fixedLength], [repeatCount])

Parameters

startingValue int Number sequence will start from this value.


increment int Amount to increment during each increment
endValue int Ending value. The next increment will reset the serial number to the startingValue (Optional parameter)
fixedLength int The number of digits in the serial number. Leading zeros will be added if required. (Optional parameter)
repeatCount int Number of times to be repeated without incrementing the number. (Optional parameter)

Properties

StartValue Gets the number sequence start value.


Increment Gets the increment of the sequence
EndValue Ending value. The next increment will reset the serial number to the startingValue (Optional parameter)
FixedLength The number of digits of the serial number. Leading zeros will be added if required. (Optional parameter)
RepeatCount Number of times to be repeated without incrementing the number. (Optional parameter)
Currentvalue The present value after the last increment
Fixedlength The number of digits in the serial number. Leading zeros will be added if required. (Optional parameter)
resettime1 The serial number will reset back to the starting value once this time is reached
resettime2 The serial number will reset back to the starting value once this time is reached
resettime3 The serial number will reset back to the starting value once this time is reached
Numbersystem Specifies the output format of the serial number using NumberSystem enumeration

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024
ScanScript Page 186 of 197

Return Values

Instance of the NumberSequence object

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

Serial Number Date Code


Creates an instance of a date code object.

Syntax

timeObject = SerialNumber.DateCode([year, month, day])

Parameters

year int year The year (1 through 9999).


month int The month (1 through 12).
day int The day (1 through the number of days in month).

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

[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

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)

Serial Number Time Code


Creates an instance of a Time code object.

Syntax

timeObject = SerialNumber.TimeCode([hour, minute, second])

Parameters

hour int The hours (0 through 23).


minute int The minutes (0 through 59).
second int The seconds (0 through 59).

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

[hh] - Returns the hour using 12 hour clock


[HH] - Returns the hour using 24 hour clock
[mm] - Returns minutes in two digits, of the current time
[ss] - Returns seconds in two digits, of the current time
[tt] - Returns either "am" or "pm" based on the time of the day

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)

Serial Number Fixed Length Text


Creates an instance of a fixed text string.

Syntax

textObject = SerialNumber.FixedLengthTtext([textString])

Parameters

textString string The fixed length text

Properties

Text Get or set the text string

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)

Serial Number User Name


Creates an instance of a user name object.

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

-- This will print the logged in user name


userName1= SerialNumber.UserName()
snvar = SerialNumber.Create();

textPrefix = SerialNumber.FixedLengthText("Username: ");


snvar.Add(textPrefix)
snvar.Add(userName1)

serialString = snvar.Text()

if( String.Length( serialString ) > 10 ) then


report(serialString)
myText.Text = serialString
Image.Text(myText)
else
Error("User not loggedon to SMD")
end

Serial Number New Line


Creates an instance of a new line object.

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

Serial Number LoadState


Loads the last saved state of the serial number to the variable specified by parameter “var”. The function will first try to find a file which is unique to this variable by
combining the specified prefix and the name of the variable. If the file is found it will first determine whether the file has expired by comparing the date written and the
specified Expiry time. Then it will try to load the content of the file to the variable. The function will re turn “true” if the loading is successful.

Syntax

local success = SerialNumber.LoadState(var)

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)

if sucess == true then


Report("loading sucess")
Report(var.Text())

snText.Text = var.Text()
Image.Text( snText)
else
Report("loading failed")
end

Serial Number SaveState


It is possible to save the state of a serial number and load it later to continue the operation. This option can be used to stop the marking process at some point during the
operation, and then continue from the exact state, later. The state will be stored in a file on SMC card and retrieved by specifying the variable name. To save a unique instance
of the serial number, user may combine a prefix, and use the same prefix later during the loading time. This option will enable to keep multiple instances of the serial number
in a complex marking environment. Additionally, an expiry time for the saved state can be defined, to specify a time period which the saved sated is valid to use.

Syntax

Specifying the file name prefix

SerialNumber.Settings.FileNamePrefix = [Prefix]

Specifying the expiry time

SerialNumber.Settings.ExpiryTime = [time in days]

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.

Saving the Status

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

Serial Number RemoveState


Removes the last saved state of the serial number. The function will first try to find a file which is unique to this variable by combining the specified prefix and the name of
the variable. If the file is found it will remove the file from SMC card

Syntax

local success = SerialNumber.RemoveState(var)

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)

local sucess = SerialNumber.LoadState(var)

if sucess == true then


Report("loading sucess")
Report(var.Text())

snText.Text = var.Text()
Image.Text( snText)
else
Report("loading failed")
end

Text
Implements Text handling functions for horizontal and arc text

Horizontal Creates and returns a Horizontal Text object.


Arc Creates and returns a Arc Text object.

Example
--This program will scan the text "Scan Master Script".

--Laser Parameter settings


Laser.JumpSpeed = 250
Laser.MarkSpeed = 150
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

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.

To embed a font, In ScanMaster Designer

1. Select Project Explorer tab.

2. Click Project Settings. The Project Settings window will be displayed.

3. Select Text Embeds tab.

4. Select a font from the available list on the left pane .

5. Select Embed Format from the right pane and click OK.

Character Gap

Character spacing is applied in the following manner:

A- Space before the character starts

B- Character width

C- Space after the character

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

Align ArcTextAlign.Baseline, ArcTextAlign.Ascender, ArcTextAlign.Descender, ArcTextAlign.Center.


CenterX The x coordinate of the circular text path's center.
CenterY The y coordinate of the circular text path's center
CharacterGap The gap between two characters.
Clockwise true - clockwise , false - counter clockwise.
DotDuration Sets the dot duration for Dot Fonts.
Elevation Z axis elevation of the text.
EvaluateVariableTags Gets or Sets whether the variable tags should be evaluated and substituted with present values.
Font The font of the text.
Hatch Apply a hatch to the Arc text shape.
Hatch.Angle Angle of the hatch lines in current angle units.
Hatch.Style Sets the line hatch Style
Hatch.LineSpace Sets the gap between 2 consecutive hatch lines
Hatch.RepeatCount Sets the number of times the hatch should repeat. Default 1.
Height The height of the text.
MarkingOrder Gets or sets the order in which the hatch and the outline will be marked.
Radius The radius of the circular text path.
StartAngle Start angle of the text along the circle path from the positive X-axis. This can have +/- values in current angle unit.
ScaleX Sets and gets length wise scaling
Text Sets the text associated
TransformationMatrix Gets or sets the transformation matrix

Methods

addhatchpattern(HatchPattern hatchPattern) Add a Hatch pattern.


GetSweepAngle() Get the sweep angle of the arc text object..

Return Values

Returns an instance of a Text object type.

Example
--This program will scan text around a circular path.

--Set units as Millimeters


SetUnits(Units.Millimeters)
--Laser Parameter settings
Laser.JumpSpeed = 2000
Laser.MarkSpeed = 1000
--Delay settings
Laser.JumpDelay = 150
Laser.MarkDelay = 200

--Creates a ArcText object


arcText = Text.Arc()

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

arcText.Text = "ScanMaster ScanScript"


Image.Text(arcText)

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

Angle Sets the angle of the text in current angle unit.


CharacterGap Sets the gap between two characters.
DotDuration Sets the dot duration for Dot Fonts.
Elevation Sets the Z axis elevation of the text.
EvaluateVariableTags Gets or Sets whether the variable tags should be evaluated and substituted with present values.
Font Sets the font of the text.
Hatch Apply a hatch to the Arc text shape.
Hatch.Angle Angle of the hatch lines in current angle units.
Hatch.Style Sets the line hatch Style
Hatch.LineSpace Sets the gap between 2 consecutive hatch lines.
Hatch.RepeatCount Sets the number of times the hatch should repeat. Default 1.
Height Sets the height of the text.
MarkingOrder Gets or sets the order in which the hatch and the outline will be marked.
ReferencePositionStyle Gets or sets the reference position used to transform this text shape.
ScaleX The X direction of the scale factor.
ScaleY The Y direction of the scale factor.
Text Sets the text associated
TransformMatrix Gets or sets the transformation matrix
x Sets the X coordinate of the text starting position.
y Sets the Y coordinate of the text starting position.

Methods

addhatchpattern(HatchPattern hatchPattern) Add a Hatch pattern.


getboundary() Get the tight bounding box of the text object.

Return Values

Returns an instance of the object type Text.

Example
--This program will scan the text "Laser Scanning".

--Set units as inches


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 = 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.

Create Creates and returns a process control object.


Disable Disable a main process control feature.
Enable Enable a main process control feature.

Example
--This program will describe the Process Control feature.

--Enable a main process control feature


PC.Enable()
--Create a process control object
pc1 = PC.Create()
--Enable regional adjust port
pc1.EnableRegionalAdjust(RegionalAdjustPort.Port0)

--Set Input and Output for process control


pc1.Input = PCInput.SMC_ADC1
pc1.Output = PCOutput.LaserPower

--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

pcInput PCInput Procses Control's Input.


pcOutput PCOutput Laser Output.
regionalAdjustPort RegionalAdjustPort Regional adjust port.

Methods

Disable Disable process control feature.


DisableRegionalAdjust Disable a regional adjust port for current object.
Enable Enable process control feature.
EnableRegionalAdjust Enable a regional adjust port for current object.
Input Set the process control input.
Output Set the laser output.
Transform Apply transformation for current object.

Return Values

Returns a process control object.

Example
--This program will describe the Process Control feature.

--Enable a main process control feature


PC.Enable()
--Create a process control object

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)

--Set Input and Output for process control


pc1.Input = PCInput.SMC_ADC1
pc1.Output = PCOutput.LaserPower

--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.

--Disable a main process control feature


PC.Disable()

ProcessControl Enable
Enable a process control feature.

Syntax

PC.Enable()

Example
--This program will demonstrate how to enable a process control feature.

--Enable a main process control feature


PC.Enable()

file:///C:/Users/Ragunanth.Venkatesh/AppData/Local/Temp/~hhA274.htm 28/06/2024

You might also like