3D part design with OpenScad # 9: adding a thread module

2 min read
By Bob
3D part design with OpenScad # 9: adding a thread module

Threads can be difficult to model, this method works pretty well but long threads or fine threads take a long time to render. I just wrote the code for this today so I will be adding more to it and trying to get it render faster, but it is a good exercise in making threads and the code is pretty short compared to some methods.

I started by setting up the customizer menu:

Then I set up a module to automate the different settings:

I will  make a way to modify the thread profile, for 3d printing it's probably not too critical but I want to make it as customizable as possible, this is good starting point anyway.

Now I will make some threads and see how it works:

click for a larger version

Rendering takes a long time but I think using a polygon or dxf file instead of a 7 sided circle will help speed things up a bit, also I need to set up the rotate and move parts of the module, luckily most of that is easy to copy, paste and change some names

By adding a couple of items I can convert from mm to inches and  also calculate the number of threads per inch:

Update> I got rid of the union command, used a square instead of circle for the linear extrude and now have the threads going in the right direction, my plan was to use the union to change the thread profile but it wasn't very useful and for some reason rendering works much better with the square:

this shortened up the code quite a bit and it still works the same but looks much better.