;; O9922 SQUARE SIDE CUTTING---ROUND Yi-Wan LIN 10/09/1998 IF (#13==#0) GOTO 10; @81=#13; N10 IF(#18!=#0) GOTO 20; // R-GIVEN_FILLET TASK IF( ABS(#3) ==0 ) GOTO 15; //BUG-FIX 9-15'97 M98 P9928; // SQUARE-SIDE-OUT-CHAMFER M99; N15 #18=0; // C=0 ,RUN R=0 TASK N20 #6=ABS(#6); #6=FIX(#6); @91=ABS(@91); @91=FIX(@91); IF(#6>0) GOTO 50; IF (@91<=0) GOTO 9052; #6=@91; //use default feed rate N50 F#6; ;//-------------------------------------------------------- #21=ABS(#21); IF (#21 >0.5) GOTO 60; #21=2; // U=0..G02 GOTO 61; N60 #21=3; // U=1..G03 ; --------------------------------------------- N61 IF(@90<#26) GOTO 9055; //@90 must large then #26 #4=ABS(#4); #8=ABS(#8); IF(#4==0) GOTO 9053; IF(#8==0) GOTO 9054; IF(#4 <= #8) GOTO 70; #4=#8; ; ;//-----Total limitation Check----------------------------- N70 IF( @81<1 || @81>4) GOTO 9999; IF( #20!=#0 ) GOTO 72; #20=@92; // 10/09/1998 ADD 'T' ARGUMENT N72 #20=ABS(#20); // Phi must + REPLACE ALL @92 WITH #20 #18=ABS(#18); // R must + #22=ABS(#22); // V must + #17=ABS(#17); // Q must + #9=ABS(#9 ); // I must + #10=ABS(#10); // J must + IF( #20==0 ) GOTO 9050; IF( #22>#20 ) GOTO 9072; IF( #9 ==0 ) GOTO 9076; IF( #10==0 ) GOTO 9076; IF( ( #9-(2*#18))<=0 ) GOTO 9077; //must:I-2R>0 IF( (#10-(2*#18))<=0 ) GOTO 9077; //must:J-2R>0 ;---individual check- IF(@81==4) GOTO 74; IF(@81==3) GOTO 73; GOTO 79; N73 IF( (2*#17+#20) >#9 ) GOTO 9078; IF( (2*#17+#20) >#10) GOTO 9078; IF( #18 >= (#20/2) ) GOTO 79; #18=#20/2; GOTO 79; N74 IF(#9 < (2*#22+#20) ) GOTO 9079; IF(#10 < (2*#22+#20) ) GOTO 9079; IF(#18 >= (#20/2) ) GOTO 79; #18=#20/2; ;//-----cal. cut-down counts------------------------------ N79 #11=#8/#4; IF( (#11-FIX(#11))==0) GOTO 80; #11=#11+1; #11=FIX(#11); // #11:-z Feed count N80 IF( @81==2 )GOTO 200; // finish machining skip 'W' process IF( @81==4 )GOTO 200;//=====When @81=1 there have 'W' procress======= IF( #17==0 )GOTO 9073; #23=ABS(#23); //W @93=ABS(@93); //percent of tool Dia. IF( #23>0 ) GOTO 100; #23=#20*@93*0.01; //XY PLANE CUTTING dw(#23) IF( #23==0 ) GOTO 9056; N100 IF( #23<=#20 ) GOTO 110; #23=#20; // Maximum W=#20 to prevent W>phi ; ;//----------------- N110 #5=#17-#22; //#5:(Q-V) machining length. IF( #5<=0 ) GOTO 9074; @94=ABS(@94); IF(@94<0.5) GOTO 130; #33= #5 /#23; IF( (#33-FIX(#33))==0) GOTO 130; #33=#33+1; #33=FIX(#33); #23=#5/#33; // wanna constant cutting!! N130 ; IF(#23 <= #5 ) GOTO 140; #23=#5; // #23 can't large than work length. ;//--CAL cut-xy counts - N140 #2=#5/#23; IF( (#2-FIX(#2))==0) GOTO 200; #2=#2+1; #2=FIX(#2); ;//-----Spindle running---------------------------------- N200 #19=FIX(#19); @95=FIX(@95); IF(#19==#0) GOTO 210; @95=#19; IF (@95==0) GOTO 9051; N210 IF (@95>0) GOTO 220; IF (@95==0) GOTO 9051; M04S-@95; M08; GOTO 221; N220 M03S@95; M08; ; ;//-----COMMON VAULE CAL----------------------------------- N221 #27=#24+#9/2; //Center of Workpice.x #28=#25+#10/2; //Center of Workpice.y G68G90X#24Y#25R#1; // Coord. rotation. ;//------------------------- IF(@81==1) GOTO 300; // outside rough IF(@81==2) GOTO 400; // outside finish IF(@81==3) GOTO 500; // inner rough IF(@81==4) GOTO 600; // inner finish GOTO 9999; ;//[-----LOOP for Outter rough machining.--- @81=1-------- N300 #7=#10/2+#17+#20/2+#28; //initial entry point.Y G90G00Z@90; G00X#27Y#7; //approach Entry point G90G00Z#26; ;//----- Loop of x-y cut ------------ #3=1; N310 IF(#3 > #2 ) GOTO 360; IF(#3!=#2) GOTO 320; #16=(#17-#5); GOTO 321; N320 #16=#17-(#3*#23); N321 ;// #13:point out what radius are filleting now.. #13=#18+#16+(#20/2); #7=#10/2+#16+(#20/2)+#28; IF(#18==0) GOTO 325; #14=#9/2-#18; #15=#10/2-#18; GOTO 326; N325 #14=#9/2+#16+#20/2; #15=#10/2+#16+#20/2; #13=0; ;//-Loop Z-cut .....for(#12=1;#12<=#11;#12++)-- N326 #12=1; N330 IF( #12 > #11) GOTO 350; IF(#12!=#11) GOTO 335; #31=#26-#8; GOTO 336; N335 #31=#26-(#12*#4); N336 ; G90G01Z#31; //Cut down G90G01Y#7; //approach ;//---CW Direction:G02 -------- IF(#21==3) GOTO 340; G91G01X#14; G02X#13Y-#13R#13; G01Y-#15; G01Y-#15; G02X-#13Y-#13R#13; G01X-#14; G01X-#14; G02X-#13Y#13R#13; G01Y#15; G01Y#15; G02X#13Y#13R#13; G91G01X#14; GOTO 341; ;//---CCW Direction:G03 --------- N340 G91G01X-#14; G03X-#13Y-#13R#13; G01Y-#15; G01Y-#15; G03X#13Y-#13R#13; G01X#14; G01X#14; G03X#13Y#13R#13; G01Y#15; G01Y#15; G03X-#13Y#13R#13; G91G01X-#14; ;//------------------------------ N341 G91G00Y#23; //Retract to before pos. #12=#12+1; GOTO 330; //Eof of Z_cut ;//---------------------------------- N350 #3=#3+1; // #3.counter..what x-y path be cutting. GOTO 310; ; // Eof x-y cut LOOP N360 GOTO 9999; ;//[====Eof LOOP for outter-finish machining.--- @81=2----- N400 IF(#21==3) GOTO 410; #29=#27-#20/2; //G02..soft Entry point.x #30=#28+(#10/2+#20); //G02..soft Entry point.y GOTO 411; N410 #29=#27+#20/2; //G03..soft Entry point.x #30=#28+(#10/2+#20); //G03..soft Entry point.y ; N411 IF(#18==0) GOTO 415; #14=#9/2-#18; #15=#10/2-#18; #13=#18+#20/2; GOTO 416; N415 #14=#9/2+#20/2; #15=#10/2+#20/2; #13=0; ; N416 #16=#20/2; //..soft_in radius=1/2 phi G90G00Z@90; G90G00X#29Y#30; G90G00Z#26; ;//------Loop of Z_cut------- #12=1; N420 IF(#12 > #11) GOTO 450; IF(#12!=#11) GOTO 430; #31=#26-#8; GOTO 431; N430 #31=#26-(#12*#4); ; N431 G90G01X#29Y#30; //to Entry point G90G01Z#31; IF(#21==3) GOTO 440; G91G03X#16Y-#16R#16; //soft_in G01X#14; //Cut right G91G02X#13Y-#13R#13; //Fillet G01Y-#15; //cut down G01Y-#15; G91G02X-#13Y-#13R#13; //fillet G01X-#14; //cut left G01X-#14; G91G02X-#13Y#13R#13; //fillet G01Y#15; //cut up G01Y#15; G91G02X#13Y#13R#13; //fillet G01X#14; //Cut right G91G03X#16Y#16R#16; //soft_out GOTO 441; N440 G91G02X-#16Y-#16R#16; //soft_in G01X-#14; G91G03X-#13Y-#13R#13; //Fillet G01Y-#15; //cut down G01Y-#15; G91G03X#13Y-#13R#13; //Fillet G01X#14; //Cut right G01X#14; G91G03X#13Y#13R#13; //Fillet G01Y#15; //cut up G01Y#15; G91G03X-#13Y#13R#13; //Fillet G01X-#14; //Cut left G91G02X-#16Y#16R#16; //soft_out ; N441 #12=#12+1; GOTO 420; ;//------Eof Z-cut LOOP------- N450 G90G00Z#26; GOTO 9999; ;//[-----LOOP for inner rough machining.--- @81=3 -------- N500 #7=#10/2-#17-(#20/2)+#28; //initial entry point.y G90G00Z@90; G00X#27Y#7; //approach Entry point G90G00Z#26; ;//----- Loop of x-y cut ------------ #3=1; N510 IF(#3 > #2 ) GOTO 560; IF(#3!=#2) GOTO 520; #33=(#17-#5); GOTO 521; N520 #33=(#17-(#3*#23)); ; N521 #7=#10/2-#33-(#20/2)+#28; //#7:each entry.y #32=#18-#33; // radius of fillet(tool.cen) IF( (#32-(#20/2))>=0 ) GOTO 525; #14=(#9/2)-#33-(#20/2); #15=(#10/2)-#33-(#20/2); #13=0; GOTO 526; N525 #14=#9/2-#18; #15=#10/2-#18; #13=#32-(#20/2); //radius of fillet(tool.edge) ; N526 #12=1; ;//-Loop Z-cut .....for(#12=1;#12<=#11;#12++)-- N530 IF( #12 > #11) GOTO 550; IF(#12!=#11) GOTO 535; #31=#26-#8; GOTO 536; N535 #31=#26-(#12*#4); ; N536 G90G01Z#31; G90G01X#27Y#7;//to each entry point.y IF(#21==3) GOTO 540; ;//---CW Direction:G02 -------- G91G01X#14; G02X#13Y-#13R#13; G01Y-#15; G01Y-#15; G02X-#13Y-#13R#13; G01X-#14; G01X-#14; G02X-#13Y#13R#13; G01Y#15; G01Y#15; G02X#13Y#13R#13; G91G01X#14; GOTO 541; ;//---CCW Direction:G03 --------- N540 G91G01X-#14; G03X-#13Y-#13R#13; G01Y-#15; G01Y-#15; G03X#13Y-#13R#13; G01X#14; G01X#14; G03X#13Y#13R#13; G01Y#15; G01Y#15; G03X-#13Y#13R#13; G91G01X-#14; ;//------------------------------ N541 G91G00Y-#23; //Retract to before POS. #12=#12+1; GOTO 530; ; //Eof of Z_cut ;//---------------------------------- N550 #3=#3+1; // #3.counter..what x-y path be cutting. GOTO 510; ; // Eof x-y cut LOOP N560 GOTO 9999; ;//----LOOP for inner finish machining. @81=4 With soft move--- N600 IF( #22 > (#20/2) ) GOTO 700; //check if sofe-move wanted IF( #9 < ( 2*(#20+#22) ) ) GOTO 700; IF( #10 < ( 2*(#20+#22) ) ) GOTO 700; IF(#21==3) GOTO 610; #29=#27-(#20/2); //G02..soft Entry point.x #30=#28+( (#10/2)-#20); //G02..soft Entry point.y GOTO 611; N610 #29=#27+(#20/2); //G03..soft Entry point.x #30=#28+( (#10/2)-#20); //G03..soft Entry point.y ; N611 IF( #18-(#20/2)>=0 ) GOTO 615; #13=0; #14=(#9/2)-(#20/2); #15=(#10/2)-(#20/2); GOTO 616; N615 #13=#18-(#20/2); #14=(#9/2)-#18; #15=(#10/2)-#18; ; N616 G90G00Z@90; G90G00X#29Y#30; G90G00Z#26; #16=#20/2; // soft_in radius=1/2 phi ;//------Loop of Z_cut------- #12=1; N620 IF(#12 > #11) GOTO 650; IF(#12!=#11) GOTO 630; #31=#26-#8; GOTO 631; N630 #31=#26-(#12*#4); ; N631 G90G01X#29Y#30; //to Entry point G90G01Z#31; // IF(#21==3) GOTO 640; G91G02X#16Y#16R#16; //soft_in G01X#14; G91G02X#13Y-#13R#13; G01Y-#15; G01Y-#15; G91G02X-#13Y-#13R#13; G01X-#14; G01X-#14; G91G02X-#13Y#13R#13; G01Y#15; G01Y#15; G91G02X#13Y#13R#13; G01X#14; G91G02X#16Y-#16R#16; //soft_out GOTO 641; N640 G91G03X-#16Y#16R#16; //soft_in G01X-#14; G91G03X-#13Y-#13R#13; G01Y-#15; G01Y-#15; G91G03X#13Y-#13R#13; G01X#14; G01X#14; G91G03X#13Y#13R#13; G01Y#15; G01Y#15; G91G03X-#13Y#13R#13; G01X-#14; G91G03X-#16Y-#16R#16; //soft_out ; N641 #12=#12+1; GOTO 620; ; ;//------Eof Z-cut LOOP------- N650 G90G00Z#26; GOTO 9999; ;//-LOOP for inner finish machining. @81=4 Without soft move-- N700 #7=#28+(#10/2)-#22-(#20/2); // Entry(beginning) point.y IF( #18-(#20/2)>=0 ) GOTO 715; #13=0; //Radius of machining fillet. #14=(#9/2)-(#20/2); //half machining path length.x #15=(#10/2)-(#20/2); //half machining path length.y GOTO 716; N715 #13=#18-(#20/2); #14=(#9/2)-#18; #15=(#10/2)-#18; ; N716 G90G00Z@90; G90G00X#27Y#7; G90G00Z#26; ;//------Loop of Z_cut------- #12=1; N720 IF(#12 > #11) GOTO 750; IF(#12!=#11) GOTO 730; #31=#26-#8; GOTO 731; N730 #31=#26-(#12*#4); ; N731 G90G00X#27Y#7; G90G01Z#31; G91G01Y#22; //approach to edge G04P100; IF(#21==3) GOTO 740; G91G01X#14; G91G02X#13Y-#13R#13; G01Y-#15; G01Y-#15; G91G02X-#13Y-#13R#13; G01X-#14; G01X-#14; G91G02X-#13Y#13R#13; G01Y#15; G01Y#15; G91G02X#13Y#13R#13; G91G01X#14; GOTO 741; N740 G91G01X-#14; G91G03X-#13Y-#13R#13; G01Y-#15; G01Y-#15; G91G03X#13Y-#13R#13; G01X#14; G01X#14; G91G03X#13Y#13R#13; G01Y#15; G01Y#15; G91G03X-#13Y#13R#13; G91G01X-#14; ; N741 #12=#12+1; GOTO 720; N750 G90G00Z#26; ;//------Eof Z-cut LOOP------- GOTO 9999; ;//-- Eof finish machining loop @81=4 Without soft move -- ;//======================================================== N9999 G90G00Z@90; ;; M5; //Turn-OFF spindle and coolant ;; M9; ;; G90G00X#24Y#25; G69; M99; ;//---------------------------------------------------------------------------- N8888 ;//Program done with wrong argument given ;; M5; //stop spindle and coolant ;; M9; G69; M99; ;//---------------------------------------------------------------------------- N9050 $599=50; N9051 $599=51; N9052 $599=52; N9053 $599=53; N9054 $599=54; N9055 $599=55; N9056 $599=56; N9072 $599=72; N9073 $599=73; N9074 $599=74; N9076 $599=76; N9077 $599=77; N9078 $599=78; N9079 $599=79; GOTO 8888; ;//-------------------------------------------------------- ;// SQUARE SIDE CUTTING---ROUND ;// FORMAT : @90 ---> ESCAPE Z AXIS DATA ;// @91 ---> FEEDRATE ;// @92 ---> TOOL DIAMETER ;// @93 ---> CUT WIDTH % ;// @94 ---> CONSTANT CUT WIDTH ;// @95 ---> SPINDLE SPEED (100%) ;// @81 ---> 1)OUTTER ROUGH_ 2)OUTTER FINISH_ ;// 3)INNER ROUGH_ 4)INNER FINISH)_ ;// Soft_IN RAD=@92/2 ;// X(#24): X coord. of reference point1.X ;// Y(#25): Y coord. of reference point1.Y ;// I(#24): X coord. of reference point2.X ;// J(#25): Y coord. of reference point2.Y ;// Z(#26): The top surface of the work piece ;// R(#18): radius of corner ;// T(#20): @92(LOW PRIORITY),TOOL DIA ;// Q(#17): x-y total cutting value. ;// W(#23): the cut width of each movement in xy plane ;// U(#21): cutting direction 0:G02 1:G03 ;// V(#22): finish cutting allowance ;// H( #8): total Cut Depth ;// D( #4): the cut depth of each -Z advance ;// F( #6): feedrate ;//-------------------------------------------------------------------