;//Track SIDE ...O9923 Yi-Wan LIN 10/09/1998 IF (#13==#0) GOTO 10; @81=#13; N10 #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; //----NOTE:#6 FROM HERE HAS ANOTHER MEANS ---------------- #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 + IF( #18==0 ) GOTO 9070; IF( #20==0 ) GOTO 9050; IF( #22>#20 ) GOTO 9072; #6=SQRT( (#24-#9)*(#24-#9)+(#25-#10)*(#25-#10) )/2; IF( #6<=0 ) GOTO 9080; //#6:distance(p1,p2)/2 IF(@81==4) GOTO 74; ;//-----invidual check ---------------------------- IF(@81==3) GOTO 73; IF(@81==2) GOTO 79; IF( #17<=0 ) GOTO 9073; //@81=1 limits IF( #22>=#17 ) GOTO 9074; GOTO 79; N73 IF( #17 <= 0 ) GOTO 9073; //@81=3 limits IF( #22>=#17 ) GOTO 9074; IF( (#18-#17) <= (#20/2) ) GOTO 9075; GOTO 79; N74 IF( (#18-#22) < (#20/2) ) GOTO 9081; //@81=4 limits GOTO 79; ; ;//-----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====== #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 9999; 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 9056; @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--------------------------------------- N221 #16=(#24+#9)/2; //Center of p1p2.X #1=(#25+#10)/2; //Center of p1p2.Y #31=#9-#24; // delta.X #32=#10-#25; // delta.Y #7=ATAN(#32,#31); G68G90X#16Y#1R#7; // 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 #33=#18+#17+(#20/2); //initial entry point.y #27=#1+#33; //Entry point.y G90G00Z@90; G00X#16Y#27; //approach Entry point G90G00Z#26; ;//----- Loop of x-y cut ------------ #3=1; N310 IF(#3 > #2 ) GOTO 360; IF(#3!=#2) GOTO 320; #13=#18+(#17-#5)+(#20/2); GOTO 321; N320 #13=#18+(#17-(#3*#23))+(#20/2); N321 ;// #13:DIST between center and entry.Y=radius of Track! #12=1;;//-Loop Z-cut .....for(#12=1;#12<=#11;#12++)-- 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 #33=#1+#13; #32=2*#13; //Diameter of Track G90G01Y#33; //approach ;//---CW Direction:G02 -------- IF(#21==3) GOTO 340; G91G01X#6; G02Y-#32R#13; G01X-#6; G01X-#6; G02Y#32R#13; G91G01X#6; GOTO 341; ;//---CCW Direction:G03 --------- N340 G91G01X-#6; G03Y-#32R#13; G01X#6; G01X#6; G03Y#32R#13; G91G01X-#6; ;//------------------------------ 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; N360 GOTO 9999; // Eof x-y cut LOOP ;//]====Eof LOOP for outter-rough machining.--- @81=1----- ;//[====Eof LOOP for outter-finish machining.--- @81=2----- ;; if V>(#20/2) then tool will do z-feed first then xy be done ;; I guess that user are never to have 'V>(#20/2)' situation.. ;; so this MACRO don't supply this case. N400 IF(#21==3) GOTO 410; #14=#16-#20/2; //G02..soft Entry point.x #15=#1+(#18+#20); //G02..soft Entry point.y GOTO 411; N410 #14=#16+#20/2; //G03..soft Entry point.x #15=#1+(#18+#20); //G03..soft Entry point.y ; N411 #30=#20/2; //..soft_in radius=1/2 phi #28=#18+#20/2; //..radius of Track machining. #29=2*#28; //.. G90G00Z@90; G90G00X#14Y#15; 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#14Y#15; //to Entry point G90G01Z#31; IF(#21==3) GOTO 440; G91G03X#30Y-#30R#30; //soft_in G01X#6; G02Y-#29R#28; G01X-#6; G01X-#6; G02Y#29R#28; G01X#6; G91G03X#30Y#30R#30; //soft_out GOTO 441; N440 G91G02X-#30Y-#30R#30; //soft_in G01X-#6; G03Y-#29R#28; G01X#6; G01X#6; G03Y#29R#28; G01X-#6; G91G02X-#30Y#30R#30; //soft_out ; N441 #12=#12+1; GOTO 420; ; N450 G90G00Z#26; ;//------Eof Z-cut LOOP------- GOTO 9999; ;//[-----LOOP for inner rough machining.--- @81=3 -------- N500 #33=#18-#17-(#20/2); //initial entry point.y #27=#1+#33; //Entry point.y G90G00Z@90; G00X#16Y#1; //to Workpice.cen G00X#16Y#27; //approach Entry point G90G00Z#26; ;//----- Loop of x-y cut ------------ #3=1; N510 IF(#3 > #2 ) GOTO 560; IF(#3!=#2) GOTO 520; #13=#18-#17-(#20/2)+#5; GOTO 521; N520 #13=#18-#17-(#20/2)+(#3*#23); N521 #12=1; ;//- 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; #33=#1+#13; #32=2*#13; G90G01Y#33; ;//---CW Direction:G02 -------- IF(#21==3) GOTO 540; G91G01X#6; G02Y-#32R#13; G01X-#6; G01X-#6; G02Y#32R#13; G91G01X#6; GOTO 541; ;//---CCW Direction:G03 --------- N540 G91G01X-#6; G03Y-#32R#13; G01X#6; G01X#6; G03Y#32R#13; G91G01X-#6; //------------------------------ 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; N560 GOTO 9999;; // Eof x-y cut LOOP ;//----LOOP for inner finish machining. @81=4 With soft move--- ;// NOTE:Below code are the same(a copy) with Track-pocket N600 IF( #22 > (#20/2) ) GOTO 700; //check if sofe-move wanted IF( (2*#18) < (1.5*#20+#22) ) GOTO 700; IF(#21==3) GOTO 610; #14=#16-#20/2; //G02..soft Entry point.x #15=#1+(#18-#20); //G02..soft Entry point.y GOTO 611; N610 #14=#16+#20/2; //G03..soft Entry point.x #15=#1+(#18-#20); //G03..soft Entry point.y ; N611 G90G00Z@90; G90G00X#14Y#15; G90G00Z#26; #30=#20/2; // soft_in radius=1/2 phi #28=#18-#20/2; //..radius of machining. #29=2*#28; #12=1; ;//------Loop of Z_cut------- N620 IF(#12 > #11) GOTO 650; IF(#12!=#11) GOTO 630; #31=#26-#8; GOTO 631; N630 #31=#26-(#12*#4); N631 G90G01X#14Y#15; //to Entry point G90G01Z#31; // IF(#21==3) GOTO 640; G91G02X#30Y#30R#30; //soft_in G01X#6; G02Y-#29R#28; G01X-#6; G01X-#6; G02Y#29R#28; G01X#6; G91G02X#30Y-#30R#30; //soft_out GOTO 641; N640 G91G03X-#30Y#30R#30; //soft_in G01X-#6; G03Y-#29R#28; G01X#6; G01X#6; G03Y#29R#28; G01X-#6; G91G03X-#30Y-#30R#30; //soft_out N641 #12=#12+1; GOTO 620; //------Eof Z-cut LOOP------- N650 G90G00Z#26; GOTO 9999; ;//--LOOP for finish machining. @81=4 Without soft move-- N700 G90G00Z@90; G90G00X#16Y#1; G90G00Z#26; #30=#20/2; // soft_in radius=1/2 phi #28=#18-#20/2; //..radius of machining. #29=2*#28; // #27=#1+#28; // Entry point.Y ;//------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#16Y#1; // Center of workpice G90G01Z#31; // cut down G90G01X#16Y#27; // approatch to edge IF(#21==3) GOTO 740; G91G01X#6; G02Y-#29R#28; G01X-#6; G01X-#6; G02Y#29R#28; G01X#6; GOTO 741; N740 G91G01X-#6; G03Y-#29R#28; G01X#6; G01X#6; G03Y#29R#28; G01X-#6; ; N741 #12=#12+1; GOTO 720; N750 G90G00Z#26; //------Eof Z-cut LOOP------- GOTO 9999; ;//======================================================== N9999 G90G00Z@90; ;; M5; //Turn-OFF spindle and coolant ;; M9; ;; G90G00X#16Y#1; 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; N9070 $599=70; N9072 $599=72; N9073 $599=73; N9074 $599=74; N9075 $599=75; N9080 $599=80; N9081 $599=81; GOTO 8888; ;//-------------------------------------------------------- ;// Track Side cutting ;// FORMAT : @90 ---> ESCAPE Z AXIS DATA ;// @91 ---> FEEDRATE ;// @92 ---> TOOL DIAMETER ;// @93 ---> CUT WIDTH % ;// @94 ---> CONSTANT CUT WIDTH ;// @95 ---> SPINDLE SPEED (100%) ;// @81 ---> 1)ROUGH_INNER 2)FINISH_INNER ;// 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 ;//-------------------------------------------------------------------