As always reference the LinuxCNC manuals and the LinuxCNC Wiki for more information.

NGCGUI Lathe OD Radius

The Lathe OD Radius subroutine will cut a radius on an outside leading edge of a part.

o<radius> sub
#<x_dia> = #1 (=1.0 Diameter)
#<rad> = #2 (=.375 Radius)
#<z_start> = #3 (=0.000 Z Start)
#<doc> = #4 (=.025 DOC)
#<feed> = #5 (=5 Feed)
#<tool> = #6 (=1 Tool)
#<sfm> = #7 (=100 SFM)
#<rpm> = #8 (=2000 RPM)
#<coolant> = #9 (=8 Coolant)
#<last_op> = #10 (=1 1 = Last Op)

#<z_step> = #<doc>
#<x_step> = [#<x_dia> - [#<doc> * 2]]

G7 G18 G40 F#<feed>
G96 D#<rpm> S#<sfm>

o100 if [#<tool> NE #5400]
  T#<tool> M6
o100 endif
G43

M3 M#<coolant>

G0 X[#<x_dia> + 0.100] Z[#<z_start> + 0.125]
G41
o110 while [#<rad> GT #<z_step>]
G0 Z[#<z_start> + 0.050]
G0 X[#<x_dia> + 0.100]
G0 Z[#<z_start> - #<z_step>]
G1 X#<x_dia>
G2 X#<x_step> Z#<z_start> I-#<z_step> K0.0
#<x_step> = [#<x_step> - [#<doc> * 2]]
#<z_step> = [#<z_step> + #<doc>]
o110 endwhile

G40
G0 Z[#<z_start> + 0.050]
X[#<x_dia> + 0.100]
M5 M9

o200 if [#<last_op> EQ 1]
  G53 G0 X0 Z0
o200 endif

o<radius> endsub
M2