Metric Screw Thread Library

by marcaxi, published

Metric Screw Thread Library by marcaxi Sep 28, 2012
0 Share
Download This Thing! Customize Order This Printed Tools & Utilities

Thing Info

25926Views 6741Downloads Found in Engineering
Report Thing


A library for creating parameterized screw threads.


Use this library to generate any size of metric screw threads.

Only use module "thread(P,D,h,step)" using the parameters:
P - screw thread pitch
D - screw thread major diameter
h - screw thread height
step - step size in degree

ISO specification from:

More from Engineering

view more

Thing Info

25926Views 6741Downloads Found in Engineering
Report Thing

Liked By

View All

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

All Apps

This App connects Thingiverse with Makeprintable, a cloud-based mesh repair service that analyzes, validates and repairs most common mesh errors that can occur when preparing a 3D design file for p...

App Info Launch App

Kiri:Moto is an integrated cloud-based slicer and tool-path generator for 3D Printing, CAM / CNC and Laser cutting. *** 3D printing mode provides model slicing and GCode output using built-in...

App Info Launch App
KiriMoto Thing App

With 3D Slash, you can edit 3d models like a stonecutter. A unique interface: as fun as a building game! The perfect tool for non-designers and children to create in 3D.

App Info Launch App
Aug 16, 2015 - Modified Aug 16, 2015

Really great library. Noted a small issue: In the v2 script, the parameters are thread(P,D,step,rotations), but the documentation in the beginning is not updated accordingly.

Does anyone else see your parts screw together at an angle?

I'm printing lightsaber parts that screw together. So I'll have a tube of about 90mm in length and about 30mm in diameter with screw threads on the outside that screws into another tube about 90mm long but 40mm in diameter with a matching nut on the inside. When I screw them together the two tubes are clearly not straight. The screw and nut are about 20mm in length and have endstops... so everything is tight but the two tubes are clearly at an angle.

Any thoughts?

It gets stuck with this message in the Console Dialog box :'(

"Rendering Polygon Mesh using CGAL..."


Not sure why.... But my OpenSCAD wont let me render and Export the file into STL. :/

Could someone help me out and export it? xD lol THanks a bunch!

what's the smaller printable screw or female socket? i mean printable with the Makerbot at high resolution?

Great thing! Would you know how to modify the code so that the same specs could be entered, but it would make a female version of the threads?

Mar 1, 2015 - Modified Mar 1, 2015
overflo - in reply to Busterhax

just difference() the generated threads with the object you need the threads in.
also you should scale([0.92,0.92,1] the threads on X and Y axis by a little margin so the two parts will fit.
0.92 scale factor works for my printer at a high resolution, you need so tweak there to make it fit yours..

a code could look like this:

module closing_lid()

module closing_lid_resized()
scale([0.92,0.92,1]) thread(4,28,20,3);

// show difference




Hey, Maximilian.

First, thank you so much for this script! It's helped me so much, not only with printing non-standard threads, but also learning OpenSCAD.

I have a slight modification that I think would be useful to others as well and wonder if you'd prefer me to remix it or just share my change and maybe you could update yours? It's such a simple modification that it doesn't seem like it should be an entire remix. It simply allows a person to enter an additional parameter to "thread" to specify a number of rotations:

p, li { white-space: pre-wrap; }

module thread(P,D,h,step,rotations) {

hey, good idea,
I just added "screwthread_v2.scad"
with your proposed additional parameter

This is exactly what I'm looking for, but I'm new to openSCAD. I was able to generate the screw using the Compile and Render command, and I was looking to export it to something I could import into Sketchup so I could integrate it with my project. I tried Export as DXF... but came up with the error "Current top level object is not a 2d object." Any instruction you can give me on how to accomplish what I'm trying to here?

Export to "stl".

Download the STL import plugin from Google Extension Warehouse and Import it.


This is wat I am searching for.
If I want to make a screwable lid by this,

I think I need to:
A:design a thread on a bottle and print,
B:Boolean difference the same from the lid and print

Will that fit, or do I need to scale either of the two ?


Hi, I can not use the file screwthread.scad because I get an error
WARNING: hull() is not implemented yet for 3D objects!

What can I do?

My version of OpenSCAD is 2011.06 under Windows.
Regards, Icare

Hi! I am quite new to this and using AutoCAD2012. My method to extract the screw from the .stl format to .dxf format is by using the CAD forum convertor - with this you have one specific size of the thread. How are you choosing the specifics for this screw? If someone could please help me with this it would be greatly appreciated? :)

Thank you in advance!

If you want to create different sizes you need to use the file "screwthread.scad" with OpenScad (http://www.openscad.org/)http://www.openscad.org/), and change the parameters in the file. OpenScad then generates the new stl file for you.

Hi thats so cool i tried an Standard M12 (for my drawing to extract it for an inner thread) but i just did get an "full" cylinder any hint for me ?

its working for me with "thread(1.75,12.0,10,20);" using openscad version 2012.05.12

what version are you using and/or what parameters have you tested?

My bad i used an outdated scad version ,.. I did Test 1.75 which is the pitch , i used 12 as well ,The screw had 9,85 by numbers and i did not get the step size in degrees ? I thought 360 degrees will be i turn ;)-
Now i have to find a way how to substract it from my stl file ,.. thank you so much