What's new
What's new

How do you G code a NPT external on lathe?

Higgins909

Aluminum
Joined
Nov 19, 2018
I can program basic shapes, but when it comes to threads/angles idk what's going on. It's a Mitsubishi lathe with a M70 controller. Shares a lot of code with HAAS I think but some are different. I have a 24th edition Machinery's Handbook. I found the NPT area and could not figure out how to calculate this thread. Looking at the print it shows the thread kind of blending in with the diameter. I could just tell it to make a L2 E2 thread but that wouldn't match up with the diameter of the part. I speak in Inches and my G-code is messy as I haven't done much with it.

The example part:
1/4 NPT external with some kind of unspecified 45 deg chamfer on the first thread/s... I haven't even started to worry about calculating that. Then the rest of the diameter of the shaft is 0.545"... 2" part with a 1/4 NPT thread with that DIA the whole length.

So I've figured that I need to have a ramp up area and I thought I calculated that ok. X0.4648 Z0.2 . I've found that every inch of thread is tapered at .0625" so I did that x .2 and took that number and subtracted from the E0 number. I thought I was getting somewhere then I realized I needed to calculate the thread to match the .545 diameter. That's where I struggled. I somehow came up with it being about 1.08" long. The taper looked possibly ok in Fusion 360 but the length looked way too long. (Fusion doesn't have NPT from my findings and skills are limited on that as I use it for basic 3d printing only)

I also struggle with the G76. I THINK I got everything correct on the G76 minus the R value which I don't really understand and the X Z positions. I have noticed my G71 might not be using TNR (G42) properly. But this is the code I had made. It's not much, I was stressing on the calculations of the NPT more than anything... I got off work and have spent several hours trying to figure it out... I don't call myself a machinist.

Thanks,
Higgins909

Code:
(OP1 R3 EDITING0 ;
(CAUTION-RESTART) ;
(T1 ROUGH) ;
(T2 DRILL) ;
(T3 FIN) ;
(T5 THREAD) ;
(T8 CEN) ;
(G54) ;
;
(BARPULL FACE) ;
T0101 ;
G00 G18 G20 G40 G80 G99 ;
G54 G50 S3000 ;
G00 X0.2 Z0.025 ;
M00 ;
;
;
(TURN);
G00 Z0.1 ;
X0.75 ;
G97 S750 M03 ;
G96 S500 M08 ;
G01 Z0.002 F0.008 ;
X-0.032 ;
G00 Z0.1 ;
X0.75 ;
;
;
G71 U0.02 R0.05 ;
G71 P100 Q110 U0.020 W0.002 F0.008 ;
N100 G00 G42 X0.4773 Z0.0 F0.0035 ;
G01 X0.5025 Z-0.4018 ;
G01 X0.545 ;
G01 G40 Z-2.0 ;
N110 G40 X0.75 ;
;
;
G97 S750 ;
G28 G00 U0.0 M09 ;
G28 G00 W0.0 ;
;
;
(FIN FACE TURN);
T0303 ;
G00 G18 G20 G40 G80 G99 ;
G54 ;
G50 S3000 ;
G97 S750 M03 ;
;
G00 X0.75 Z0.0 ;
G96 S500 M08 ;
G01 X-0.032 F0.005 ;
G00 Z0.1 ;
X0.45 ;
;
G70 P100 Q110;
;
G97 S750 M05 ;
G28 G00 U0.0 M09 ;
G28 G00 W0.0 ;
;
;
(THREAD);
T0505 ;
G00 G18 G20 G40 G80 G99 ;
G54 ;
G50 S3000 ;
G97 S750 M03 ;
;
G00 X0.4648 Z0.2 M08 ;
;
G76 P020029 Q50 R10 ;
G76 X 0.5025 Z-0.4018 R-0.0312 P444 Q50 F0.0555 ;
;
G28 G00 U0.0 M09 ;
G28 G00 W0.0 ;
;
M30 ;
 
It might depend on your post, but in Fusion you should be able to model the taper and then use the tapered surface to drive your threading cycle.
 
Approximate length of 3/8 NPT thread is 5/8". Start the thread 0.2" in front of the part.
.825 (L of thread + 0.2 clearance) x .0625 (taper per inch) = 0.0515
0.515 / 2 = 0.026. This is you I value.

Use G92 threading cycle (your machine may or may not have it)

G97 S500 M3
G0 X0.75 Z0.2
G92 X0.57 Z-0.625 I-0.026 F0.0556
X0.56
X0.55
X0.54
X0.531
X0.522
X0.514
X0.507
X0.501
X0.495
X0.491
X0.488
X0.487
G0 Z0.5
G28 U0 W0
M1
 
Making external NPT threads isn't as complicated as you think but there are a few things to keep in mind. I don't make NPT threads that are flying to the moon so they aren't 100% by the book but they work well enough for me.

The first thing I notice in your threading cycle is the intial X that you are rapiding to. I always use a value larger than the major diameter of the thread, by about .050-.1". Honestly, your value may work fine but I've never done it this way. The machine retracts to this value on the way to the front of the part. For your example, I would make the value 0.6".

Turning the actual stock for the thread isn't all that critical. As long as you're somewhat close is all that maters. You'll know if you are off once you machine the thread. If you see that the crest of the thread is sharp on one end and has flats on the other, you can make adjustments afterwards. When you calculate the taper for the threads, you'll know the taper you'll need or close to it at least.

As for the calculating the threads, first calculate the total length of travel for the thread (ie. length of the thread plus the lead in distance). Your program being .4081 + 0.2 = 0.6081". Now you need trig to figure out the rise of the thread. NPT threads are 1.79 degrees from the centerline. You calculate using TAN 1.79 degrees multiplied by the length of the thread, 0.6081. Result is 0.019". This is your R value in negative, since the diameter gets bigger towards the end. R would be positive for an internal NPT thread. Now you know that the taper is .019" you can figure out how much taper to cut on the material prior to threading.If .019" is the taper for .608" of total length and the actual thread on the part is only about 2/3rd's of that, .408, multiply .019 by 2/3rd's, or about .013" per side. Taking into account the length of chamfer at the start of the thread plus how much the taper continues past the end of the thread, you would need to increase the diameter by .026". Example, if the front chamfer is 0.03" and the taper continues for .06 past the end of the thread, you'd increase the diameter by about .028 from the end of the chamfer to the end of the taper.

Hope this makes sense and helps.
 








 
Back
Top