This is just a remix of Trevor Moseley's "OpenSCAD ISO metric thread library / functions (updated)", found here: http://www.thingiverse.com/thing:311031.I just tweaked it to work on Ultimaker 2 and Cura, as Trevor's version seemed to create spaces between model segments and the results would not print correctly. Also, Trevor's version did not seem to match actual steel nuts and bolts.I calibrated my testing against an M6 nut and several M6 bolts, plus M6 threaded rod. I did not test other sizes. YMMV.All credit goes to Trevor for his excellent library. It may or may not be exactly metric standard but it (now) is compatible with steel threading and the only OpenSCAD metric library that actually works for me. :)I have also kept the same licence as it is almost all his code anyway.(Nuts and bolt ThreadTest example, with an extra cylinder for a smooth shaft provided courtesy of DonMilne (http://umforum.ultimaker.com/index.php?/user/33340-donmilne/).
Technical
- OpenSCAD (2015.03 works, earlier versions might too but are untested.)
- A steel nut and bolt for testing (Optional). :)
- Optimized for Ulitmaker 2 and Cura (2015.02.1), but should also work for other printers and slicers.
- Printed on Cura's Normal quick profile. (0.1mm layers, 0.8mm shells, 0.6mm top/bottom, 20% infill, <50mm/s effectively.)
Nice but Black is not the better way to see, and code is necessary for my use.
Huy Lê Quốc
almost 6 years
Nice library, great thanks JustKrys.
Anton Belov
over 7 years
ISOThreadUM2.scad
Removed error in thread_in_ring function (thinknes dont work)
module thread_in_ring(dia,hi,thk)
{
difference()
{
cylinder(r = (dia/2)+thk,h = hi);
translate([0,0,-1]) cylinder(r = (dia/2)+0.1, h = hi+thk);
}
}
And add champfer on thread equal 20% of pitch.
module thread_in_pitch(dia,hi,p,thr=$fn)
// make an inside thread (as used on a nut)
// dia = diameter, 6=M6 etc
// hi = height, 10=make a 10mm long thread
// p=pitch
// thr = thread quality, 10=make a thread with 10 segments per turn
{
h=(cos(30)*p)/8;
Rmin=(dia/2)-(5*h); // as wiki Dmin
s=360/thr; // length of segment in degrees
t1=(hi-p)/p; // number of full turns
r=t1%1.0; // length remaining (not full turn)
t=t1-r; // integer number of turns
n=r/(p/thr); // number of segments for remainder
difference(){
for(tn=[0:t-1])
translate([0,0,tn*p]) th_in_turn(dia,p,thr);
for(sg=[0:n])
th_in_pt(Rmin+0.1,p,s,sg+(t*thr),thr,h,p/thr);
cylinder ( d=dia-p*0.8, h=hi);
} // make champfer on thread = 0.8*thread pitch // Anton Belov 18.05.2017
}
and make champfer on nut bottom
difference()
{
union() {
thread_in_ring(30,6,3); // make a ring to enclose an M8 x 10 ISO thread with thickness 2 mm
thread_in_pitch(30,6,1.5); // make an M8 x 10 thread with 1mm pitch
}
cylinder ( d1=33, d2=28.5,h=3); // make champfer on nut
}
JustKrys
over 8 years
Small note: For ABS (and maybe PLA too), scale nuts up by about 2% else they are quite tight.