Point Arrays Within Script Commands And Expressions - Omron CX-SUPERVISOR - SCRIPT REFERENCE REV2.0 Reference Manual

Script language
Table of Contents

Advertisement

OMRON
For instance, in order to dynamically change the Boolean point a toggle button is linked to follow
these steps.
1, 2, 3...

Point Arrays within Script Commands and Expressions

It is possible to access the elements of a point array directly or indirectly from within scripts or
expressions.
Setting the value of an array point directly;
arraypoint[2] = 30
Getting the value of an array point directly;
value = arraypoint[2]
Setting the value of an array point using indirection;
textpoint = "arraypoint"
^textpoint[2] = 30
Getting the value of an array point using indirection;
textpoint = "arraypoint"
value = ^textpoint[2]
An example using Point Arrays
The value of array points can be seen in a situation where it is necessary to dynamically change the
pointname that an object is linked to. In the following example a toggle button is configured to
control the Boolean state of one of four elements of an array point.
The Boolean array point 'motor' is configured to contain 4 elements.
The integer point 'index' (which has a range 0-3) is used to dynamically change the element of the
point being controlled.
Revision 2.0
1.
Link the toggle button to a textpoint using indirection e.g. ^textpoint.
2.
Link the following script code to run as required. e.g. on clicking a button.
Text = ValueToText(index)
TextPoint = "motor" + text
3.
The ValueToText function converts the integer value of the point 'index' into a
string held in the textpoint 'text'. Therefore the point 'text' contains either '1',
'2', '3' or '4'. The expression 'motor' + text appends the contents of the point
'text' to the literal string 'motor'.
'motor1', 'motor2', 'motor3' or 'motor4' dependant on the value of 'index'.
Change the value of the 'index' to determine which Boolean point to control.
e.g. via the Edit Point Value (Analogue) animation.
CHAPTER 4 – CX-Supervisor Script Language
Therefore 'textpoint' contains either
Page 27

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cx-supervisor 2.0

Table of Contents