0 BEGIN PGM 8205_EN MM 1 ;NC program for measuring the Z coordinate 2 ;at serveral points and writing the deepest 3 ;point to a marker. The control then moves 4 ;to the X/Y position of the deepest point 5 ;and sets the Z datum there. In a table, you 6 ;define the position at which the control 7 ;is to measure the Z coordinate. In addition, 8 ;you need to define a few parameters at the 9 ;beginning of the program. 10 ; 11 BLK FORM 0.1 Z X+0 Y+0 Z-50 12 BLK FORM 0.2 X+100 Y+100 Z+0 13 ; 14 ;Inputs 15 QL1 = 9 ;NUMBER OF MEASURING POINTS 16 QL2 = 0 ;STARTING POSITION IN Z FOR 17 ; ;MEASUREMENT 18 QL3 = 0.5 ;Z DATUM TO BE SET AT THE DEEPEST 19 ; ;POSITION 20 QL4 = 5 ;SAFTY CLEARANCE 21 QL5 = 0 ;FIRST LINE OF THE TABLE TO BE READ 22 ; ;FROM 23 ; 24 ;Tool call for touch probe 25 TOOL CALL 500 Z 26 ; 27 ;Retract 28 L Z+100 R0 FMAX 29 ; 30 ;Calculations 31 QL11 = QL1 - 1 ;Number of repetitions 32 QL42 = 999999999 ;Reference for the first comparison 33 ; 34 ;Open the table in which the measuring points 35 ;are defined 36 FN 26: TABOPEN 82051_en.tab 37 ; 38 ;Loop 39 LBL 1 40 ; 41 ;Read the X and Y coordinates from the table 42 FN 28: TABREAD QL30 =QL5 /"X,Y" 43 ; 44 ;Approche the measuring point 45 L X+QL30 Y+QL31 R0 FMAX 46 ; 47 ;Measure the Z coordinate 48 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 49 ; 50 ;Compare whether the measurement result is 51 ;less than the currently smallest value 52 FN 12: IF +Q160 LT +QL42 GOTO LBL 2 53 ; 54 ;Label 55 LBL 3 56 ; 57 QL5 = QL5 + 1 ;Increment the table line 58 ; 59 CALL LBL 1 REPQL11 ;Repeat the loop 60 ; 61 ;Approche the X/Y position of the deepest 62 ;point 63 L X+QL40 Y+QL41 R0 FMAX 64 ; 65 ;Set the Z datum at the deepest 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 datum 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 depest point to 76 ;a marker 77 QL40 = QL30 ;X coordinate at the deepest point 78 QL41 = QL31 ;Y coordinate at the deepest point 79 QL42 = Q160 ;Z coordinate at the deepest point 80 ;Return jump to loop 81 FN 9: IF +0 EQU +0 GOTO LBL 3 82 END PGM 8205_EN MM