Guillaume Matheron

Data scientist, PhD in computer science

Procedural threads in Blender with geometry nodes


I love designing functional models for 3D printing with Blender. I know it’s not a common choice and CAD software is usually preferred, and I have tested many but none has offered me the flexibility and speed of Blender for my projects.

One issue that I always had was generating screws, bolts and threads. Of course there are plugins for generating screws in Blender, but not being able to adjust the parameters afterwards can be an issue, especially with 3D printing where some adjustments are usually required to adjust tolerances.

I couldn’t find any good examples of threads generated with geometry nodes, so I made my own following the ISO metric screw thread specifications.

The implementation is straightforward, the most complicated part being the profile generation. For that, a grid is generated, then points are moved around selectively to form the extruded tooth shape.

This geometry is then spun into a spiral using similar coordinate manipulations (I found the spiral node hard to use because of twist, I assume some implicit transformations are performed to center the extruded profile).

During this step, some care is taken to taper the ends of the thread, to allow for easier engagement of the screw.

Then the ends are cut off, not using a boolean modifier which would be slow (and at this stage our geometry is not a manifold) but by simply clamping the z coordinates of the points. The end caps are added at this stage.

As a cherry on top, we can now remove duplicates (this will weld the end caps to the thread), and identify and delete non-manifold faces and edges (in case the thread length is not a multiple of the pitch, some extra faces may b e collapsed on top of each other with no associated volume).

Assuming the merge distance is reasonable, this will result in a manifold (waterproof) and clean mesh, which can then be used (for instance) to cut an internal thread using a boolean modifier !

This whole node tree is very fast, allowing for real-time adjustment of all parameters using mouse dragging.

This version already supports right-hand and left-hand threads, and comes with standard ISO threads from M2 to M10 (as well as custom threads). The next step would be to add screw caps, and maybe some kind of “reverse” tapering when using the output to cut out an internal thread using a boolean modifier.

The geometry node can be appended directly from the following file which is in the public domain (CC0), if there is interest I may clean it up further or provide a plugin.

Alternatives

This reddit thread has a similar project, but I was unable to open their file with the latest version of blender (4.1.1 at the time), with many nodes being marked “red”, which I assume means that they are not implemented anymore.

,

Leave a Reply

Your email address will not be published. Required fields are marked *