1 // Copyright 2010 D1plo1d
3 // This library is dual licensed under the GPL 3.0 and the GNU Lesser General Public License as per http://creativecommons.org/licenses/LGPL/2.1/ .
7 module SKIPtestNutsAndBolts()
10 translate([0,15])nutHole(3, proj=2);
11 boltHole(3, length= 30, proj=2);
15 INCH = "inch"; //Not yet supported
17 //Based on: http://www.roymech.co.uk/Useful_Tables/Screws/Hex_Screws.htm
18 METRIC_NUT_AC_WIDTHS =
20 -1, //0 index is not used but reduces computation
58 METRIC_NUT_THICKNESS =
60 -1, //0 index is not used but reduces computation
99 COURSE_METRIC_BOLT_MAJOR_THREAD_DIAMETERS =
100 [//based on max values
101 -1, //0 index is not used but reduces computation
140 module nutHole(size, units=MM, tolerance = +0.0001, proj = -1)
142 //takes a metric screw/nut size and looksup nut dimensions
143 radius = METRIC_NUT_AC_WIDTHS[size]/2+tolerance;
144 height = METRIC_NUT_THICKNESS[size]+tolerance;
147 cylinder(r= radius, h=height, $fn = 6, center=[0,0]);
151 circle(r= radius, $fn = 6);
155 translate([-radius/2, 0])
156 square([radius*2, height]);
160 module boltHole(size, units=MM, length, tolerance = +0.0001, proj = -1)
162 radius = COURSE_METRIC_BOLT_MAJOR_THREAD_DIAMETERS[size]/2+tolerance;
163 //TODO: proper screw cap values
164 capHeight = METRIC_NUT_THICKNESS[size]+tolerance; //METRIC_BOLT_CAP_HEIGHTS[size]+tolerance;
165 capRadius = METRIC_NUT_AC_WIDTHS[size]/2+tolerance; //METRIC_BOLT_CAP_RADIUS[size]+tolerance;
169 translate([0, 0, -capHeight])
170 cylinder(r= capRadius, h=capHeight);
171 cylinder(r = radius, h = length);
179 translate([-capRadius/2, -capHeight])
180 square([capRadius*2, capHeight]);
181 square([radius*2, length]);