Poor man's openscad screw library

by aubenc, published

Poor man's openscad screw library by aubenc May 25, 2011

Featured Thing!


Due to some bugs in the initial version, a revision of the OpenSCAD library has been uploaded, please use "polyScrewThread_r1.scad". Thanks a lot to mechadense for reporting the bugs!

This is my humble take on a screw library to be used in your OpenSCAD scripts.

If you are serious, please be, you'll better use thingiverse.com/thing:8793 syvwlch.

Anyway, I had this thing for months in the lost projects folder suffering from some serious issues, well some of them remain (it doesn't render) and once the dust has been shaken it compiles quite nice and printable things.

Instead of functions, this thing uses loops.
Instead of rotate polyhedrons, this thing draws the polyhedron in a new set of points.

Just a couple of comments to help using this thing:

- I've found that a resolution of something like 1.5mm (PI/2 is what I use the most) works very well for threads that will be used with nuts made with a resolution of 0.5mm.

- I've printed the threads with a very low infill (0.2) but for the nuts, setting up this value (I've used 0.45) helped a lot with the overhang issue.

More pics @ aubenc.imgur.com/screws_threads_an_other_polyhedron_games

Recent Comments

view all

Yes, the parameters are explained.... somewhere.........
Tip: take a look to the 3rd line of the text in the instructions tab ;-)

is there an explination of what each of your variables mean? or better yet, attach parameter input to stl output letting me screw (HA!) around with it myself?

Mmmmm... no, there's not. Sorry for that, this is just a very simple library to make basic shaped threads.
You may have better luck (?) with the library by syvwlch which is mentioned in the description...

More from Engineering

view more

Liked By

view all


Public Domain
Poor man's openscad screw library by aubenc is licensed under the Public Domain license.

Give a Shout Out

If you print this Thing and display it in public proudly give attribution by printing and displaying this tag. Print Thing Tag


Do not use "polyScrewThread.scad", in contains some bugs! Instead...

Drop "polyScrewThread_r1.scad" into your OpenSCAD library folder or the folder where you are writing your OpenSCAD script.

Use polytests.scad (*) as a user's guide, refference, whatever.

(* - Depending on how old/new is your OpenSCAD you may need to change the line where the library is included, replace "include" by "use")

Because this thing is made without much science, you'll need to tweak a little bit, sorry...

First print a nut (high res, see comments above), tweak the infill and/or the degrees for the shape of the thread.

Once your nut prints fine, print a short threaded rod, try to change the resolution of the thread, infill,... use your imagination.

I printed the provided examples and they all work fine without any cleaning, that's the reason why they look so ugly in the pictures.

Design bolted things.

Print bolted things.

Bolt things.

Keep on bolting!


You must be logged in to post a comment.

GreenFox on Jun 30, 2014 said:

is there an explination of what each of your variables mean? or better yet, attach parameter input to stl output letting me screw (HA!) around with it myself?

aubenc on Jul 1, 2014 said:

Yes, the parameters are explained.... somewhere.........
Tip: take a look to the 3rd line of the text in the instructions tab ;-)

trikko on Jun 5, 2014 said:

Is there any way to make a conical screw? Something I can use to drill sand.

aubenc on Jun 5, 2014 said:

Mmmmm... no, there's not. Sorry for that, this is just a very simple library to make basic shaped threads.
You may have better luck (?) with the library by syvwlch which is mentioned in the description...

Potti5 on May 20, 2014 said:

how i can make 5/8"-11 hex screw? im not understand :(

aubenc on May 20, 2014 said:

Unfortunately you can't. Sorry for that.
You could do it by writing your own OpenSCAD script and using this thing as a library to help (?) with the threads. It is not a straight forward process wich is roughly described down in the comments.

Marwijn on Mar 31, 2014 said:

Thanx, I used it to create a small M3 bolt. Didn't run very smooth but the thread is just enough to get a metal nut over it.

aubenc on Apr 1, 2014 said:

