114 function cdc(s, n, m=0) = (m == 0) ? s * fd : s * fd / cos(180/n);
130 hd = is_undef(h[3]) ? cdc(hs) : cdc(hs, hg, 1);
153 0, -l/2, -l/2+hf/2, -l/2+hf, -l/2+hf+hb,
154 +l/2-nb-nf-no, +l/2-nf-no, +l/2-nf/2-no, +l/2-no, +l/2
157 translate([0, 0,
select_ci(az, a,
false)])
160 hfo = [0, 0, +l/2 - hf/2 +
eps*2];
161 hbo = [0, 0, +l/2 - hf - hb/2 +
eps*4];
162 nbo = [0, 0, -l/2 + nf + nb/2 + no -
eps*4];
163 nfo = [0, 0, -l/2 + nf/2 + no -
eps*2];
165 if ( is_undef(t) && is_undef(s) )
168 cylinder(d=bd, h=l, center=
true);
173 cylinder(d=hd, h=hf, center=
true, $fn=hg);
177 cylinder(d1=bd, d2=cdc(hs), h=hb, center=
true);
181 cylinder(d2=bd, d1=cdc(ns), h=nb, center=
true);
186 cylinder(d=nd, h=nf, center=
true, $fn=ng);
190 hull() for( v=[-1, 1], w=[-1, 1] )
191 translate([tx/2*v, ty/2*w, 0])
192 cylinder(d=bd, h=l, center=true);
194 hull() for( v=[-1, 1], w=[-1, 1] )
195 translate(hfo + [tx/2*v, ty/2*w, 0])
197 cylinder(d=hd, h=hf, center=true, $fn=hg);
199 hull() for( v=[-1, 1], w=[-1, 1] )
200 translate(hbo + [tx/2*v, ty/2*w, 0])
201 cylinder(d1=bd, d2=cdc(hs), h=hb, center=true);
204 ix = is_list(sx) ? sx : [0, sx];
205 iy = is_list(sy) ? sy : [0, sy];
206 iz = is_list(sz) ? sz : [0, sz];
208 hull() for( v=[-1, 1], w=[-1, 1], x=ix, y=iy, z=iz )
209 translate(nbo + [tx/2*v + x, ty/2*w + y, z])
210 cylinder(d2=bd, d1=cdc(ns), h=nb, center=true);
212 hull() for( v=[-1, 1], w=[-1, 1], x=ix, y=iy, z=iz )
213 translate(nfo + [tx/2*v + x, ty/2*w + y, z])
215 cylinder(d=nd, h=nf, center=true, $fn=ng);
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 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=1, a=0)
Flat and beveled-head screw bore with nut, nut slot, and bore tolerance.