#9001=4.7625 (tool diameter) #9002=[#9001/2] (tool radius) #9003=3 (rapid height) #9004=4.5 (plunge depth) #9005=18 (stock depth) ; #9005=6 (stock depth) #9006=[round[#9005/#9004]] (number of steps for cut through) #9007=300 (feed rate) #9011=40 (part width and height) #9012=[#9011/2] (part center) #9013=7 (hole offset from edge) #9014=[#9013+#9002] (corner radius) #9015=[#9011-[2*#9013]] (edge length accounting for radiuses) #9016=6.75 (screw hole diameter) #9017=45 (stepover, depends on #9011 and #9001) #9020=10 (circle radius, set later) O0000 G0 G49 G40 G17 G80 G50 G90 ; M6 T0(TOOL DIA.4.7625) G64 G21 (mm) ;M98 P9998 L1 (frame finish) ;M98 P4000 L2 (ear bud section) M98 P3000 L5 (speaker section) ;M98 P1000 L2 (end cap) ;M98 P2000 L2 (mic section) M5 M9 M30 O1000 (end cap - advances in X) M98 P1001 (17 mm pocket) M98 P0004 (basic frame) M99 O2000 (mic section - advances in X) M98 P2001 (19 mm cuttrough) M98 P0004 (basic frame) M99 O3000 (spkr section - advances in X) M98 P3001 (17 mm cutthrough) M98 P3002 (21 mm rim) M98 P3003 (side slot, 9 mm wide by 7 mm deep) M98 P0004 (basic frame) M99 O4000 (ear bud section - advances in X) M98 P4001 (18 mm cutthrough) M98 P4002 (side slot for ear bud, 5.5 mm wide by 5.5 mm deep) M98 P0004 (basic frame) M99 O0012 (screw hole pass, position independent) G91 G01 Z[0-#9004] (plunge) G90 (G12 misbehaves in G91 mode so the G91/G90 must tightly enclose the plunge) G12 I[[#9016/2]-#9002] (small circular pocket) M99 O0022 (drill screw hole and retract to rapid height) G01 Z0 (touch down) M98 P0012 L#9006 G00 Z#9003 M99 O0002 (4 hole drill pattern - no side effects on offset) G00 Z#9003 G00 X[#9011-#9013] Y#9013 M98 P0022 G00 X[#9011-#9013] Y[#9011-#9013] M98 P0022 G00 X#9013 Y[#9011-#9013] M98 P0022 G00 X#9013 Y#9013 M98 P0022 M99 O1011 (17 mm pocket step, position independent) G01 Z[0-#9004] (plunge) G2 Y0 X3.5719 R1.7859 F#9007 Y0 X-7.144 R3.5719 Y0 X9.691 R4.8453 Y0 X-12.382 R6.11875 X12.382 Y0 R6.11875 G1 X-6.11875 M99 O1001 (17 mm pocket x 9mm deep at 20,20) G00 Z#9003 (rapid) G00 X#9012 Y#9012 (center) G01 Z0 (touch down) G91 M98 P1011 L[round[9/#9004]] G90 G00 Z#9003 (rapid) M99 O0013 (frame cutout pass 3 mm deep) ;G01 Z[0-#9004] G01Z-4.4 G02 X[0-#9014] Y[0-#9014] R#9014 G01 X[0-#9015] G02 X[0-#9014] Y#9014 R#9014 G01 Y#9015 G02 X#9014 Y#9014 R#9014 G01 X#9015 G02 X#9014 Y[0-#9014] R#9014 G01 Y[0-#9015] M99 O0003 (frame cutout 18 mm deep) G00 Z#9003 (rapid) G00 X[#9011+#9002] Y#9013 G01 Z0 (touch down) G91 ;M98 P0013 L[#9006-1] M98 P0013 L4 G90 G00 Z#9003 M99 O9999 (frame cutout finish) G00 Z#9003 (rapid) G00 X[#9011+#9002] Y#9013 G01 Z-13.5 (touch down) G91 M98 P0013 L1 G90 G00 Z#9003 G00 X#9017 Y0 G92 X0 M99 O9998 (frame cutout finish) M98 P9999 L6 M99 O0004 (basic frame with holes, cutout, advance) M98 P0002 (4 holes) M98 P0003 (cutout) G00 Z#9003 G00 X#9017 Y0 G92 X0 M99 O2001 (19 mm centered cutthrough) #9020=19 (hole radius - tool radius) M98 P0010 M99 O3001 (17 mm centered cutthrough) #9020=17 (hole radius - tool radius) M98 P0010 M99 O3002 (21 mm rim x 5 mm deep at 20,20) #9021=[[21/2]-#9002] (hole radius - tool radius) G00 Z#9003 (rapid) G00 X#9012 Y#9012 (center) G01 Z0 (touch down) G91 (incremental mode) G01 X[0-#9021] (go to circumference) G01 Z[0-#9004] (plunge) G02 Y0 X[0+2*#9021] R#9021 F#9007 G02 Y0 X[0-2*#9021] R#9021 F#9007 G01 Z[#9004-5] (plunge - depth is now 5 because incremental) G02 Y0 X[0+2*#9021] R#9021 F#9007 G02 Y0 X[0-2*#9021] R#9021 F#9007 G90 (absolute mode) G00 Z#9003 M99 O3003 (speaker side slot, 9 mm wide by 7 mm deep) #8000=9 (width) G00 Z#9003 (rapid) G00 X#9012 Y#9012 (center) G01 Z[0-#9004] (plunge) M98 P0014 L1 (cut) G01 Z-7 (plunge) M98 P0014 L1 (cut) G00 Z#9003 (rapid) M99 ; O4012 (ear bud side slot pass) ; G01 Y20.37 ; X-.1 ; Y19.63 ; X#9012 ; Y#9012 ; M99 O4002 (ear bud side slot, 5.5 mm wide by 5.5 mm deep) #8000=5.5 (width) G00 Z#9003 (rapid) G00 X#9012 Y#9012 (center) G01 Z[0-#9004] (plunge) M98 P0014 L1 (cut) G01 Z-5.5 (plunge) M98 P0014 L1 (cut) G00 Z#9003 (rapid) M99 O4001 (18 mm centered cutthrough) #9020=18 (hole radius) M98 P0010 M99 ; Global subroutines O0014 (side slot pass) #8001=[#8000/2 - #9002] G91 G01 Y#8001 X[0-#9012-.1] Y[0-2*#8001] X[#9012+.1] Y#8001 G90 M99 O0011 (circle step, effective radius in #9021, step depth in #9004) G01 Z[0-#9004] (plunge step) G02 Y0 X[0+[2*#9021]] R#9021 F#9007 G02 Y0 X[0-[2*#9021]] R#9021 F#9007 M99 O0010 (cutthrough circle, radius in #9020) #9021=[#9020/2 - #9002] G00 Z#9003 G00 X#9012 Y#9012 G91 G00 X[0-#9021] G01 Z[0-#9003] (abs Z=0) M98 P0011 L#9006 G90 G00 Z#9003 M99