113 function cdc(s, n, m=0) = (m == 0) ? s * fd : s * fd / cos(180/n);
129 hd = is_undef(h[3]) ? cdc(hs) : cdc(hs, hg, 1);
152 0, -l/2, -l/2+hf/2, -l/2+hf, -l/2+hf+hb,
153 +l/2-nb-nf-no, +l/2-nf-no, +l/2-nf/2-no, +l/2-no, +l/2
160 translate([0, 0,
select_ci(az, a,
false)])
163 hfo = [0, 0, +l/2 - hf/2 +
eps*2];
164 hbo = [0, 0, +l/2 - hf - hb/2 +
eps*4];
165 nbo = [0, 0, -l/2 + nf + nb/2 + no -
eps*4];
166 nfo = [0, 0, -l/2 + nf/2 + no -
eps*2];
168 if ( is_undef(t) && is_undef(s) )
171 cylinder(d=bd, h=l, center=
true);
176 cylinder(d=hd, h=hf, center=
true, $fn=hg);
180 cylinder(d1=bd, d2=cdc(hs), h=hb, center=
true);
184 cylinder(d2=bd, d1=cdc(ns), h=nb, center=
true);
189 cylinder(d=nd, h=nf, center=
true, $fn=ng);
193 hull() for( v=[-1, 1], w=[-1, 1] )
194 translate([tx/2*v, ty/2*w, 0])
195 cylinder(d=bd, h=l, center=true);
197 hull() for( v=[-1, 1], w=[-1, 1] )
198 translate(hfo + [tx/2*v, ty/2*w, 0])
200 cylinder(d=hd, h=hf, center=true, $fn=hg);
202 hull() for( v=[-1, 1], w=[-1, 1] )
203 translate(hbo + [tx/2*v, ty/2*w, 0])
204 cylinder(d1=bd, d2=cdc(hs), h=hb, center=true);
207 ix = is_list(sx) ? sx : [0, sx];
208 iy = is_list(sy) ? sy : [0, sy];
209 iz = is_list(sz) ? sz : [0, sz];
211 hull() for( v=[-1, 1], w=[-1, 1], x=ix, y=iy, z=iz )
212 translate(nbo + [tx/2*v + x, ty/2*w + y, z])
213 cylinder(d2=bd, d1=cdc(ns), h=nb, center=true);
215 hull() for( v=[-1, 1], w=[-1, 1], x=ix, y=iy, z=iz )
216 translate(nfo + [tx/2*v + x, ty/2*w + y, z])
218 cylinder(d=nd, h=nf, center=true, $fn=ng);
314 tt = (td != 0 && tl > 0),
315 tb = (bd != 0 && bl > 0),
317 ml = (l - (tb ? bl : 0) - (tt ? tl : 0))
320 if (tb) [bl, [bd, 1]],
322 if (tt) [tl, [1, td]]
325 az = [ 0, -l/2, -l/2+tl, +l/2-bl, +l/2 ];
331 translate([0, 0,
select_ci(az, a,
false)])
341 rotate([0, 0, 360/c * i + r])
342 translate([b/2 + o, 0, 0])
eps
<decimal> Epsilon, small distance to deal with overlapping shapes.
function defined_e_or(v, i, d)
Return an element of an iterable when it exists or a default value otherwise.
function defined_eon_or(v, i, d)
Return the list element or scalar numeric value, if either is defined, otherwise the default value.
function select_ci(v, i, l=true)
Select specified element from list or return a default.
module screw_bore(d=1, l=1, h, n, t, s, f, a)
Flat and beveled-head fastener bore with nut, nut slot, and bore tolerance.
module screw_bore_tsf(d=1, l=1, t, a)
Gapped fastener bore with engagement cylinders for self-forming threads.