Feature Arrays

When a feature is measured more than once during routine execution, a feature array is automatically created. The number of elements in the feature array is equal to the number of times the feature has been executed.

If a measured circle object were located in a while loop that executed five times, then an array of five measured circles would exist. If the id of the measured circle were "Circle1", then an array expression could be used to access individual instances of the measured circle object. Square brackets are used to indicate the instance desired.

ASSIGN/V1=Circle1[3].X
V1 is assigned the measured X value of the third instance of Circle1.

When a feature array exists for a given feature, but array notation is not used in a reference to that feature, the most recent instance is used. From the above example, the reference Circle1.X would be the same as Circle1[5].X, since the fifth instance would be the most recent instance of the object.

Expressions can be used within the square brackets of an array expression. Circle1[3].X and Circle1[2+1].X would therefore be equivalent. The following example uses a loop to print out the measured centroid of the five circles from the examples above.

ASSIGN/V1=1
While/V1<6
Comment/Rept,"Centroid of instance #"+V1+" of Circle1:  "+Circle1[V1].XYZ
ASSIGN/V1=V1+1
End/While

Possible output from the above example:

Centroid of instance #1 of Circle1:  3.4, 2.6, 1.43

Centroid of instance #2 of Circle1:  4.4, 3.6, 2.43

Centroid of instance #3 of Circle1: 5.4, 4.6, 3.43

Centroid of instance #4 of Circle1: 6.4, 5.6, 4.43

Centroid of instance #5 of Circle1:  7.5, 6.6, 5.43

Arrays also exist on dimensions and alignments that have been executed multiple times in a given execution run. Thus, Dim1[2].Nom and Align1[4].Origin would be available given that the Dimension "Dim1" has executed at least twice and the alignment "Align1" has executed at least four times.

If a feature array reference is out of bounds (for example, the user asks for Circle1[2.5] or > Circle1["Hello, World"]) the upper or lower bound item is returned. If Circle1 had 3 instances then Circle1[4] and above would return the value for Circle1[3] and Circle[0] and below would return the value for Circle1[1]. All expressions between square brackets are coerced to integer, thus 2.5 would become 2 and "Hello World" would become 0.