Thread for Screw Tutorial

Introduction
This tutorial is a collection of techniques to model screw threads in FreeCAD.

In traditional CAD systems modelling threads is discouraged, because it puts a big load on the modelling kernel, as well as on the rendering side. In most cases, a thread does not need to be represented exactly, as it can be indicated in a technical drawing when it is time to manufacture.

Thread shapes take a lot of memory, and having just one thread in a FreeCAD project can increase the file size significantly. However, with the popularization of additive manufacturing (3D printing), there is a real need to model threads, in order to print them exactly as designed. This is what this tutorial is for.

See also helpful videos.
 * Introducing a strategy for designing a bolt without the commonly found problems.

Method 0. Obtain one from libraries of parts
Using models that other people have made is easy and saves time. See the external workbenches page for information on external tools.

In particular, two resources are recommended that can be installed from the Addon Manager:
 * Fasteners Workbech, to place parametric screws and washers that follow ISO standards. The screws and nuts by default don't show a thread, but this can be controlled with an option.
 * BOLTSFC, to place standards parts from the BOLTS library, which also follow ISO standards.

Method 1. Using macros (deprecated)

 * In the past, the Macro BOLTS was used to insert the parts from the BOLTS library. This is now deprecated. Use the BOLTSFC workbench instead.


 * In the past the stand-alone Screw Maker macro, by ulrich1a, was used to create individual bolts, screws, and washers. This is now deprecated. The Fasteners workbench, by shaise, includes the screw maker macro completely, together with a toolbar to select the right component.

Method 2. Fake threads: non-helical
In many cases we don't need real threads, we just need a visual indication that the threads will be there.

We can create a fake thread by using a non-helical path, for example by revolving a sawtooth profile, or by stacking discs with tapered edges. This fake thread is hard to tell apart from the real helical one by simple inspection. This method is good for visualizing a thread-like object, but it is not useful if we need to 3D-print an actual thread.



Revolving sawtooth profile

 * 1) Click on.
 * 2) Click on . Select.
 * 3) Draw a closed sketch with the required inner diameter, outer diameter around , pitch , number of teeth , and total height.
 * 4) Select the sketch, then click on . Select, and press.



Stacking discs

 * 1) Repeat the first two steps from the previous section.
 * 2) Draw a closed sketch with the required inner diameter, outer diameter, and pitch, but draw only a single tooth of the sawtooth.
 * 3) Select the sketch, then click on . Select, and press.
 * 4) Select the revolution, then click on . Select . For a fake thread with a pitch of, set the  to , and  to , then press.
 * 5) You can add more discs by increasing the value of  in the linear pattern, and by raising the, which is the total length of the fake thread.

The and  are related. If the length is too large, but the number of occurrences is not high enough, you will have disconnected discs, and the Body computation will fail, as the resulting object must always be a single contiguous solid. If you wish, you may add a with a diameter equal to the inner diameter of the discs, and as high as the total thread height. This will join all discs into a single solid, thus guaranteeing that there will not be disconnected discs.



General
Draw the profile of the thread, and then sweep it along a helical path.


 * 1) Click on  to create a . Give it the appropriate values for ,  , and.
 * 2) Click on.
 * 3) Click on . Select.
 * 4) Draw a closed sketch with the required profile for the thread teeth, normally a triangular shape.
 * 5) Select the sketch, then click on . In, click on , and choose the helix object previously created. Then change  to  so that the profile sweeps the path without twisting; then press.
 * 6) When the dialog asks for a reference, choose.
 * 7) The helical coil is created, but there is no central body or shaft.
 * 8) Click on  with the appropriate   and   to touch the rest of the helical thread and automatically fuse to it.
 * 9) Additional boolean operations are needed to shape up the abrupt ends of the coil. For example, you can use additive features to provide a hexagonal head to the screw, and subtractive features to remove the excess material from the tip of the screw.

This process can also be done with the tools of the Part Workbench.
 * 1) In this case, you don't need a PartDesign Body, just create the sketch from the Sketcher Workbench with, and choose the global XZ plane.
 * 2) Then use.
 * 3) Select the appropriate sketch from  and click the arrow to pass it to.
 * 4) Click, and choose all edges of the existing helix in the 3D view. Click.
 * 5) Make sure to tick  and .  is the key to be able to perform Part Boolean operations with the resulting coil.
 * 6) Click  to exit the dialog and create the coil.

Now you can proceed to add or other shapes to do  and.



Tips for success





 * Tip 1. The radius of the helix does not matter, unless the helix is tapered. All that matters is the pitch and the height of the helix. This means that you can use a generic helix to generate a number of threads with equal pitch. What determines the position of the resulting coil is the position of the profile sketch.


 * Tip 2. Keep it short, that is, with a low number of turns. Long threads tend to fail in boolean operations. If you need to add many turns, consider creating an initial short thread, and then using a to duplicate the same pattern several times.


 * Tip 3. For 3D visualization and 3D printing it may be okay to leave the cylinder and the thread unfused, that is, with intersections between the two solids.

