Example of Use of an Array
The Array are used to organize list of values that are useful in the same context and normally are managed in loops.
The following example show how to declare an array of 4 points that represents a list of touch points need to measure a circle.
The Array is bi-dimensional:
- 6 items in the row where are defined X,Y,Z,I,J,K value of each points.
- 4 items in the columns represents the 4 points to be touched.
The DMIS code is:
$$ Declaration of The Probe
S(P_3)=SNSDEF/PROBE,INDEX,POL,0.0000,0.0000,0.00000000,0.00000000,-1.00000000,127.0000,4.0000
SNSLCT/S(P_3)
$$ Declaration of The Array
DECL/DOUBLE,list_of_points_xyzijk[4,6]
$$Point Number 1
list_of_points_xyzijk[1,1]=ASSIGN/10
list_of_points_xyzijk[1,2]=ASSIGN/0
list_of_points_xyzijk[1,3]=ASSIGN/0
list_of_points_xyzijk[1,4]=ASSIGN/-1
list_of_points_xyzijk[1,5]=ASSIGN/0
list_of_points_xyzijk[1,6]=ASSIGN/0
$$Point Number 2
list_of_points_xyzijk[2,1]=ASSIGN/0
list_of_points_xyzijk[2,2]=ASSIGN/10
list_of_points_xyzijk[2,3]=ASSIGN/0
list_of_points_xyzijk[2,4]=ASSIGN/0
list_of_points_xyzijk[2,5]=ASSIGN/-1
list_of_points_xyzijk[2,6]=ASSIGN/0
$$Point Number 3
list_of_points_xyzijk[3,1]=ASSIGN/-10
list_of_points_xyzijk[3,2]=ASSIGN/0
list_of_points_xyzijk[3,3]=ASSIGN/0
list_of_points_xyzijk[3,4]=ASSIGN/1
list_of_points_xyzijk[3,5]=ASSIGN/0
list_of_points_xyzijk[3,6]=ASSIGN/0
$$Point Number 4
list_of_points_xyzijk[4,1]=ASSIGN/-10
list_of_points_xyzijk[4,2]=ASSIGN/0
list_of_points_xyzijk[4,3]=ASSIGN/0
list_of_points_xyzijk[4,4]=ASSIGN/0
list_of_points_xyzijk[4,5]=ASSIGN/1
list_of_points_xyzijk[4,6]=ASSIGN/0
Measuring with a cycle
DECL/INTGR,counter
MODE/PROG,MAN
F(CIR_1)=FEAT/CIRCLE,INNER,CART,0.0000,0.0000,0.0000,0.00000000,0.00000000,1.00000000,24.4967
MEAS/CIRCLE,F(CIR_1),5
- DO/counter,1,4,1
- PTMEAS/CART,list_of_points_xyzijk[counter,1],list_of_points_xyzijk[counter,2],list_of_points_xyzijk[counter,3],list_of_points_xyzijk[counter,4],list_of_points_xyzijk[counter,5],list_of_points_xyzijk[counter,6]
- PTMEAS/CART,list_of_points_xyzijk[counter,1],list_of_points_xyzijk[counter,2],list_of_points_xyzijk[counter,3],list_of_points_xyzijk[counter,4],list_of_points_xyzijk[counter,5],list_of_points_xyzijk[counter,6]
- ENDDO
- DO/counter,1,4,1
ENDMES
<\code>