ChiralSym's Custom Helical Thread Generator (2.8.0)

Hi Everyone,

I’ve been working on a helical-thread generator in Grasshopper, as a learning exercise.

Intro:
I wanted a thread-generator for 3d-printing custom threads, and this is what I came up with. It allows you to input a custom thread-profile and the number of thread-starts. It then generates internal and external thread surfaces based on a thread-tolerance.

Brief Description:

Requirements:
You need to install Zebra, which is a bunch of Grasshopper components. It’s free.

Inputs:
(1) Two points representing the start and end of the thread-axis.
(2) A curve that represents half of a thread profile. If the thread-profile were a sine-curve, this would be “half wavelength.” The other half is generated by translating and mirroring. The start-point of the thread profile will set the pitch-radius of the thread.
(3) Number of thread-starts.
(4) A thread tolerance. The external-threads (bolt) will be smaller by the thread-tolerance (offset surface). The internal-threads (nut) will be larger by the thread-tolerance (offset surface). That means there will be twice the thread tolerance between the internal and external threads.
(5) An angular resolution. This is the sampling-resolution used to generate the thread-helix.

Outputs:
(1) A “thread-cutter.” This is a “thin” helix-like solid (closed polysurface). The thickness of the thread-cutter is twice the thread tolerance. So if we take a cylinder, and Boolean-subtract the thread-cutter, then we get both external and internal threads with the desired thread-tolerance.
(2) External threads (bolt) without tolerance. I call this the “idealized thread.”
(3) The thread-profile, but aligned and positioned for a Sweep2 along the thread helix.

Details:
I think the internal calculations are mostly straightforward. We generate a helix with pitch and radius, and then Sweep2 the thread-profile along the helix. Both external and internal threads are generated, trimmed down to the correct length, and then output as a “thread cutter.” There are some extra bits, like aligning and positioning the thread-profile, getting local xyz-axes correct, etc.

The script is a little bit slow; the examples take anywhere from 5 seconds to 10 seconds to compute. Almost all of the time (90%) is spent in Sweep2, Offset Surface, and then Boolean operations. This can probably be sped up by choosing a coarser angular-tolerance for generating the helix.

Help:
If more detailed instructions would be helpful, then just let me know.
If you find any bugs, or if you have suggestions, please point them out.

I’m only working on this project informally (for my own use), so I may not fix all bugs, or impliment all suggestions, depending.

If you find this useful, then give a thanks! My goal is to learn Grasshopper and build tools that are useful for others.

License:
This project is released under an Open MIT License. See LICENSE.TXT.

Sincerely,
–Anthony K. Yan (“ChiralSym”)
(2023-01-29)

ChiralSym Thread Generator (2.8.1) (Rhino3d,Grasshopper).zip (17.3 MB)



I got your files OK but the GH file showed this:

I tried Google but could not find any mention of SurfaceTrails2. Is this something you developed for your self? Or is it some sort of proprietary Microsoft product?

That’s odd because I tried Google and found these pages (and more) at the top of their results:

https://www.google.com/search?q=SurfaceTrails2

Oh Sorry! I forgot to mention that you need to install Zebra.
Zebra is a bunch of Grasshopper components, and includes BrepExplode.

You can find Zebra here (free):

I updated the original post and the ReadMe.txt.

Let me know if you continue to have problems.

It’s hard for me to imagine why “a live multi agent behavior system” is needed for helical threads? Is it only for “BrepExplode”? Is that substantially different from Deconstruct Brep? Or whatever equivalent might be found in the Rhino/GH API?

Yeah, I just needed BrepExplode. I will look at deconstruct brep, which is probably better. As a noob, I had trouble finding the component I was looking for.

Even if it’s only the same, it’s better than requiring a plugin for just that. Reminds me of a few times on this forum where the only reason an extensive plugin was required was for the “x+1” function. :man_facepalming:

Many thanks! That was very helpful. I swapped out BrepExplode and put in DeconstructBrep instead.

It’s working fine, and I updated the files and README.txt.

I think I’m not allowed to edit my original post anymore? If I were able, I would edit the post to now be:


Hi Everyone,

I’ve been working on a helical-thread generator in Grasshopper, as a learning exercise.

