chamfer o sub o call # = #1 # = #2 # = #3 ;depth of cut # = #4 # = #5 # = #6 # = #7 ;will be cut if > 0 # = #8 ;will be cut if > 0 # = #9 ;will be cut if > 0 # = #10 # = #11 o100 if [# NE #<_current_tool>] (MSG,ERROR : Set tool before use macro) o100 return [-2] ; indicate failure to epilog o100 endif G8 ; Lathe radius Mode G18 ; XZ Plane G21 ; Metric Units G90 ; Absolute Distance # = [# / 2] ; because of radius mode # = #<_x> (starting X) # = #<_z> (starting Z) G96 D# S# ; Constant Surface Speed Mode M3 ; Start Spindle G95 F# ; Feed-Per-Rev Mode G4P1 ; Wait to reach speed o110 if [#] M8 o110 endif # = 0 o200 if [# GT 0] ; front outside o201 while [[# + # ] lt # ] # = [# + # ] G0 x[# - #] z# G1 z# G1 x# z[# - #] G1 x# G0 z# o201 endwhile G0 x# z# G0 x[# - # ] G1 z# G1 x# z[# - # ] G1 x# G0 z# o200 elseif [# GT 0] ; front inside o202 while [[# + # ] lt # ] # = [# + # ] G0 x[# + #] z# G1 z# G1 x# z[# - #] G1 x# G0 z# o202 endwhile G0 x# z# G0 x[# + # ] G1 z# G1 x# z[# - # ] G1 x# G0 z# o200 elseif [# GT 0] ; back outside o203 while [[# + # ] lt ] # = [# + # ] G0 x[# - #] z# G1 z# G1 x# z[# + #] G1 x# G0 z# o203 endwhile G0 x# z# G0 x[# - ] G1 z# G1 x# z[# + ] G1 x# G0 z# o200 endif M5 M9 o call ; restore g20/21, g90/g91, feedrate cuter-comp and other using now global _backup_var o endsub M2 %