#### Hit Arrays

The hits of a given feature are available as an array and can be accessed via expressions using array syntax of the form <FeatID>.Hit[<Array Expression>].<Extension> or the form <FeatID>.RawHit[<Array Expression>].<Extension>. Hit returns probe compensated data when probe compensation is on. RawHit always return uncompensated data. Valid extensions are X, Y, Z, I, J, K, TX, TY, TZ, TI, TJ, TK, XYZ, TXYZ, IJK, and TIJK

Circle1.Hit[1].XYZ | The measured centroid (probe compensated) of hit 1 of "Circle1".
Circle1.Hit[2].IJK | The measured vector of hit 2 of "Circle1"

Hit data is available for all objects that have hits, whether the actual hits are displayed in the edit window or not. Thus, hits can be obtained for scans and auto features.

The following topics describe some additional array functions that are useful for finding the minimum or maximum points in a scan:

Assigning a Range of Hits to an Array

You can also assign a range of hits to an array by using this syntax:

<Feature Id>.<Hittype>[<Startnum>..<Endnum>].<Extension>

where

<Feature Id> is the name of the feature

<Hittype> can be either the word "HIT" for compensated data or "RAWHIT" for uncompensated data. If probe compensation if turned off, the returns values are always uncompensated.

<Startnum> is an expression that identifies the first index value of the range of hits

<Endnum> is an expression that identifies the second index value of the range of hits

<Extension> identifies the type of data. Possible extensions include these measured or theoretical data types:

- X – Measured X values of the hits

- Y – Measured Y values of the hits

- Z – Measured Z values of the hits

- XYZ – Measured XYZ values of the hits

- I – Measured I values of the hits

- J – Measured J values of the hits

- K – Measured K values of the hits

- IJK – Measured IJK values of the hits

- TX – Theoretical X values of the hits

- TY – Theoretical Y values of the hits

- TZ – Theoretical Z values of the hits

- TXYZ – Theoretical XYZ values of the hits

- TI – Theoretical I values of the hits

- TJ – Theoretical J values of the hits

- TK – Theoretical K values of the hits

- TIJK – Theoretical IJK values of the hits

For example,

ASSIGN/V1 = SCAN1.HIT[1..10].X | V1 is assigned to an array of 10 values which are the measured X values from the first 10 hits of SCAN1.
ASSIGN/V2 = SCAN1.HIT[1..SCAN1.NUMHITS].XYZ | V2 is assigned to an array of points from each of the centroids of the hits in the scan.

Sorting Arrays

PC-DMIS allows you to sort arrays in either ascending or descending order. The following two expressions take an array and return a sorted array:

To sort in ascending order use: SORTUP(<array>) | To sort in descending order use: SORTDOWN(<array>)

For example,

ASSIGN/V1 = ARRAY(5,8,3,9,2,6,1,7) | V1 is assigned the array of "5,8,3,9,2,6,1,7"
ASSIGN/V2 = SORTUP(V1) | V2 will hold the array values sorted in ascending order: "1,2,3,5,6,7,8,9"
ASSIGN/V3 = SORTDOWN(V1) | V3 will hold the array values sorted in descending order: "9,8,7,6,5,3,2,1"

Returning the Greatest or Least Index Values from an Array:

You can input an array into a function and return the index number of the element that has the greatest or the least value by using these functions:

To return the index value of the element with the greatest value, use: MAXINDEX(<array>) | To return the index value of the element with the least value, use: MININDEX(<array>)

For example,

ASSIGN/V1 = ARRAY(5,8,3,9,2,6,1,7) | V1 is assigned the array of "5,8,3,9,2,6,1,7"
ASSIGN/V2 = MAXINDEX(V1) | V2 will hold the array's index value of 4. The actual value of that array element is 9
ASSIGN/V3 = MININDEX(V1) | V3 will hold the array's index value of 7. The actual value of that array element is 1

You can then use returned index values to get the actual array element value.

Returning Sorted Index Values from an Array

You can input an array into a function, sort the array's values in ascending or descending order and then return the index values by using these functions:

To return the array's index positions in order of their values sorted from greatest to least use: MAXINDICES(<array>) | To return the array's index positions in order of their values sorted from least to greatest use: MINIDICES(<array>)

For example,

ASSIGN/V1 = ARRAY(4,8,2,9,5,7) | V1 is assigned the array of "4,8,2,9,5,7"
ASSIGN/V2 = MAXINDICES(V1) | V2 will hold an array with these values: "4,2,6,5,1,3"
ASSIGN/V3 = MININDICES(V1) | V3 will hold an array with these values: "3,1,5,6,2,4"

Example of Using Array Functions to Find the Minimum and Maximum Points in a Scan

The main purpose of the hit array functions discussed above is to give you an easy way to find the minimum and maximum points in a scan.

To dimension the point from SCAN1 that has the greatest measured X value, you could use this expression:

ASSIGN/MAXPTINDEX = MAXINDEX(SCAN1.HIT[1..SCAN1.NUMHITS].X) D1 = LOCATION OF FEATURE SCAN1.HIT[MAXPTINDEX]

To find the three highest points in the Z axis of SCAN2, you could use this expression:

ASSIGN/MI = MAXINDICES(SCAN2.HIT[1..SCAN2.NUMHITS].Z) ASSIGN/THREEPOINTS = ARRAY(SCAN2.HIT[MI[1]].XYZ, SCAN2.HIT(MI[2]].XYZ, SCAN2.HIT[MI[3]].XYZ)