Threads for 3D Printing in FreeCAD
A bit nuanced, this.
1. Basic inner thread construction (like on a bolt)
We’ll construct the shank of the bolt, the thread, and the head of the bolt, in that order. Assume for this description that we’re modeling a bolt sat vertically on its head, so the thread is spinning up around the Z axis.
We’ll Use a helix cut, not a helix addition, to make chamfers low-effort.
Make a rectangle sketch on the XZ plane to define the shank profile.
We’re going to define the volume with a revolution, so the lower left
corner of the rectangle should be on the origin, the height of the
rectangle should be
Thread.Length, and the width should be the outer
radius of the thread, which we’ll call
Thread.OD/2. Create a
revolution with the sketch.
Make a new sketch to define the thread profile. Pay attention to where the seam of the shank geometry is. You want your thread profile sketch not to interfere with it, or the geometry kernel gets all confused because points and lines will be coincident and it won’t know what’s supposed to be inside and what’s supposed to be outside. In our case that means putting the sketch on the YZ plane.
The upper edge of your thread cut profile should be coincident with the lower edge of the bottom end of the shank.
The dimensions for the thread profile should be:
- Small inner vertical height:
Thread.Pitch * 1/4
- Angle between diagonals:
- Vertical profile height:
Thread.Pitch * 7/8
- Additional overlap outside the shank:
The radius of the shank is
Thread.OD/2, but we should set the distance
from the Z axis to the outer corner of the diagonals of the profile to
Thread.OD/2 + 0.01, so that those corners miss the surface of the
cylinder and the geometry kernel doesn’t have to work too hard.
Make a helix cut from the thread profile sketch. Set the pitch to
Thread.Pitch. Set the length to
Thread.Length + Thread.Pitch, so
that the full length of the shank is threaded. Note that if we had
modeled the head of the bolt first, this wouldn’t work, because we’d be
cutting into the head at this point and have to make do with a portion
of the shank unthreaded.
The thread is now defined.
To define the head, create a new sketch on the XY plane and draw a hexagon larger than the diameter of the shank. Pad it by 5mm in the reverse direction.
If you want to chamfer the end of the bolt, return to the shank profile sketch. Change the top right corner of the rectangle to have a 45-degree angle cut out, and close the sketch.
2. Basic outer thread construction (like inside a nut)
The process for an outer thread is as for an inner thread, with these changes:
- The shank profile should be the profile of a tube with an inner
Thread.OD - Thread.Pitch * (sqrt(3)/2) * 5/8) * 2 + 0.4 * 2. We can call this
Thread.ID + 0.4 * 2. The term
Thread.Pitch * (sqrt(3)/2) * 5/8is the thread depth. The 0.4 term is the clearance between the inner and outer threads: I’ve found that a clearance of 0.2mm on printed parts is enough for two parts to interface without too much friction, and if you do the trig calculations you’ll see that with an angle of 30 degrees to the horizontal, you double the clearance: a face separation of 0.2mm requires a horizontal separation of 0.4mm. The outer diameter of the tube can be whatever is convenient.
- The profile has the opposite orientation to the prior, with the small edge pointing outwards.
- The profile dimensions differ:
- Small edge length:
Thread.Pitch * 1/8
- Vertical profile height:
Thread.Pitch * 3/4
- Small edge length:
We set the distance from the Z axis to the inner corner of the diagonal
edges to be
Thread.ID/2 + 0.4 - 0.01
3. Actual bolts
Threads as part of actual bolts may need to be printed horizontally, rather than vertically, so that the printed layers don’t present weak planes normal to the length of the bolt. It’s fine to print them on their side, with a flat above and below.
4. Outer threads that don’t collapse
Continuous outer threads tend not to print well, because the strands of filament detach from the thread as they contract and cool. To prevent this, cut sections out of the thread so that it’s composed of many short lengths, rather than long ones. You want to cut 8 vertical slots through all the threads; the number isn’t critical, but what you’re aiming for is to make each remaining section of thread more closely approximate a ledge than a circle. It won’t completely compensate for poorly adhering overhangs, but it’ll vastly reduce the problem with the number of new anchor points it introduces.
5. Sneaky part geometry
If the threaded part has any other complicated geomemtry (like, say, a gear cut out of part of it) then the geoemtry kernel seems to get bogged down. It ends up trying to calculate whether the thread and that other geometry intersect at all if they’re part of the same body, and often we can avoid that by being a little sneaky.
Take our bolt, for instance: imagine, for whatever reason, we wanted the head of the bolt to be in the shape of an involute gear from the FCGear workbench. There are reasons you might want to do this: you could imagine a worm drive laid out like this. Anyway, what I’d do is model the bolt as just a cylinder for the shaft, and the head of the bolt. Only I’d make the shaft diameter equal to the inside diameter of the thread. Then, in another body, I’d make a threaded sleeve that was a tube, of inside diameter just fractionally less than the thread ID, and outside diameter the thread OD, and cut the thread out of that. Then assemble the bolt and the threaded sleeve in Assembly4.
Now, here we can be a little sneaky. Because of the way slicers work, if we’re modeling for 3d printing, we don’t need to union the sleeve and shaft together to make a single solid. Just by having them overlap, when we export an STL and slice them in the slicer, they’ll get printed as a single body with exacty the same paths as though we’d done a boolean Union. That can save us doing geometry calculations we don’t need.