0 BEGIN PGM 7120-EN MM 1 ;Program for outside machining of a 2 ;hemisphere with a ball-nose cutter. 3 ;The process is done in a spiral motion. This 4 ;movement is divided into individual linear 5 ;movements. The pitches define in how many 6 ;linear movements the path is devided, and 7 ;thus influence the accuracy. 8 ; 9 BLK FORM 0.1 Z X-35 Y-35 Z-36 10 BLK FORM 0.2 X+35 Y+35 Z+1 11 ; 12 ;Input parameter 13 FN 0: Q1 =+0 ;SPHERE CENTER IN THE X-AXIS 14 FN 0: Q2 =+0 ;SPHERE CENTER IN THE Y-AXIS 15 FN 0: Q3 =-35 ;SPHERE CENTER IN ZHE Z-AXIS 16 FN 0: Q4 =+30 ;VERTICAL PITCH 17 ; ;DEFINES HOW MANY 360DEGREE 18 ; ;PATHS ARE DONE FROM THE TOP 19 ; ;TO THE BOTTOM 20 FN 0: Q5 =+90 ;HORIZONTAL PITCH 21 ; ;DEFINES IN HOW MANY LINEAR 22 ; ;PATHS, A 360 DEGREE CIRCLE 23 ; ;IS DIVIDED 24 FN 0: Q6 =+35 ;SPHERE RADIUS 25 FN 0: Q7 =+90 ;VERTICAL STARTING ANGLE 26 FN 0: Q8 =+0 ;STARTING ANGLE IN PLANE X/Y 27 FN 0: Q9 =+1 ;ROTATIONAL DIRECTION 28 ; ;+1=COUNTERCLOCKWISE 29 ; ;-1=CLOCKWISE 30 FN 0: Q10 =+150 ;FEED RATE FOR PLUNGING 31 FN 0: Q11 =+3000 ;FEED RATE SPIRAL PATH 32 FN 0: Q12 =+3 ;SET UP CLEARANCE 33 FN 0: Q13 =+0 ;ALLOWANCE 34 FN 0: Q14 =+8 ;BALL RADIUS TOOL 35 FN 0: Q17 =+0 ;VERTICAL END ANGLE 36 ;Input parameter completed 37 ; 38 ;Tool call ball-nose cutter 39 TOOL CALL 159 Z S9000 DL-Q14 40 ; 41 ;Pre positioning 42 FN 1: Q18 =+Q12 + +Q14 ;Calculate Z-position 43 L X+Q1 Y+Q2 R0 FMAX M3 44 L Z+Q18 FMAX 45 CALL LBL 1 ;Call spiral motion 46 ; 47 ;End of program 48 L Z+100 R0 F9999 M30 49 ; 50 ;Spiral motion 51 LBL 1 52 Q26 = Q6 + Q13 + Q14 ;Effectiv radius to the tool center 53 FN 0: Q27 =+Q7 ;Current angle vertical=vertical starting angle 54 FN 0: Q28 =+Q8 ;Current angle plane X/Y=Starting angle Plane X/Y 55 Q37 = ( Q17 - Q7 ) / Q4 / Q5 ;Angle step vertical 56 Q38 = 360 / Q5 * Q9 ;Angle step plane X/Y 57 Q39 = Q38 * Q26 ;Step factor 58 CALL LBL 10 59 Q40 = Q39 / Q20 ;Current step range 60 L X+Q21 Y+Q22 Z+Q23 R0 FQ10 ;Move to the first position 61 ; 62 ;Call calculations, angle comparison and at 63 ;the end a full circular path 64 LBL 2 65 CALL LBL 10 66 L X+Q21 Y+Q22 Z+Q23 FQ11 ;Move to the new position 67 FN 11: IF +Q27 GT +Q17 GOTO LBL 2 68 CC X+Q1 Y+Q2 69 FN 9: IF +Q9 EQU -1 GOTO LBL 5 70 CP IPA+360 DR+ FQ11 ;Full circular path 71 FN 9: IF +0 EQU +0 GOTO LBL 6 ;Jump to pull back and end of program 72 ; 73 LBL 5 74 CP IPA-360 DR- FQ11 75 ; 76 LBL 6 77 L Z+Q18 R0 F5555 ;Move back 78 LBL 0 79 ; 80 ;Calculation X,Y,Z position and new angles 81 LBL 10 82 Q20 = COS Q27 * Q26 + Q13 + 0.0001 83 Q40 = Q39 / Q20 84 CC X+Q38 Y+Q40 85 Q21 = COS Q28 * Q20 + Q1 86 Q22 = SIN Q28 * Q20 + Q2 87 Q23 = SIN Q27 * Q26 + Q3 88 Q27 = Q27 + Q37 89 Q28 = Q28 + Q40 90 LBL 0 91 END PGM 7120-EN MM