0 BEGIN PGM 8210_EN MM 1 ;NC program for measuring the Z coordinate 2 ;at serveral points and writing the 3 ;coordinates of the highest point to a marker. 4 ;The control then moves to the X/Y position 5 ;of the highest point and sets the Z datum 6 ;there. In a tabel, zou define the poitions 7 ;at which the control is to measure the 8 ;Z coordinate. In addition, you need to define 9 ;a few parameters at the beginning of the 10 ;program. 11 ; 12 BLK FORM 0.1 Z X+0 Y+0 Z-50 13 BLK FORM 0.2 X+100 Y+100 Z+0 14 ; 15 ;Inputs 16 QL1 = 9 ;NUMBER OF MEASURING POINTS 17 QL2 = 0 ;STARTING POSITION IN Z FOR 18 ; ;MEASUREMENT 19 QL3 = 0.5 ;Z PRESET TO BE SET AT THE HIGHEST 20 ; ;POSITION 21 QL4 = 5 ;SET-UP CLEARANCE 22 QL5 = 0 ;FIRST ROW OF THE TABLE TO BE READ OUT 23 ; ;FROM 24 ; 25 ;Tool call for touch probe 26 TOOL CALL 500 Z 27 ; 28 ;Retract 29 L Z+100 R0 FMAX 30 ; 31 ;Calculations 32 QL11 = QL1 - 1 ;Number of repetitions 33 QL42 = - 999999999 ;Reference for the first comparison 34 ; 35 ;Open the table in which the measuring points 36 ;are defined 37 FN 26: TABOPEN 82101_de.tab 38 ; 39 ;Loop 40 LBL 1 41 ; 42 ;Read the X and Y coordinates from the tabel 43 FN 28: TABREAD QL30 =QL5 /"X,Y" 44 ; 45 ;Approach the measuring point 46 L X+QL30 Y+QL31 R0 FMAX 47 ; 48 ;Measure the Z coordinate 49 TCH PROBE 427 MEASURE COORDINATE ~ Q263=+QL30 ;1ST POINT 1ST AXIS ~ Q264=+QL31 ;1ST POINT 2ND AXIS ~ Q261=+QL2 ;MEASURING HEIGHT ~ Q320=+QL4 ;SET-UP CLEARANCE ~ Q272=+3 ;MEASURING AXIS ~ Q267=-1 ;TRAVERSE DIRECTION ~ Q260=+50 ;CLEARANCE HEIGHT ~ Q281=+0 ;MEASURING LOG ~ Q288=+0 ;MAXIMUM LIMIT ~ Q289=+0 ;MINIMUM LIMIT ~ Q309=+0 ;PGM STOP TOLERANCE ~ Q330=+0 ;TOOL 50 ; 51 ;Compare whether the measurment result is 52 ;larger than the previously largest value 53 FN 11: IF +Q160 GT +QL42 GOTO LBL 2 54 ; 55 ;Label 56 LBL 3 57 ; 58 QL5 = QL5 + 1 ;Increment the tabel row 59 ; 60 CALL LBL 1 REPQL11 ;Repeat the loop 61 ; 62 ;Approch the X/Y position of the highest point 63 L X+QL40 Y+QL41 R0 FMAX 64 ; 65 ;Set the Z preset at the highest point 66 TCH PROBE 417 DATUM IN TS AXIS ~ Q263=+QL40 ;1ST POINT 1ST AXIS ~ Q264=+QL41 ;1ST POINT 2ND AXIS ~ Q294=+QL42 ;1ST POINT 3RD AXIS ~ Q320=+QL4 ;SET-UP CLEARANCE ~ Q260=+100 ;CLEARANCE HEIGHT ~ Q305=+0 ;NUMBER IN TABLE ~ Q333=+QL3 ;PRESET ~ Q303=+1 ;MEAS. VALUE TRANSFER 67 ; 68 ;Activate the preset 69 CYCL DEF 247 DATUM SETTING ~ Q339=+0 ;DATUM NUMBER 70 ; 71 ;Retract and end program 72 L Z+100 R0 FMAX M30 73 ; 74 LBL 2 75 ;Write the coordinates of the highest point 76 ;to a marker 77 QL40 = QL30 ;X coordinate at the highest point 78 QL41 = QL31 ;Y coordinate at the highest point 79 QL42 = Q160 ;Z coordinate at the highest point 80 ;Return jump to the loop 81 FN 9: IF +0 EQU +0 GOTO LBL 3 82 END PGM 8210_EN MM