0 BEGIN PGM 2030_EN MM 1 ;Regular polygone 2 ;Determination of the coordinates with sine and cosine 3 BLK FORM 0.1 Z X+0 Y+0 Z-20 4 BLK FORM 0.2 X+100 Y+100 Z+0 5 ; 6 ;Tool coll milling tool 7 TOOL CALL 30 Z S3000 DL+0 DR+0 8 ; 9 ;Input parameter 10 FN 0: Q1 =+50 ;CENTER X-AXIS 11 FN 0: Q2 =+50 ;CENTER Y-AXIS 12 FN 0: Q3 =-10 ;MILLING DEPTH 13 FN 0: Q4 =-1 ;DIRECTION OF ROTATION 14 ; ;-1=CLOCKWISE 15 ; ;+1=COUNTERCLOCKWISE 16 FN 0: Q5 =+6 ;NUMBER OF CORNERS 17 FN 0: Q6 =+45 ;CIRCUMRADIUS 18 FN 0: Q7 =+0 ;ANGLAR POSITION OF THE FIRST CORNER 19 FN 0: Q10 =+2 ;SAFTY CLEARANCE 20 FN 0: Q11 =+150 ;FEED RATE FOR PLUNGING 21 FN 0: Q12 =+300 ;FEED RATE FOR MILLING 22 FN 0: Q14 =+0 ;SIDE ALLOWANCE 23 FN 0: Q15 =+1 ;RADIUSCORRECTION(O=RO,1=RL,2=RR) 24 ;Input end! 25 ; 26 L Z+100 R0 FMAX M3 27 ; 28 LBL 1 29 CC X+Q1 Y+Q2 ;CC at center X/Y 30 ; 31 ;Calculation 32 FN 0: Q27 =+0 ;Set current angle to zero 33 FN 0: Q35 =+1 ;Set corner counter 34 FN 1: Q26 =+Q6 + +Q14 ;To be produced radius (Circumradius+allowance) 35 FN 4: Q28 =+Q108 DIV +2 ;Approach radius ( 1/2*Toolradius) 36 FN 3: Q29 =+Q108 * +2 ;Tooldiameter (2*Toolradius) 37 FN 1: Q29 =+Q26 + +Q29 ;Aistance for pre-positioning (Radius+Tooldiameter) 38 FN 4: Q37 =+360 DIV +Q5 ;Angle step 39 FN 3: Q37 =+Q37 * +Q4 ;Direction of rotation 40 FN 0: Q27 =+Q7 ;Current angle=angle first corner 41 LP PR+Q29 PA+Q7 R0 FMAX ;Pre-positioning 42 L Z+Q10 FMAX 43 L Z+Q3 FQ11 ;Plunging 44 ; 45 FN 9: IF +Q15 EQU +1 GOTO LBL 11 ;if radiuscorrection=RL goto LBL11 46 FN 9: IF +Q15 EQU +2 GOTO LBL 12 ;if radiuscorrection=RR goto LBL12 47 ; 48 ;Moving to the first corner with R0 49 LP PR+Q26 PA+Q7 R0 FQ12 50 RND RQ28 51 FN 9: IF +0 EQU +0 GOTO LBL 2 ;Junp to LBL2 52 ; 53 ;Moving to the first corner with RL 54 LBL 11 55 LP PR+Q26 PA+Q7 RL FQ12 56 RND RQ28 57 FN 9: IF +0 EQU +0 GOTO LBL 2 ;Jump to LBL2 58 ; 59 ;Moving to the first corner with RR 60 LBL 12 61 LP PR+Q26 PA+Q7 RR FQ12 62 RND RQ28 63 FN 9: IF +0 EQU +0 GOTO LBL 2 ;Junp to LBL2 64 ; 65 ; 66 LBL 2 67 FN 1: Q35 =+Q35 + +1 ;Corner counter 68 FN 1: Q27 =+Q27 + +Q37 ;New angle (current angle+angle step) 69 ; 70 ;Calculation new X and Y position 71 FN 6: Q22 = SIN +Q27 ;Sine of current angle 72 FN 3: Q22 =+Q22 * +Q26 ;Sine * Radius 73 FN 1: Q22 =+Q22 + +Q2 ;Y-Position=Result+Center Y-Axis 74 FN 7: Q21 = COS +Q27 ;Cosine of current angle 75 FN 3: Q21 =+Q21 * +Q26 ;Cosine * Radius 76 FN 1: Q21 =+Q21 + +Q1 ;X-Position=Result+Center X-Axis 77 ; 78 ;Moving to the new position 79 L X+Q21 Y+Q22 FQ12 80 ; 81 FN 12: IF +Q35 LT +Q5 GOTO LBL 2 ;If the value of the corner counter is less than the number of corners goto LBL2 82 ; 83 LP PR+Q26 PA+Q7 ;Move to first corner 84 RND RQ28 85 LP PR+Q29 PA+Q7 R0 ;Retract 86 L Z+Q10 R0 FMAX ;Move to safty clearance 87 LBL 0 88 L Z+100 R0 FMAX M2 89 ;Program end 90 END PGM 2030_EN MM