Hello all,
I am no way new or afraid of running subs and loops while programming lathes. I have manually coded a sub within a sub within a sub to run on older lathes as well. My problem is that I have a Fanuc 18i that I would like to go back to basics on for the parts we will run. I have run macros on other lathes, but want to explore keeping it simple. There are alot of non answers out there or always saying, nope...you HAVE to do a macro. So I am hoping some folks here will have some input. I want the safest easiest and quickest way to change this main part to different Diameter/Length spacers so keep that in mind as well instead of loading in an entire new program. I have already set my parameter 6005 to do an internal sub and that works fyi. Any other parameters need to be looked at let me know.

Lets say I have a very basic lathe loop and want to convert from an older G92 setup that is proven to something that can can be used in this controller. What I want to accomplish is resetting the work zero after it parts off each spacer to run multiple spacers out of one "pull" or stick out.
I am putting the code below for just the spacer cut part, not any previous facing, turning, drilling to keep it focused and simple. Yes, I do also have turned each spacer and parted off with the MDT, just not this program. So focus just on this below:

*2" dia with 1.250" thru hole around .187(9) wide/thick

T0303(MDT/partoff)
G0 X2.010 Z.1
G0 Z0.0
G1 X1.250 F.004


G0 X2.020 Z.1
G1 X2.010 Z0.0 F.02
G92 X2.010 Z0.0
M98 P1 L8(spacer count)
G53 O0
G90
G97 S650
G0 X13 Z10

M30

O1(Internal SUB)

G1 Z.000 F.02
G1 X2.000 F.002
G1 Z-.015
G1 X1.970 Z0.0
G0 X2.010
G0 Z-.292
G1 X2.000
G1 X1.970 Z-.307 F.002
G1 X1.200 F.0025
G0 X2.010
G92 X2.010 Z0.0
G90
M99