Here is a macro that does thread milling of NPT tapered pipe threds. IT is for a single point tool and does the threads as straight line segments NOT arcs. It will allow you to cut inside or outside threads . It does a standard thread taper angle
It has a programable front end that asks all the important questions to set up for each type thread. You set up major diam, tool diam , thread depth,etc
Please test before using to do something important. It works better on some computers better than others(;-) Different Ver of mach may react differently.
(;-) TP
'Macro Thread Mill NPT taper pipe thread
Sub Main()
Setvar(21,Getdro(0))
Setvar(23,Getdro(1))
Setvar(30,Getdro(2))
Setvar(22,question("Threads per inch"))
Setvar(28,question("Tool Diameter"))
Setvar(27,question("Start Major Diameter"))
Setvar(9,question("Feed Rate"))
Setvar(18, question("Resolution of thread"))
Setvar(29,question("Thread Depth"))
Setvar(26,(getvar(30)-Getvar(29)))
N0:
Setvar(31,question("InsideThread(0)....OutsideThread(1)"))
If getvar(31)=0 Then GoTo N1
If Getvar(31)=1 Then GoTo N2
If Getvar(31)>1 Then MsgBox"Selection OUT OF RANGE"
GoTo N0
N1:
Code" #1=[[#27/2]-[#28/2]]"
COde" #8= [1+[-1*[FUP[#26/[1/#22]]]]]"
Code"#3=0.0"
Code"#10=[360 / #18]"
Code"#109=#10"
Code"#110=[1 / #22]"
Code"#111=[0.0625 / #22]"
Code"#3=#18"
Code"G00 X#21 Y#23"
Code"G01 Z[#30-#29] F#9"
Code"#19=[#1 + #21]"
Code"G01 X#19 Y#23 F#9"
GoTo N3
N2:
Code" #1=[[#27/2]+[#28/2]]"
COde" #8= [1+[-1*[FUP[#26/[1/#22]]]]]"
Code"#3=0.0"
Code"#10=[360 / #18]"
Code"#109=#10"
Code"#110=[1 / #22]"
Code"#111=[-0.0625 / #22]"
Code"#3=#18"
Code"G00 X#21 Y#23"
Code"#19=[#1 + #21]"
Code"G01 X#19 Y#23 F#9"
Code"G01 Z[#30-#29] F#9"
GoTo N4
N3:
Do While Getvar(3) < 360.00000 * Getvar(
'*****
Code"#26=[#26 + [#110 / #109]]"
Code"#24=[COS[ #3 ] * #1]"
Code"#25=[SIN[ #3 ] * #1]"
Code"#24=[#24 + #21]"
Code"#25=[#25 + #23]"
Code"G01 X#24 Y#25 Z#26 F#9"
Code"#3=[#3 + #18]"
Code"#1=[#1 + [#111 / #109]]"
GoTo N3
Exit Do
loop
'*****
Code"G01 X#21 Y#23 F10"
Code"G00 Z1 M09"
Code"M30"
GoTo N5
N4:
Do While Getvar(3) < 360.00000 * Getvar(
'*****
Code"#26=[#26 + [#110 / #109]]"
Code"#24=[COS[ #3 ] * #1]"
Code"#25=[SIN[ #3 ] * #1]"
Code"#24=[#24 + #21]"
Code"#25=[#25 + #23]"
Code"G01 X#24 Y#25 Z#26 F#9"
Code"#3=[#3 + #18]"
Code"#1=[#1 + [#111 / #109]]"
GoTo N4
Exit Do
Loop
'*****
Code"G00 Z1 M09"
Code"G01 X#21 Y#23 F10"
Code"M30"
GoTo N5
N5:
End Sub
End