0 BEGIN PGM 2115_EN MM 1 ;Program for milling a plygone. 2 ;The size is defined by the width across 3 ;flats. This is internally converted into 4 ;the corner radius, which is then approached 5 ;as a linear-polar set. The tool is 6 ;prepositioned at the first corner with an 7 ;offset of its diameter, and then moves 8 ;to the contour in a circukat motion. 9 ;You define all necessary parameter at the 10 ;beginning of the program. 11 ; 12 ;Input parameter 13 FN 0: Q1 =+50 ;CONTOUR CENTER IN THE X-AXIS 14 FN 0: Q2 =+50 ;CONTOUR CENTER IN THE Y-AXIS 15 FN 0: Q3 =-10 ;DEPTH 16 FN 0: Q4 =-1 ;ROTATIONAL DIRECTION 17 ; ;-1=CLOCKWISE 18 ; ;+1=COUNTERCLOCKWISE 19 FN 0: Q5 =+6 ;NUMBER OF CORNERS 20 FN 0: Q9 =+80 ;WIDTH ACROSS FLATS 21 FN 0: Q7 =+30 ;ANGULAR POSITION OF THE FIRST CORNER 22 FN 0: Q10 =+2 ;SET UP CLEARANCE 23 FN 0: Q11 =+500 ;FEED RATE FOR PLUNGING 24 FN 0: Q12 =+250 ;FEED RATE FOR MILLING 25 FN 0: Q14 =+0 ;ALLOWANCE FOR SIDE 26 FN 0: Q15 =+1 ;RADIUS CORRECTION 27 ; ;0=NO RADIUS CORRECTION 28 ; ;1=RADIUS CORRECTION TO THE LEFT 29 ; ;2=RADIUS CORRECTION TO THE RIGHT 30 ;Input parameter completed 31 ; 32 BLK FORM 0.1 Z X+0 Y+0 Z-22 33 BLK FORM 0.2 X+100 Y+100 Z+0 34 ; 35 ;Tool call milling tool 36 TOOL CALL 18 Z S4000 37 ; 38 CALL LBL 1 39 ; 40 ;Move back and end of program 41 L Z+100 R0 FMAX M2 42 ; 43 ;Contour calculations 44 LBL 1 45 FN 4: Q20 =+Q9 DIV +2 46 ;Halve the width across flats 47 FN 1: Q21 =+Q20 + +Q14 ;add allowance 48 Q22 = 360 / Q5 / 2 ;Halve angle step 49 Q6 = Q21 / COS Q22 ;Calculate corner radius 50 ; 51 CC X+Q1 Y+Q2 ;Define the center 52 FN 0: Q27 =+Q7 ;Current angle is equal the angle of the first corner 53 FN 4: Q28 =+Q108 DIV +2 ;Contour strtradius 54 FN 3: Q29 =+Q108 * +2 ;Tool diameter 55 FN 1: Q29 =+Q6 + +Q29 ;Radius for pre-positioning 56 FN 0: Q35 =+1 ;Counter 57 FN 4: Q37 =+360 DIV +Q5 ;Angle step 58 FN 3: Q37 =+Q37 * +Q4 ;Angle step in rotational direction 59 LP PR+Q29 PA+Q7 R0 FMAX M3 ;Pre-positioning 60 L Z+Q1 FMAX ;Pre-positioning the Z-axis 61 L Z+Q3 FQ11 ;Plunging 62 ;Selection of the radius correction 63 FN 9: IF +Q15 EQU +1 GOTO LBL 11 64 FN 9: IF +Q15 EQU +2 GOTO LBL 12 65 LP PR+Q6 PA+Q7 R0 FQ12 ;Move to the first corner 66 RND RQ28 FQ12 67 FN 9: IF +0 EQU +0 GOTO LBL 2 68 ; 69 LBL 11 70 LP PR+Q6 PA+Q7 RL FQ12 ;Move to the first corner 71 RND RQ28 FQ12 72 FN 9: IF +0 EQU +0 GOTO LBL 2 73 ; 74 LBL 12 75 LP PR+Q6 PA+Q7 RR FQ12 ;Move to the first corner 76 RND RQ28 FQ12 77 LBL 2 78 FN 1: Q35 =+Q35 + +1 ;Counter update 79 FN 1: Q27 =+Q27 + +Q37 ;Angle update 80 LP PR+Q6 PA+Q27 FQ12 ;Move to the next corner 81 FN 12: IF +Q35 LT +Q5 GOTO LBL 2 82 LP PR+Q6 PA+Q7 FQ12 ;Move to the first/last corner 83 RND RQ28 84 LP PR+Q29 PA+Q7 R0 FQ12 ;Leave the contour 85 L Z+Q10 R0 FMAX ;Move the Z-axis to set up clearance 86 LBL 0 87 END PGM 2115_EN MM