diff --git a/readme.md b/readme.md index 84e1a5c..e8ee64f 100644 --- a/readme.md +++ b/readme.md @@ -1923,7 +1923,9 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o | ```pcb_screw_positions(type)``` | Positions children at the mounting hole positions | | ```pcb_spacer(screw, height, wall = 1.8, taper = 0)``` | Generate STL for PCB spacer | | ```rj45(cutout = false)``` | Draw RJ45 Ethernet connector | +| ```standoff(h, d, h2, d2)``` | Draw a standoff | | ```terminal_35(ways, colour = "blue")``` | Draw 3.5mm terminal block | +| ```trimpot10(vertical, coutout = false)``` | Draw a ten turn trimpot | | ```uSD(size, cutout = false)``` | Draw uSD socket | | ```usb_Ax1(cutout = false)``` | Draw USB type A single socket | | ```usb_Ax2(cutout = false)``` | Draw USB type A dual socket | @@ -2007,7 +2009,9 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o | ```pcb_screw_positions(type)``` | Positions children at the mounting hole positions | | ```pcb_spacer(screw, height, wall = 1.8, taper = 0)``` | Generate STL for PCB spacer | | ```rj45(cutout = false)``` | Draw RJ45 Ethernet connector | +| ```standoff(h, d, h2, d2)``` | Draw a standoff | | ```terminal_35(ways, colour = "blue")``` | Draw 3.5mm terminal block | +| ```trimpot10(vertical, coutout = false)``` | Draw a ten turn trimpot | | ```uSD(size, cutout = false)``` | Draw uSD socket | | ```usb_Ax1(cutout = false)``` | Draw USB type A single socket | | ```usb_Ax2(cutout = false)``` | Draw USB type A dual socket | diff --git a/tests/PCB.scad b/tests/PCB.scad index d0c1014..c0b8b4f 100644 --- a/tests/PCB.scad +++ b/tests/PCB.scad @@ -98,6 +98,8 @@ test_pcb = ["TestPCB", "Test PCB", [ 12, 444, 0, "2p54socket", 8, 1, undef, undef, undef, "red" ], [ 10, 470, 0, "standoff", 5, 4.5, 12.5, 2.54], [ 6, 480, 180, "uSD", [12, 11.5, 1.4]], + [ 20, -5, 180, "trimpot10"], + [ 20, -15, 0, "trimpot10", true], ], // accessories [] diff --git a/tests/png/pcb.png b/tests/png/pcb.png index 460d8ca..b29c36d 100644 Binary files a/tests/png/pcb.png and b/tests/png/pcb.png differ diff --git a/vitamins/pcb.scad b/vitamins/pcb.scad index 235bc3c..9abcb7a 100644 --- a/vitamins/pcb.scad +++ b/vitamins/pcb.scad @@ -721,7 +721,7 @@ module molex_254(ways) { //! Draw molex header cube([0.44, 0.75, above + below], center = true); } -module standoff(h, d, h2, d2) { +module standoff(h, d, h2, d2) { //! Draw a standoff color("white") { cylinder(d = d, h = h); @@ -735,6 +735,44 @@ module standoff(h, d, h2, d2) { } } +module trimpot10(vertical, coutout = false) { //! Draw a ten turn trimpot + l = 10; + w = 9.5; + h = 4.8; + foot_w = 1; + foot_h = 0.5; + screw_h = 1.5; + screw_d = 2.25; + slot_w = 0.6; + slot_h = 0.8; + + translate(vertical ? [0, -h / 2, l / 2] : [0, 0]) + rotate([vertical ? -90 : 0, 0, 0]) { + color("#2CA1FD") { + translate([0, -foot_h / 2, foot_h / 2 + h / 2]) + cube([w, l - foot_h, h - foot_h], center = true); + + for(x = [-1, 1], y = [-1, 1]) + translate([x * (w - foot_w) / 2, y * (l - foot_w) / 2, h / 2]) + cube([foot_w, foot_w, h], center = true); + + } + + color(brass) + translate([-w / 2 + screw_d / 2, -l / 2, h - screw_d / 2]) + rotate([90, 0, 0]) { + cylinder(d = screw_d, h = screw_h - slot_h); + + linear_extrude(height = screw_h) + difference() { + circle(d = screw_d); + + square([slot_w, screw_d + 1], center = true); + } + } + } +} + module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb component from description function show(comp, part) = (comp[3] == part || comp[3] == str("-",part)) && (!cutouts || angle == undef || angle == comp.z); function param(n, default = 0) = len(comp) > n ? comp[n] : default; @@ -773,6 +811,7 @@ module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb compon if(show(comp, "pcb")) if(!cutouts) translate_z(comp[4]) pcb(comp[5]); if(show(comp, "standoff")) if(!cutouts) standoff(comp[4], comp[5], comp[6], comp[7]); if(show(comp, "uSD")) uSD(comp[4], cutouts); + if(show(comp, "trimpot10")) trimpot10(param(4, false), cutouts); } }