(info: Imperial Threading) ; ; o sub (Change these values) #<_MajorDiameter> = #1 (Major Diameter inch) #<_TPI> = #2 (TPI) #<_Z_Finish> = #3 (+/- Z Length inch, Z) (Don't usually have to change these values) (PeakOffset is initial tool clearance) #<_Allowance> = #4 (=0.0015 Diameter external only) #<_PeakOffset> = #5 (=-.004 Peak Offset -external, +internal, I) #<_TipRadius> = #6 (=0.004 Tip Radius) #<_Z_LeadIn> = #7 (=0.1 Z Leadin) #<_Z_Final> = #8 (=2 Z Final Position) #<_Spring_Passes> = #9 (=1 Spring Passes, H) #<_First_Cut_Depth> = #10 (=0.007 First Cut Depth, J) #<_Depth_Regression> = #11 (=1.2 Depth Regression, R) #<_CompoundSlideAngle> = #12 (=29.5 Angle, Q) #<_TaperAmount> = #13 (=0 Taper) #<_TaperType> = #14 (=0 Taper Type, L) # = #15 (=500 Spindle RPM) # = #16 (=1 Tool Number) # = #17 (=8 Coolant 8 On 9 Off) (check to see if tool set) o100 if [#5400 EQ 0] (msg, Tool not set) M2 o100 endif o220 if [#<_metric> EQ 1] # = 1 G20 (set imperial units) o220 else # = 0 o220 endif (Calculations) #<_Pitch>=[1 / #<_TPI>] (calculate ThreadDepth, K) o110 if [#<_PeakOffset> GT 0] (internal = pitch * cos30 * 2 * 6/8 - 2 * tip radius) #<_ThreadDepth>=[#<_Pitch> * 1.299 - 2 * #<_TipRadius>] (thread height = pitch * cos30 * 2 * 5/8) #<_MinorDiameter>=[#<_MajorDiameter> - #<_Pitch> * 1.0825] #<_Diameter>=[#<_MinorDiameter> - #<_PeakOffset>] o110 else (external = pitch * cos30 * 2 * 7/8 - 2 * tip radius) #<_ThreadDepth>=[#<_Pitch> * 1.5155 - 2 * #<_TipRadius> + #<_Allowance>] #<_Diameter>=[#<_MajorDiameter> + #<_PeakOffset>] o110 endif G7 G18 G20 G54 G90 G94 G95 (feed per revolution mode) T# M6 G43 M3 M# F0 S# (Go to start diameter and Z Lead in) G0 X#<_Diameter> Z#<_Z_LeadIn> (Thread) G76 P#<_Pitch> Z#<_Z_Finish> I#<_PeakOffset> J#<_First_Cut_Depth> R#<_Depth_Regression> K#<_ThreadDepth> Q#<_CompoundSlideAngle> H#<_Spring_Passes> L#<_TaperType> G00 X#<_Diameter> G00 Z#<_Z_Final> M5 M9 ; Restore to normal units o230 if [# EQ 1] G21 (metric units) o230 else G20 (imperial units) o230 endif o endsub