62 [
"wth",
"Box wall thickness"],
63 [
"roww",
"Receptacle row width"],
64 [
"dlts",
"Device length tab-to-tab space"],
65 [
"boxd",
"Box internal depth"],
66 [
"evrm",
"Box & cover rounding mode: {0|1|2}"],
67 [
"evr",
"Box & cover rounding radius"],
68 [
"cdms",
"Cover uses device mount screws: {true|false}"],
69 [
"lefb",
"Box lid edge finish: {0|1|2|3|4}"],
70 [
"lefc",
"Cover lid edge finish: {0|1|2|3|4}"],
71 [
"dlogo",
"Detail logo on box rear: {true|false}"],
72 [
"drimb",
"Detail rim on box rear: {true|false}"],
73 [
"drimc",
"Detail rim on cover top: {true|false}"],
74 [
"fins",
"Post fins: [number, angle, width, length]"],
75 [
"ribs",
"Box ribs configuration: see project_box_rectangle()"],
76 [
"wmode",
"Box wall mode: see project_box_rectangle()"],
77 [
"wiab",
"Box wall instance additions: see project_box_rectangle()"],
78 [
"pmode",
"Box post mode (b7=1 required): see project_box_rectangle()"],
79 [
"piab",
"Box post instance additions: see project_box_rectangle()"],
80 [
"piac",
"Cover post instance additions: see project_box_rectangle()"],
81 [
"mpc2b",
"Mirror cover post additions in box: {true|false}"],
82 [
"mphda",
"Mirrored post hole diameter adjustment"],
83 [
"iscl",
"Input space: cord, switch, surge, etc"],
84 [
"oscl",
"Output space: wire-nuts, led, aux board, etc"],
85 [
"lscl",
"Left-side extra space"],
86 [
"rscl",
"Right-side extra space"],
87 [
"iwdo",
"Internal wall divisions on: {true|false}"],
88 [
"iwpd",
"Internal wall wire pass diameter"],
89 [
"iwps",
"Internal wall wire pass side: {+1|-1}"],
90 [
"pwco",
"Power cord connections offset: [x, z]"],
91 [
"pwcd",
"Power cord dimensions: {d|[w,h]}"],
92 [
"pwcs",
"Power cord clamp side: {0|1}"],
93 [
"pwct",
"Power cord clamp tab width"],
94 [
"pwcp",
"Power cord clamp pinch bar percentage: [h, w]"],
95 [
"pwsd",
"Power cord clamp screw diameter"],
96 [
"pwsh",
"Power cord clamp screw head spec: see screw_bore()"],
97 [
"pwsn",
"Power cord clamp screw nut spec: see screw_bore()"],
98 [
"mtab",
"Mount tab: [screw, brace, vrm, vr, wth, size]: see mount_screw_tab()"],
99 [
"mtabs",
"Mount tab instances: [[edge, zero, move], ...]"],
100 [
"mslot",
"Mount slot: [screw, cover, size, scale, wth]: see mount_screw_slot()"],
101 [
"mslots",
"Mount slot instances: [[move, rotate, align], ...]"]
140 [
"fins", [3, 270, 3, 3/4]],
142 [
"ribs", [0, 1.75] ],
169 [
"pwsn", [5.75, 2.5]],
171 [
"mtab", [4, 25, 4]],
174 [
"mslot", [4, [1, 1, 4]]],
185 power_strip_mount_doc =
187 [
"mss",
"Device mount screw separation"],
188 [
"rmsd",
"Mount screw hole diameter"],
189 [
"rmsh",
"Mount screw head height"],
190 [
"rshc",
"Mount screw head clearance"],
191 [
"rmth",
"Mount tab height"]
213 [
"mss",
length(3+9/32,
"in")],
214 [
"rmsd",
length( 1/8,
"in")],
215 [
"rmsh",
length( 3/32,
"in")],
216 [
"rshc",
length( 5/16,
"in")],
217 [
"rmth",
length( 1/16,
"in")]
221 power_strip_cover_doc =
223 [
"drpo",
"Receptacle offset"],
224 [
"rpd",
"Receptacle diameter"],
225 [
"rpfl",
"Receptacle flat-to-flat height"],
226 [
"rcsd",
"Cover center hole screw: [diameter, head-diameter, head-height, tolerance]"]
248 [
"drpo",
length(1+1/2,
"in")],
249 [
"rpd",
length(1+3/8,
"in")],
250 [
"rpfl",
length(1+5/32,
"in")],
252 [3.51, 7.50, 2.5, 1/2]]
342 (s == 1) ? [wth*1/3, [wth*2/3, [1, 1-bs]]]
343 : (s == 2) ? [wth*1/3, [wth*2/3, [
for (s=[0:1/32:1/8]) 1-pow(s,2)]]]
344 : (s == 3) ? [[wth*4/5, [1, 1+bs]], [wth*1/5, 1+bs]]
345 : (s == 4) ? [[wth*4/5, [
for (s=[0:1/32:1/8]) 1+pow(s,2)]], [wth*1/5, 1+pow(1/8,2)]]
360 function pczo ( d = 0 )
365 wth + (is_list(d) ?
second(d) : d) * 5/4 + zo;
380 translate([0, 0, pwct -
eps*2])
381 clamp_cg(size=pwcd, clamp=[1, pwzo, [pwsd,undef,pwsh,pwsn], pwct, pwcp], wth=0, mode=2);
385 module enclosure_box()
393 function piac_to_piab(pia)
401 a = i[1], ax = a[0], ay = a[1],
402 m = i[2], mx = m[0], my = m[1],
411 [is_undef(ax) ? undef : -ax, ay],
412 [is_undef(m) ? undef : -mx, my],
413 is_undef(r) ? undef : -r,
414 [h0[0], h0[1], h0[2], mphda, h0[4], h0[5], h0[6]],
447 translate([
limit(z,-1,+1)*iw/2 + m, il/2 + wth -
eps*2, 0])
453 translate([iw/2 + wth -
eps*2,
limit(z,-1,+1)*il/2 + m, 0])
459 translate([
limit(z,-1,+1)*iw/2 + m, -(il/2 + wth -
eps*2), 0])
465 translate([-(iw/2 + wth -
eps*2),
limit(z,-1,+1)*il/2 + m, 0])
473 module mount_slots(m)
505 module internal_wire_passage()
519 z = iw/2 - iwpd/2 - wth,
520 s = (iwps>0) ? 1 : -1,
521 o = (iwps>0) ? rscl : -lscl
526 nc = (oscl>0) ? cols : cols-1;
527 zc = -il/2 - wth + iscl;
534 for (i=[0:rows-1], j=[0 : nc])
535 translate([zr - i*sr * iwps, zc + j*sc, zo])
537 cylinder(d=iwpd, h = wth+
eps*8, center=true);
573 nc = (oscl>0) ? cols : cols-1,
574 zc = -il/2 - wth + iscl,
583 for (j=[0 : nc]) [0, zc + j*sc],
610 zr = -iw/2 + roww/2 + lscl,
613 zc = iscl + (dlts - mss)/2,
618 p1 = [u, u, u, u, -rmth -(cdms?0:rmsh)],
626 for (i=[0:rows-1], j=[0:cols-1])
627 [2, [0, -1], [zr + i*sr, zc + j*sc, 0], 180, h0, u, p1, f ],
628 for (i=[0:rows-1], j=[0:cols-1])
629 [2, [0, -1], [zr + i*sr, zc + j*sc + dc, 0], 000, h0, u, p1, f ],
635 if (
is_defined(piac) && mpc2b ) for (i=piac_to_piab(piac)) i
655 h = ih, size = [iw, il],
656 vrm = evrm, vr = evr,
673 internal_wire_passage();
676 translate([pwxo, -il/2-wth/2, pwzo]) rotate([90, 0, 0])
677 clamp_cg(size=pwcd, wth=wth*4, mode=0);
687 translate([0, logod - il/2, 0])
688 mirror([0, 1, 0]) rotate([0, 0, 180])
689 omdl_logo(d=logod, b=true, t=true, a=1, $fn=36);
699 translate([pwxo, -il/2-wth/2, pwzo]) rotate([90, 0, 0])
700 clamp_cg(size=pwcd, clamp=[pwcs, pwzo, [pwsd,undef,pwsh,pwsn], pwct, pwcp],
cone=pwcs+1, wth=wth, mode=1);
708 echo(str( parent_module(0),
"(): power cord hole size = ", pwcd ));
713 module enclosure_cover()
719 module cover_round_cut_duplex()
722 for (i=[0:rows-1], j=[0 : cols-1])
723 translate([zr - i*sr, zc + j*sc, zo])
732 translate([0, i*mss/2, 0])
746 translate([0, 0, rmsh/2])
751 l = zh + rmsh +
eps*4,
765 translate([0, i * drpo/2])
771 translate([0, j * (rpd/2 + rpfl)/2])
772 square([rpd, rpd/2], center=true);
779 module cover_stabilizers()
784 for (i=[0:rows-1], j=[0 : cols-1])
785 translate([zr - i*sr, zc + j*sc, zo])
792 translate([0, 0, zo])
796 rectangle([4, 1]*rshc, vr=rshc/4, vrm=0, center=
true);
799 translate([0, i * (mss+rshc)/2])
804 co = [0,1/3]*rshc * -i,
819 ih = max([ wth,
second(l()) ]);
827 is_undef(piac) ? undef
828 : [pmode, [for (i=piac) i]];
839 zr = iw/2 - roww/2 - lscl;
842 zc = -il/2 - wth + iscl + dlts/2;
862 h = ih, size = [iw, il],
863 vrm = evrm, vr = evr,
879 cover_round_cut_duplex();
889 module check_cm(name, mc, md)
898 "bad entry in map [", name,
"] = [", k,
",",
map_get_value(mc, k),
"]"
916 lscl + roww * rows + rscl;
924 iscl - wth * 3/2 + cols * (dlts + wth) + oscl;
947 translate([-(iw/2 + ps), 0, 0])
951 translate([+(iw/2 + ps), -(il/2 + ps), 0])
955 translate([+(iw/2 + ps), 0, 0])
module log_warn(m)
Output warning message to console.
origin3d
<point-3d> The origin point coordinate in 3-dimensional Euclidean space.
eps
<decimal> Epsilon, small distance to deal with overlapping shapes.
function binary_bit_is(v, b, t=1)
Test if a binary bit position of an integer value equals a test bit.
function defined_e_or(v, i, d)
Returns an element from an iterable if it exists, or a default value if not.
function third(v)
Return the third element of an iterable value.
function second(v)
Return the second element of an iterable value.
function first(v)
Return the first element of an iterable value.
function limit(v, l, u)
Limit a list of numbers between an upper and lower bounds.
function strl(v)
Convert a list of values to a concatenated string.
function map_get_value(m, k)
Get the map value associated with a key.
function map_get_keys(m)
Get a list of all map keys.
module map_check(m, verbose=false)
Perform basic format checks on a map and output errors to console.
function map_exists(m, k)
Test if a key exists.
function is_defined(v)
Test if a value is defined.
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 omdl_logo(r=5, c=false, b=false, t=false, td="ltr", a=0, d)
Standard omdl logo.
module power_strip_sg(cols=1, rows=1, mode=7, verb=1, cm_box=power_strip_box_default, cm_mount=power_strip_mount_default, cm_cover=power_strip_cover_default)
A power strip generator for single gang electrical receptacles.
power_strip_mount_default
<map> A single gang electrical device mount configuration.
power_strip_box_default
<map> A single gang electrical device box configuration.
power_strip_cover_default
<map> A single gang duplex receptacle cover configuration.
module project_box_rectangle(wth, h, size, vr, vrm, inset, lid, lip, rib, wall, post, hole, shape, align, mode=0, verb=0)
A rectangular box maker for project boxes, enclosures and housings.
module clamp_cg(size=1, clamp, cone, grip, wth=0, gap=10, mode)
A clamp, bushing, and/or grip for wire, hose, and/or pipe wall penetrations.
module mount_screw_slot(wth, screw, cover, size, align, mode, f)
A screw mount slot with optional cover envelope.
module mount_screw_tab(wth, screw, brace, size, vr, vrm)
A mount tab with screw hole and support brace.
module rectangle(size=1, vr, vrm=0, center=false)
A rectangle with corner rounds or chamfers.
module rectangle_c(size=1, core, t, co, cr=0, vr, vr1, vr2, vrm=0, vrm1, vrm2, center=false)
A rectangle with a removed rectangular core.
module cone(size=1, vr, center=false)
A cone.
function length(v, from=length_unit_default, to=length_unit_base, d=1)
Convert a length value from one unit to another, with optional dimensional scaling.