Pros and cons

 * Edit_OK.svg very natural way of defining thread profile.
 * Edit_OK.svg easy to understand.
 * Edit_OK.svg no problems with mesh generation, unlike method 4.


 * Edit_Cancel.svg due to invalidity of self-intersecting sweeps, it is next to impossible to generate a gapless thread, that is, with no cylindrical faces at the outer or inner sides of the thread.
 * Edit_Cancel.svg boolean operations are required to obtain meaningful results; these take long time and fail often.
 * Edit_Cancel.svg threads with high number of turns are problematic.

General
The idea is to sweep a horizontal cross-section of the thread along a helix. The main problem here is figuring out the profile to use to obtain such thread.



If one uses a circle as a horizontal profile (the circle has to be placed off the origin, that offset defines the depth of the thread), the thread profile will be sinusoidal.

To obtain a standard sawtooth profile, a pair of mirrored archimedean spirals need to be fused into a wire. The resulting figure is a heart shape, which becomes barely distinguishable from a circle when the depth of the thread is small compared to its diameter, this is why a "thick" thread is shown on the picture above.

Generating the profile
Figuring out the horizontal profile to obtain a certain vertical profile is not easy. For simple cases like triangular or trapezoidal it can be constructed manually. Alternatively, it can be constructed by creating a short thread with method 3, and getting a slice of it by doing a Part Common between a horizontal plane face and the thread.

Profile for triangular thread

 * 1) First create an Archimedian spiral in the XY plane.
 * 2) Set the number of turns to 0.5.
 * 3) Set the radius to the inner radius of the thread, the outer radius will be this plus the depth of the cut.
 * 4) Set the growth to double the depth of cut of the thread.
 * 5) Part Mirror the spiral against the XY plane
 * 6) Part Union the spiral and the mirror to obtain a closed wire, shaped like a heart.

Profile for arbitrary cross-section



 * 1) Make a vertical cut profile. Make sure that the height of the sketch matches the pitch of the thread you need.
 * 2) Make a helix1 with height identical to the pitch and the pitch identical to the thread pitch, and a helix radius of 0.42*nominal diameter of the thread.
 * 3) Sweep the cut profile along the helix1. Set  and.
 * 4) Make a circle with nominal radius of the thread in the XY plane.
 * 5) Make a face from the circle. This can be done with  or, then set  to.
 * 6) Cut the face with the sweep profile.
 * 7) Make a  from the cut.
 * 8) Use  on the clone in order to get a wire. This wire is the horizontal profile needed for this method.
 * 9) Make a helix with radius of nominal radius of the thread and a pitch of the thread and the height of the needed thread.
 * 10) Sweep the wire along the helix.  Set  and.
 * 11) You are done.

The step-by-step guide was taken from this forum post by Ulrich1a ("Creating a thread: Unexpected results"), slightly modified.

The steps are also shown in action on this video by Gaurav Prabhudesai ("FreeCAD : How to make threads").

Pros and cons

 * Edit_OK.svg a ready-to-use thread-on-a-rod solid shape is created by the sweep directly.
 * Edit_OK.svg fewer or even no boolean operations are required, so generation speed is very high compared to Method 3.
 * Edit_OK.svg thread ends are nicely cut straight away
 * Edit_OK.svg long threads are not a problem, unless a boolean operation is needed. Otherwise, it is not going to be much better than Method 3.
 * Edit_OK.svg threads without a gap are not a problem.


 * Edit_Cancel.svg defining thread profile is complicated.
 * Edit_Cancel.svg using the standard mesher with a thread created in this way generates ugly meshes, which can lead to problems. Other meshers are better, for example, Mefisto seems to give the best results.
 * Edit_Cancel.svg large memory footprint according to Gathering thread modeling techniques.

Idea
Helical splines will extrude coaxial faces that are able to be lofted, while FreeCAD's parametric helix won't.   It takes two helical splines to define a thread. Those two can be scaled from a library spline, then located and extruded appropriately to get the form right.

FreeCAD's parametric helixes aren't truly helical, but helical b-splines aren't difficult to lay out. One manual method is to array dodecagons (12-sided polygons) with 5mm radius/10mm diameter at 1/12mm (0.08333.mm) z intervals and trace splines from vertex to vertex in ascending and rotating order, and to consider doing it once with, say, 10 turns, so that that spline can be re-used as a library file for import and reuse. It's convenient to use 10mm diameter/1mm pitch for ease of scaling. If you are doing it manually, drawing a Dwire and then converting it to a b-spline is easier than drawing a spline. Dwires don't have curvature computed while being drawn, so they follow the cursor and snap more obediently.

Once the splines are scaled to the right size and located so that the loft will have the right included angle between the thread flanks, they're extruded along their axis, a pitch length's worth for the inner spline, the outer pitch/8.



ISO and other threads have relieved, ie flat, inner and outer edges rather than sharp, which suits FreeCAD users with this method, because we can loft to the helical face at the nominal fastener size, while an inner face can't be lofted to an outer edge spline because a face is a closed profile, a spline is open. ISO standard says the nominal size of external threads have a face width pitch/8. The picture shows how the geometry is arranged, and the helical faces that result. Then, loft between the faces, and then a cylinder that gives the inner helical face, which ISO puts at pitch/4 width, is added to the threads.



This method produces reliable solids that boolean properly. While it doesn't produce "parametric" screw threads in standard sizes in the sense of having simple access to form by fastener size, it's an easy way of producing an accurate library for reuse, and models of specialised forms like ACME, or Archimedian screws, are also uncomplicated as one-offs.