Thanks to you for using it!
M3 is quite a challenging size to be printed. Did you just use the OpenSCAD "as is" or as a library? I mean, this script is not meant to produce ISO thread profiles (there's a turnaround somewhere down in the comments).
Nice small M3 screw, thanks for uploading the pic!!

mechadense on Jan 28, 2013 said:

I tried to create a standard photography equipment screw (1/4'' UNC).
By comparing the output to an actual screw I found that I have to input 30° to actually get 60° flanks opening angles.
But anything below 31° crashes OpenSCAD. Wonder what's happening here.
Here are the parameters I tried:
hex_screw(25.4*1/4,25.4/20, 30 ,6,0.5,2,25.4*7/16-0.15,4,3, -1);

aubenc on Jan 29, 2013 said:

There is indeed a (few) bug(s) in the original library, please use the "_r1" version, it works fine for me with your code.

Together with the bug fix, I have changed the way the head of the screw is done, check it out! (it is still possible to use the "old shape" using "hex_screw_0(... )" module).

Nice screw btw!!

I have done a full cycle test: it renders, it compiles, it slices, it prints and it fits the screw mount in my cameras without issues! I can wait to see it uploaded so I will be able to click the "made one" and post the photo.

Thanks again

aubenc on Jan 28, 2013 said:

hmmmmm... curious... I tried myself and got the same results, aaaargh!!
I'll take a look see what happens here.
Sorry for the trouble and thank you very much to report this!

huemorgan on Sep 7, 2012 said:

mayb i'm not getting somthing - the model does not compile

do you have a example parameters for how to call the functions.

just to get it started?

aubenc on Sep 8, 2012 said:

polytests.scad contains some examples. It's true that this thing doesn't render (or not nicely) and may take some time to compile but when you get used to it, it works quite good :-D

goatzilla on Sep 5, 2012 said:

Neat, I'll give that a try. I haven't had a chance to try the 0.75 pitch (that might be too aggressive), but I did print a 1.27mm pitch from your libarry with SLS, and that part actually turned out great.

dan_kirshner on Sep 3, 2012 said:

You might want to take a look at these modules for creating ISO-standard threads: http://dkprojects.net/openscad...

If they work well enough perhaps they could be combined with your modules.

goatzilla on Sep 5, 2012 said:

I couldn't seem to get your english_thread_tap to work...

goatzilla on Aug 1, 2012 said:

The examples would be more meaningful if you modeled standard threads per specifications... like an ISO metric thread...

aubenc on Aug 3, 2012 said:

Right, however... the profile of the trheads I'm using is not meeting the ISO standard and to do it properly, I should have add even more parameters :-(

Most of the parameters of this thing are there to make the threads printable using almost any printer (like my very low res bot1334) not to make bolts and nuts that meet any standards.

I'll try to give a little bit more of light to the parameters bellow but it's a long answer so feel free to skip
it ;-)

... long answer, sorry...

I did this thing to be able to print using a CupcakeCNC with a home made hot-end and the stock MK4 DC geared filament feeder, hard to get layer height under 0.35mm. Impossible to print a M3, M5 or even a working M8.

To print something close to the standards (met
ric or, I guess that it should also work with imperial) you just need to care about few of the parameters, for example, there are 2 ISO sizes for a M8, M8x1.0 and M8x1.25, just set the diameter parameter to 8 (*) and the (I think I call it) step to 1 or 1.25.

(*) You'll need to let a gap between nu
t and bolt, I use to set the bolt to the std size, in this case 8, and add the gap to the nut, i.e. 8.5. You are free to do the opposite, i.e. bolt:7.5
amp; nut:8 or distribute the gap evenly or not between both, i.e bolt:7.7
amp; nut 8.2.

For the hex head of the bolts or dimensions for the nut... well, again is only a cople of parameters, distance between flats, usually 13mm (for the M8 example) and thickness (I think I call it height) which if I'm not wrong, the std is something like 5.6.

Here I used the distance between flats (i
nstead of the diameter or distance between opposite edges) just because is the size used for the tools. Be aware that it's too easy to break them when using tools.

... alternatives ...

At the time this thing was uploaded there was already another screw library closer (in shape) to the ISO std: th
ingiverse.com/thing:8793 syvwlch.

At the time I'm writting this answer there's a new thing that promises ISO standars (I have not checked myself so I cannot tell): http://www.thingiverse.com/thi... by TrevM

meirm on Jan 2, 2012 said:

I just printed it and I couldn't feet the nut and under preasure the bolt broke. :(

aubenc on Jan 2, 2012 said:

I'm sorry to hear that :(

This thing can indeed be a little bit tricky to print and may require "special tunning" of the settings or, another alternative is to use the scad and change the gap between nut and bolt.

I've not experience with PLA (which seems to be what you are using looking at your made things) but, for what I have read, PLA may make this thing even more difficult.

A high infill will make the bolt stronger but may reduce the gap. If they don't fit loose enough the screw/bolt may break too easily, so it's better to tweak scad parameters or print settings but it's too difficult to tell you what to change in the print profile (take a look at the photo with the red background above).

If you still like to try :) I suggest to take a look to
a href="http://www.thingiverse.com/thi..."
thing 9095
It looks like many people have had better luck there ;)

BTW, thanks a lot for trying and let us know how it went!

caru on Jun 2, 2011 said:

i love this, thank you!

aubenc on Jun 2, 2011 said:

Glad you like it! Thanks

caru on Jun 2, 2011 said:

This is especially good for building electro-magnetic motors, as they don't disturb the fields... above hundreds of other practical or decorative things of course ;)

peter_ on May 26, 2011 said:

that looks like an amazing print, well done! :)

aubenc on May 26, 2011 said:

Thank you!

To be honest, if bot1334 did it, any other cupcake can do it. Believe it or not, mine is far to be fine tuned and we are soooo happy printing things :-D

syvwlch on May 26, 2011 said:

Nice! :-)

aubenc on May 26, 2011 said:


syvwlch on May 26, 2011 said:

Great minds and all that...