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 http://www.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:
More pics @ http://aubenc.imgur.com/screws_threads_an_other_polyhedron_games
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.
Keep on bolting!