Intro:
I wanted a thread-generator for 3d-printing custom threads, and this is what I came up with. It allows you to input a custom thread-profile and the number of thread-starts. It then generates internal and external thread surfaces based on a thread-tolerance.

Brief Description:

Inputs:
(1) Two points representing the start and end of the thread-axis.
(2) A curve that represents half of a thread profile. If the thread-profile were a sine-curve, this would be “half wavelength.” The other half is generated by translating and mirroring. The start-point of the thread profile will set the pitch-radius of the thread.
(3) Number of thread-starts.
(4) A thread tolerance. The external-threads (bolt) will be smaller by the thread-tolerance (offset surface). The internal-threads (nut) will be larger by the thread-tolerance (offset surface). That means there will be twice the thread tolerance between the internal and external threads.
(5) An angular resolution. This is the sampling-resolution used to generate the thread-helix.

Outputs:
(1) A “thread-cutter.” This is a “thin” helix-like solid (closed polysurface). The thickness of the thread-cutter is twice the thread tolerance. So if we take a cylinder, and Boolean-subtract the thread-cutter, then we get both external and internal threads with the desired thread-tolerance.
(2) External threads (bolt) without tolerance. I call this the “idealized thread.”
(3) The thread-profile, but aligned and positioned for a Sweep2 along the thread helix.

Details:
I think the internal calculations are mostly straightforward. We generate a helix with pitch and radius, and then Sweep2 the thread-profile along the helix. Both external and internal threads are generated, trimmed down to the correct length, and then output as a “thread cutter.” There are some extra bits, like aligning and positioning the thread-profile, getting local xyz-axes correct, etc.

The script is a little bit slow; the examples take anywhere from 5 seconds to 10 seconds to compute. Almost all of the time is spent in Sweep2, Offset Surface, and then Boolean operations. This can probably be sped up by choosing a coarser angular-tolerance for generating the helix.

Help:
If more detailed instructions would be helpful, then just let me know.
If you find any bugs, or if you have suggestions, please point them out.

I’m only working on this project informally (for my own use), so I may not fix all bugs, or impliment all suggestions, depending.

If you find this useful, then give a thanks! My goal is to learn Grasshopper and build tools that are useful for others.

License:
This project is released under an Open MIT License. See LICENSE.TXT.

Sincerely,
–Anthony K. Yan (“ChiralSym”)
(2023-01-29)

ChiralSym Thread Generator (2.8.2) (Rhino3d,Grasshopper).zip (17.3 MB)



wow, looks like what I need for some 3d models i need to make for printing. I am a noob with grasshopper - any chance a step by step tutorial? great stuff tahnks

There is a key question for 3D printed threaded parts: do they have to mate with other 3D printed parts, or with commercially made machined parts. In the first case it’s quite simple to make both male & female threads. But in the second case it gets lots more complicated.

Hi Kencfii, Birk !

Three quick points:

(1) I’ll try to come up with a tutorial on how to use the thread-generator. I’ll have to get back to you, depending on how busy I am.

(2) If your 3d-printed part needs to mate with a standard thread, then you should go look for a CAD file for the standard part.

For example, McMaster.com has STEP files for almost all of the bolts, nuts, pipes, pipe-fittings and adapters. You might need to click a little deeper into their online catalog, but they usually supply a STEP file for the part. There are also many other websites that also have STEP files for standard (threaded) parts, such as https://www.3dcontentcentral.com/ (which is run by CAD giant Dassault). On 3dcontentcentral, most of the CAD files are submitted by users, so if your design is critical, double check the geometry.

(3) I made a new thread with a new version of the thread generator. There is a quick-and-dirty video demonstrating the features, but it’s not really a tutorial. So hang on, and I’ll try to do a tutorial “soon”.

Hope that helps for now. If you have more questions, or even just ideas, let me know. I would like this to become useful for other maker enthusiasts.

Sincerely,
–Anthony Yan

This looks super-useful but it appears that Zebra is only for Windows. Does that mean that this generator will only run under Rhino and Grasshopper for Windows, not Mac?

If you read the complete thread, @Anthony_Yan has removed the dependency on Zebra.

Also a much newer version (5.4.0) here than the one posted in this thread:

I opened the newest version, and it does not have any plug-in dependencies.

-Kevin

Thanks. I’ll be downloading that newer version and using it. Appreciate the response.