### Code Sample of a Subroutine

The following code sample allows the operator to have a choice of changing the theoretical X, Y, and Z values of a feature after its measurement. Subsequent runs will then use the updated theoretical values.

PNT1 =GENERIC/POINT,DEPENDENT,CARTESIAN,$

NOM/XYZ,<5,10,15>,$

MEAS/XYZ,<7,12,17>,$

NOM/IJK,<0,0,1>,$

MEAS/IJK,<0,0,1>

C1 =COMMENT/YESNO,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,

Do you want to change the theoretical values for PNT1?

IF/C1.INPUT=="YES"

CS1 =CALLSUB/CHANGETHEO,:,

END_IF/

COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,

The XYZ theoretical and actual values for PNT1 are:

"Theo X= " + PNT1.TX

"Theo Y= " + PNT1.TY

"Theo Z= " + PNT1.TZ

--------------------

"Actl X= " + PNT1.X

"Actl Y= " + PNT1.Y

"Actl Z= " + PNT1.Z

PROGRAM/END

SUBROUTINE/CHANGETHEO,

POINT1 = {PNT1} : ,

=

DIMINFO/PNT1;ICON,DIMID,FEATID,VERT,HORIZ, ,$

HEADINGS, ;MEAS, , , , , , , ,

C2 =COMMENT/INPUT,NO,FULL SCREEN=NO,

Type the new X theo value for PNT1.

"Its current value is " + PNT1.TX

ASSIGN/PNT1.TX=C2.INPUT

C3 =COMMENT/INPUT,NO,FULL SCREEN=NO,

Type the new Y theo value for PNT1.

"Its current value is " + PNT1.TY

ASSIGN/PNT1.TY=C3.INPUT

C4 =COMMENT/INPUT,NO,FULL SCREEN=NO,

Type the new Y theo value for PNT1.

"Its current value is " + PNT1.TZ

ASSIGN/PNT1.TZ=C4.INPUT

ENDSUB/

Explanation of Sample Code

C1=COMMENT/YESNO
This line takes and stores the YES or NO response from the user.

IF/C1.INPUT=="YES"
This line is the expression. It tests to see if the input of comment 1 is a YES. If it's a YES then the IF statement is TRUE and continues executing the statements after the IF statement, in this case it measures the PNT1 feature. If NO it moves to the END_IF statement.

CS1=CALLSUB/CHANGETHEO,:,
This line calls the subroutine named CHANGETHEO. The flow of the part program now jumps to the SUBROUTINE/CHANGETHEO line.

SUBROUTINE/CHANGETHEO
This line initializes the CHANGETHEO subroutine. Program flow continues with the execution of code between this line and the ENDSUB/ line.

POINT1 = {PNT1} : ,
This is the only argument of the subroutine. It allows the subroutine to access information from the PNT1 feature.

C2=COMMENT/INPUT, C3=COMMENT/INPUT, C4=COMMENT/INPUT
These input comments all take the new theoretical X, Y, and Z values from the user and store them in C2.INPUT, C3.INPUT, and C4.INPUT respectively.

ASSIGN/PNT1.TX = C2.INPUT
This line takes the theoretical X value from C2.INPUT and assigns it to the PNT1.TX variable. PNT1.TX is a PC-DMIS variable that holds the theoretical X value (denoted by TX) for the point with the ID label of PNT1.

ASSIGN/PNT1.TY = C3.INPUT
This line takes the theoretical Y value from C3.INPUT and assigns it to the PNT1.TY variable. PNT1.TY is a PC-DMIS variable that holds the theoretical Y value (denoted by TY) for the point with the ID label of PNT1.

ASSIGN/PNT1.TZ = C4.INPUT
This line takes the theoretical Z value from C4.INPUT and assigns it to the PNT1.TZ variable. PNT1.TZ is a PC-DMIS variable that holds the theoretical Z value (denoted by TZ) for the point with the ID label of PNT1.

ENDSUB/
This line ends the subroutine, and program flow returns to the line immediately following the subroutine call. In this case the END_IF/ statement. The program flow then continues with the next operator comment which displays the theoretical and actual X, Y, and Z values, and then the part program ends with the PROGRAM/END command.