(touch-off) (X = 0.000 at the center) (Y = 0.000 at the center) (Z = 0.000 at the top of the part) G20 G64 P0.002 G17 G40 G92.1 (get clear) G53G0Z-0.001 O2000 sub (subroutine to rough and finish mill a profile) (assumes profile goes in the +Y direction from the start point) (uses climb milling) (arguments) (#1 = x start point) (#2 = y start point) (#3 = O-number of subroutine with profile) (#4 = start Z level) (#5 = finish Z level) (#6 = tool diameter) (#7 = roughing feed) (#8 = roughing depth per pass) (#9 = finish feed) (#10 = finish pass width) (#11 = diameter of area available for ramp-down) (note: #11 must be bigger than #6 + 4 * #10) (internal variables) (#20 = current z value) O2001 if [#5 GT #4] (DEBUG, Finish Z <#5> is above start Z <#4>) M2 O2001 endif O2002 if [#11 LE #6+4*#10] (DEBUG, ramp down area too small, use a smaller tool?) M2 O2002 endif (negative value would make infinite loop) #8 = [ABS[#8]] (don't want comp on at this point) G40 (initial Z - in the clear) #20 = [#4+#8] (go to starting location) G0X[#1-#11/2]Y[#2-#11/2]Z#20 (turn on comp - oversize tool for roughing) G41.1D[#6+2*#10] (arc move to get comp started - still at safe height) G3F#7I0J[#11/2]X#1Y#2 (calc new Z) #20 = [#20-#8] (roughing loop) O2003 while [#20 GT #5] (helical ramp down) G3I[0-#11/2]J0X#1Y#2Z#20 (mill profile) O[#3] call #20 = [#20-#8] O2003 endwhile (final helical ramp to the proper depth) #20 = #5 G3I[0-#11/2]J0X#1Y#2Z#20 (mill profile at final depth) O#3 call (arc out) G3I[0-#11/2]J0X[#1-#11/2]Y[#2+#11/2] (up to clear material) G0Z[#4+#8] (comp off) G40 (go to starting point for finish pass) G0X[#1-#11/2]Y[#2-#11/2] (turn on comp - finish tool size) G41.1D[#6] (arc to profile start point at safe height) G3F#9I0J[#11/2]X#1Y#2 (helical ramp down to finish depth) G3I[0-#11/2]J0X#1Y#2Z#5 (mill profile) O[#3] call (arc out) G3I[0-#11/2]J0X[#1-#11/2]Y[#2+#11/2] (comp off) G40 (this should result in no net movement) (since it moves by exactly the tool radius) G0X[#1-#11/2]Y[#2+#11/2-#6/2] (get up out of the hole) G0Z[#4+#8] O2000 endsub O2100 sub (subroutine to rough and finish mill a profile) (assumes profile goes in the -Y direction from the start point) (uses conventional milling) (arguments same as O2000) O2101 if [#5 GT #4] (DEBUG, Finish Z <#5> is above start Z <#4>) M2 O2101 endif O2102 if [#11 LE #6+4*#10] (DEBUG, ramp down area too small, use a smaller tool?) M2 O2102 endif (negative value would make infinite loop) #8 = [ABS[#8]] (don't want comp on at this point) G40 (initial Z) #20 = [#4+#8] (go to starting location) G0X[#1-#11/2]Y[#2+#11/2]Z#20 (turn on comp - oversize tool for roughing) G42.1D[#6+2*#10] (arc down and into start point) #20 = [#20-#8] G2F#7I0J[#11/-2]X#1Y#2Z#20 (calc new Z) #20 = [#20-#8] (roughing loop) O2103 while [#20 GT #5] (helical ramp down) G2I[0-#11/2]J0X#1Y#2Z#20 (mill profile) O[#3] call #20 = [#20-#8] O2103 endwhile (final helical ramp to the proper depth) #20 = #5 G2I[0-#11/2]J0X#1Y#2Z#20 (mill profile at final depth) O#3 call (arc out) G2I[0-#11/2]J0X[#1-#11/2]Y[#2-#11/2] (up to clear material) G0Z[#4+#8] (comp off) G40 (go to starting point for finish pass) G0X[#1-#11/2]Y[#2+#11/2] (turn on comp - finish tool size) G42.1D[#6] (arc to profile start point at safe height) G2F#9I0J[#11/-2]X#1Y#2 (helical ramp down to finish depth) G2I[0-#11/2]J0X#1Y#2Z#5 (mill profile) O[#3] call (arc out) G2I[0-#11/2]J0X[#1-#11/2]Y[#2-#11/2] (comp off) G40 (this should result in no net movement) (since it moves by exactly the tool radius) G0X[#1-#11/2]Y[#2-#11/2+#6/2] (get up out of the hole) G0Z[#4+#8] O2100 endsub O300 sub (profile of outside of wheel) (this is the actual metal edge, no compensation) (clockwise, climb milling) (start/finish point is vertical center of left edge) G1 X-1.6500 Y 0.0000 G2 I 1.6500 J 0.0000 X-1.6500 Y 0.0000 O300 endsub O400 sub (profile of first lightening hole) (this is the actual metal edge, no compensation) (counter-clockwise, climb milling) (start/finish point is vertical center of right edge) G1 X-0.3313 Y 0.0000 G2 I 0.3313 J 0.0000 X-0.2987 Y 0.1433 G3 I-0.1804 J 0.0865 X-0.3059 Y 0.3298 G1 X-0.6777 Y 0.9739 G3 I-0.1732 J-0.1000 X-0.9905 Y 1.0171 G3 I 0.9905 J-1.0171 X-0.9905 Y-1.0171 G3 I 0.1396 J 0.1432 X-0.6777 Y-0.9739 G1 X-0.3059 Y-0.3298 G3 I-0.1732 J 0.1000 X-0.2987 Y-0.1433 G2 I 0.2987 J 0.1433 X-0.3313 Y 0.0000 O400 endsub O410 sub (profile of second lightening hole) (this is the actual metal edge, no compensation) (counter-clockwise, climb milling) (start/finish point is vertical center of right edge) G01 X 1.3822 Y 0.3000 G03 I-0.2000 J 0.0000 X 1.3761 Y 0.3492 G03 I-1.3761 J-0.3492 X-0.3856 Y 1.3663 G03 I 0.0543 J-0.1925 X-0.5045 Y 1.0739 G01 X-0.1327 Y 0.4298 G03 I 0.1732 J 0.1000 X 0.0253 Y 0.3304 G02 I-0.0253 J-0.3304 X 0.2734 Y 0.1871 G03 I 0.1651 J 0.1129 X 0.4385 Y 0.1000 G01 X 1.1822 Y 0.1000 G03 I 0.0000 J 0.2000 X 1.3822 Y 0.3000 O410 endsub O420 sub (profile of third lightening hole) (this is the actual metal edge, no compensation) (counter-clockwise, climb milling) (start/finish point is vertical center of right edge) G01 X 1.3822 Y-0.3000 G03 I-0.2000 J 0.0000 X 1.1822 Y-0.1000 G01 X 0.4385 Y-0.1000 G03 I 0.0000 J-0.2000 X 0.2734 Y-0.1871 G02 I-0.2734 J 0.1871 X 0.0253 Y-0.3304 G03 I 0.0153 J-0.1994 X-0.1327 Y-0.4298 G01 X-0.5045 Y-1.0739 G03 I 0.1732 J-0.1000 X-0.3856 Y-1.3663 G03 I 0.3856 J 1.3663 X 1.3761 Y-0.3492 G03 I-0.1939 J 0.0492 X 1.3822 Y-0.3000 O420 endsub G53G0Z-0.001 M3S400 G4P2 (the end mill I'm using is a nominal 1/4") (mill the outside perimeter) #1 = -1.6500 (x start point) #2 = 0.0000 (y start point) #3 = 300 (subroutine with part profile) #4 = 0.000 (start Z level) #5 = -0.140 (finish Z level) #6 = 0.250 (tool diameter) #7 = 5 (roughing feed) #8 = 0.030 (roughing depth per pass) #9 = 3 (finish feed) #10 = 0.008 (finish pass width) #11 = 0.500 (space for ramping) G0X#1Y#2Z1 F#7 O#3 call (testing only to see the profile) O2000 call [#1][#2][#3][#4][#5][#6][#7][#8][#9][#10][#11] G0Z1 (mill the first cutout) #1 = -0.3313 (x start point) #2 = 0.0000 (y start point) #3 = 400 (subroutine with part profile) #4 = 0.000 (start Z level) #5 = -0.140 (finish Z level) #6 = 0.250 (tool diameter) #7 = 5 (roughing feed) #8 = 0.030 (roughing depth per pass) #9 = 3 (finish feed) #10 = 0.008 (finish pass width) #11 = 0.350 (space for ramping) G0X#1Y#2Z1 F#7 O#3 call (testing only to see the profile) O2000 call [#1][#2][#3][#4][#5][#6][#7][#8][#9][#10][#11] G0Z1 (mill the second cutout) #1 = 1.3822 (x start point) #2 = 0.3000 (y start point) #3 = 410 (subroutine with part profile) #4 = 0.000 (start Z level) #5 = -0.140 (finish Z level) #6 = 0.250 (tool diameter) #7 = 5 (roughing feed) #8 = 0.030 (roughing depth per pass) #9 = 3 (finish feed) #10 = 0.008 (finish pass width) #11 = 0.350 (space for ramping) G0X#1Y#2Z1 F#7 O#3 call (testing only to see the profile) O2000 call [#1][#2][#3][#4][#5][#6][#7][#8][#9][#10][#11] G0Z1 (mill the third cutout) #1 = 1.3822 (x start point) #2 = -0.3000 (y start point) #3 = 420 (subroutine with part profile) #4 = 0.000 (start Z level) #5 = -0.140 (finish Z level) #6 = 0.250 (tool diameter) #7 = 5 (roughing feed) #8 = 0.030 (roughing depth per pass) #9 = 3 (finish feed) #10 = 0.008 (finish pass width) #11 = 0.350 (space for ramping) G0X#1Y#2Z1 F#7 O#3 call (testing only to see the profile) O2000 call [#1][#2][#3][#4][#5][#6][#7][#8][#9][#10][#11] G0Z1 M5 G53G0Z0 G0Y2 M2 %