;radius o sub o call # = #1 # = #2 # = #3 # = #4 ;depth of cut # = #5 # = #6 # = #8 ;will be cut ig freater than 0 # = #9 ;will be cut ig freater than 0 # = #10 ;will be cut ig freater than 0 # = #11 # = #12 ;M6 T# G43 o100 if [# NE #<_current_tool>] (MSG,ERROR : Set tool before use macro) o100 return [-2] ; indicate failure to epilog o100 endif G7 ; Lathe diameter 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# G3 x# z[# - #] K[-#] G1 x# G0 z# o201 endwhile G0 x# z# G0 x[# - #] G1 z# G3 x# z[# - #] K[-#] G1 x# G0 z# o200 elseif [# GT 0.5] ; front inside o202 while [[# + #] lt #] # = [# + #] G0 x[# + #] z# G1 z# G2 x# z[# - #] K[-#] G1 x# G0 z# o202endwhile G0 x# z# G0 x[# + #] G1 z# G2 x# z[# - #] K[-#] G1 x# G0 z# o300 elseif [# GT 0.5] ; back outside o301 while [[# + #] lt #] # = [# + #] G0 x[# - #] z# G1 z# G2 x# z[# + #] K# G1 x# G0 z# o301 endwhile G0 x# z# G0 x[# - #] G1 z# G2 x# z[# + #] K# G1 x# G0 z# o300 endif M5 M9 o call ; restore g20/21, g90/g91, feedrate cuter-comp and other using now global _backup_var o endsub M2 %