From 726d9ed2dc921b5a7ef8c5b0fa6b17628f706bf8 Mon Sep 17 00:00:00 2001 From: Chris Palmer Date: Sat, 11 Sep 2021 11:51:24 +0100 Subject: [PATCH] Can now draw right angle Molex KK connectors and can skip pins to allow high voltage. --- readme.md | 4 ++-- vitamins/pcb.scad | 43 ++++++++++++++++++++++++++++++++----------- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/readme.md b/readme.md index 3c8c6e2..0949bc8 100644 --- a/readme.md +++ b/readme.md @@ -2344,7 +2344,7 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o | `flex(cutout = false)` | Draw flexistrip connector | | `hdmi(type, cutout = false)` | Draw HDMI socket | | `jack(cutout = false)` | Draw 3.5mm jack | -| `molex_254(ways)` | Draw molex header | +| `molex_254(ways, right_angle = 0, skip = undef)` | Draw molex header, set `right_angle` to 1 for normal right angle version or -1 for inverted right angle version. | | `molex_usb_Ax1(cutout)` | Draw Molex USB A connector suitable for perf board | | `molex_usb_Ax2(cutout)` | Draw Molex dual USB A connector suitable for perf board | | `pcb(type)` | Draw specified PCB | @@ -2488,7 +2488,7 @@ PCBs and perfboard with optional components. The shape can be a rectangle with o | `flex(cutout = false)` | Draw flexistrip connector | | `hdmi(type, cutout = false)` | Draw HDMI socket | | `jack(cutout = false)` | Draw 3.5mm jack | -| `molex_254(ways)` | Draw molex header | +| `molex_254(ways, right_angle = 0, skip = undef)` | Draw molex header, set `right_angle` to 1 for normal right angle version or -1 for inverted right angle version. | | `molex_usb_Ax1(cutout)` | Draw Molex USB A connector suitable for perf board | | `molex_usb_Ax2(cutout)` | Draw Molex dual USB A connector suitable for perf board | | `pcb(type)` | Draw specified PCB | diff --git a/vitamins/pcb.scad b/vitamins/pcb.scad index 57b1bd7..9f9f3d3 100644 --- a/vitamins/pcb.scad +++ b/vitamins/pcb.scad @@ -878,7 +878,7 @@ module terminal_35(ways, colour = "blue") { //! Draw 3.5mm terminal block single(); } -module molex_254(ways) { //! Draw molex header +module molex_254(ways, right_angle = 0, skip = undef) { //! Draw molex header, set `right_angle` to 1 for normal right angle version or -1 for inverted right angle version. vitamin(str("molex_254(", ways, "): Molex KK header ", ways, " way")); pitch = 2.54; width = ways * pitch - 0.1; @@ -888,20 +888,41 @@ module molex_254(ways) { //! Draw molex header back = 1; below = 2.3; above = 9; + pin_w = 0.64; + r = 1; + a = right_angle ? width / 2 - r - pin_w / 2 : above; + ra_offset = 2.72; color("white") - union() { - translate([ -depth / 2, -width / 2,]) - cube([depth, width, base]); + translate(right_angle ? [-ra_offset, 0, depth / 2] : [ 0, 0, 0]) + rotate(right_angle ? right_angle > 0 ? [180, 90, 0] : [0, -90, 0] : [ 0, 0, 0]) + union() { + translate([ -depth / 2, -width / 2,]) + cube([depth, width, base]); - w = width - pitch; - translate([- depth / 2, -w / 2]) - cube([back, w, height]); - } + w = width - pitch; + translate([- depth / 2, -w / 2]) + cube([back, w, height]); + } color("silver") - for(i = [0: ways -1]) - translate([0, i * pitch - width / 2 + pitch / 2, (above + below) / 2 - below]) - cube([0.44, 0.75, above + below], center = true); + for(i = [0 : ways -1]) + if(is_undef(skip) || !in(skip, i)) + translate([0, i * pitch - width / 2 + pitch / 2]) { + translate_z((a + below) / 2 - below) + cube([pin_w, pin_w, a + below], center = true); + + l = above + ra_offset - r - pin_w / 2; + if(right_angle) { + translate([-l / 2 - r - pin_w / 2, 0, width / 2]) + cube([l, pin_w, pin_w], center = true); + + translate([-r - pin_w / 2, 0, a]) + rotate([90, 0, 0]) + rotate_extrude(angle = 90) + translate([r + pin_w / 2, 0]) + square(pin_w, true); + } + } } module vero_pin(cropped = false) { //! Draw a vero pin