Threading Macro for Fanuc
#1=36(Major Diameter)
#2=27(Tool Diameter)
#3=-48(Depth of Thread)
#4=4(Pitch)
#8=2(Right hand/3 for left hand)
#5=[#1-#2]/2
#6=0
#7=#6-#4
M3 S2000 G54 G64 G94 F600
G91 G28 Z0.0
G90 X#5 Y#6
Z#6
N1 G91 G#8 I-#5 Z-#4
#7=#7-#4
IF[#7GE#3]GOTO1
G90 G0 X#6 Y#6
G91 G28 Z0.0
M30