From ce36729e506c49b29068fb95c8e5e120f562e0d6 Mon Sep 17 00:00:00 2001 From: Martin Budden Date: Thu, 30 Jan 2020 19:59:04 +0000 Subject: [PATCH 1/7] Allow pin header base colour to be set on PCB. --- vitamins/pcb.scad | 2 +- vitamins/pin_header.scad | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/vitamins/pcb.scad b/vitamins/pcb.scad index 83296b9..e8d2d04 100644 --- a/vitamins/pcb.scad +++ b/vitamins/pcb.scad @@ -710,7 +710,7 @@ module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb compon 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; rotate(comp.z) { - if(show(comp, "2p54header")) pin_header(2p54header, comp[4], comp[5], param(6), cutouts); + if(show(comp, "2p54header")) pin_header(2p54header, comp[4], comp[5], param(6), cutouts, colour = param(7, undef)); if(show(comp, "2p54boxhdr")) box_header(2p54header, comp[4], comp[5], param(6), cutouts); if(show(comp, "2p54socket")) pin_socket(2p54header, comp[4], comp[5], param(6, false), param(7), param(8, false), cutouts); if(show(comp, "chip")) chip(comp[4], comp[5], comp[6], param(7, grey30), cutouts); diff --git a/vitamins/pin_header.scad b/vitamins/pin_header.scad index d60d3a4..a4644e1 100644 --- a/vitamins/pin_header.scad +++ b/vitamins/pin_header.scad @@ -43,8 +43,9 @@ module pin(type, length = undef) { //! Draw a header pin } } -module pin_header(type, cols = 1, rows = 1, smt = false, right_angle = false, cutout = false) { //! Draw pin header +module pin_header(type, cols = 1, rows = 1, smt = false, right_angle = false, cutout = false, colour) { //! Draw pin header pitch = hdr_pitch(type); + base_colour = colour ? colour : hdr_base_colour(type); h = pitch; ra_offset = 2.4; width = pitch * rows; @@ -79,7 +80,7 @@ module pin_header(type, cols = 1, rows = 1, smt = false, right_angle = false, cu } translate([0, right_angle ? -ra_offset - pitch / 2 : 0, right_angle ? width / 2 : 0]) rotate([right_angle ? 90 : 0, 0, 0]) - color(hdr_base_colour(type)) + color(base_colour) linear_extrude(height = h) for(x = [0 : cols - 1], y = [0 : rows - 1]) translate([pitch * (x - (cols - 1) / 2), pitch * (y - (rows - 1) / 2), pitch / 2]) From bc1f135e401ce6da844e6e99b7c3ffdf3e86364e Mon Sep 17 00:00:00 2001 From: Martin Budden Date: Wed, 29 Jan 2020 17:59:48 +0000 Subject: [PATCH 2/7] Added ability to set socket color. --- vitamins/pcb.scad | 2 +- vitamins/pin_header.scad | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/vitamins/pcb.scad b/vitamins/pcb.scad index 83296b9..67f964a 100644 --- a/vitamins/pcb.scad +++ b/vitamins/pcb.scad @@ -712,7 +712,7 @@ module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb compon rotate(comp.z) { if(show(comp, "2p54header")) pin_header(2p54header, comp[4], comp[5], param(6), cutouts); if(show(comp, "2p54boxhdr")) box_header(2p54header, comp[4], comp[5], param(6), cutouts); - if(show(comp, "2p54socket")) pin_socket(2p54header, comp[4], comp[5], param(6, false), param(7), param(8, false), cutouts); + if(show(comp, "2p54socket")) pin_socket(2p54header, comp[4], comp[5], param(6, false), param(7), param(8, false), cutouts, param(9, undef)); if(show(comp, "chip")) chip(comp[4], comp[5], comp[6], param(7, grey30), cutouts); if(show(comp, "rj45")) rj45(cutouts); if(show(comp, "usb_Ax2")) usb_Ax2(cutouts); diff --git a/vitamins/pin_header.scad b/vitamins/pin_header.scad index d60d3a4..7e94a37 100644 --- a/vitamins/pin_header.scad +++ b/vitamins/pin_header.scad @@ -160,18 +160,19 @@ module idc_transition(type, cols = 5, skip = [], cutout = false) { //! Draw IDC } } -module pin_socket(type, cols = 1, rows = 1, right_angle = false, height = 0, smt = false, cutout = false) { //! Draw pin socket +module pin_socket(type, cols = 1, rows = 1, right_angle = false, height = 0, smt = false, cutout = false, colour) { //! Draw pin socket pitch = hdr_pitch(type); length = pitch * cols + 0.5; width = pitch * rows - 0.08; depth = height ? height : hdr_socket_depth(type); + base_colour = colour ? colour : hdr_base_colour(type); ra_offset = 1.5; if(cutout) ; else { vitamin(str("pin_socket(", type[0], ", ", cols, ", ", rows, arg(right_angle, false, "right_angle"), arg(height, 0, "height"), arg(smt, false, "smt"), "): Pin socket ", cols, " x ", rows, right_angle ? " right_angle" : "")); - color(hdr_base_colour(type)) + color(base_colour) translate([0, right_angle ? -ra_offset - pitch / 2 : 0, right_angle ? width / 2 : 0]) rotate([right_angle ? 90 : 0, 0, 0]) translate_z(depth / 2) From 598527edbe6dcef0a5944c38a0c4dd5e90f5f244 Mon Sep 17 00:00:00 2001 From: Martin Budden Date: Tue, 25 Feb 2020 20:13:15 +0000 Subject: [PATCH 3/7] Added a test pcb. --- tests/pcb.scad | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 tests/pcb.scad diff --git a/tests/pcb.scad b/tests/pcb.scad new file mode 100644 index 0000000..b0f2aec --- /dev/null +++ b/tests/pcb.scad @@ -0,0 +1,76 @@ +// +// NopSCADlib Copyright Chris Palmer 2018 +// nop.head@gmail.com +// hydraraptor.blogspot.com +// +// This file is part of NopSCADlib. +// +// NopSCADlib is free software: you can redistribute it and/or modify it under the terms of the +// GNU General Public License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// NopSCADlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along with NopSCADlib. +// If not, see . +// +include <../core.scad> + +use <../vitamins/pcb.scad> +include <../vitamins/microswitches.scad> +include <../vitamins/d_connectors.scad> + + + +test_pcb = ["TestPCB", "Test PCB", + 40, 420, 1.6, // length, width, thickness + 3, // Corner radius + 2.75, // Mounting hole diameter + 6, // Pad around mounting hole + "green",// Color + false, // True if the parts should be separate BOM items + // hole offsets + [ [3, 3], [3, -3], [-3, 3], [-3, -3] ], + // components + [ + [ 10, 10, 0, "2p54header", 3, 1], + [ 20, 10, 0, "2p54header", 3, 1, undef, "blue" ], + [ 10, 20, 0, "2p54boxhdr", 2, 1], + [ 10, 30, 0, "2p54socket", 2, 1], + [ 20, 30, 0, "2p54socket", 3, 1, undef, undef, undef, "red" ], + [ 10, 40, 0, "chip", 5, 10, 1, grey20], // E2 stop + [ 10, 60, 0, "rj45"], + [ 10, 80, 0, "usb_Ax2"], + [ 10, 100, 0, "usb_uA"], + [ 10, 120, 0, "usb_B"], + [ 10, 140, 0, "buzzer"], + [ 10, 155, 0, "jack"], + [ 10, 165, 0, "barrel_jack"], + [ 10, 180, 0, "hdmi"], + [ 10, 200, 0, "mini_hdmi"], + [ 10, 210, 0, "flex"], + [ 10, 225, 0, "flat_flex"], + [ 10, 240, 0, "D_plug", DCONN9], + [ 10, 255, 0, "molex_hdr", 2], + [ 10, 265, 0, "jst_xh", 2], + [ 10, 275, 0, "term254", 3], + [ 10, 290, 0, "gterm35", 4], + [ 10, 310, 0, "gterm635", 2], + [ 10, 330, 0, "term35", 4], + [ 10, 345, 0, "transition", 5], + [ 10, 355, 0, "block", 10,5, 8], + [ 10, 365, 0, "button_6mm"], + [ 10, 375, 0, "microswitch", small_microswitch], + //[ 10, 360, 0, "pcb"], + [ 10, 390, 0, "standoff", 5, 4.5, 12.5, 2.54], + [ 10, 400, 0, "uSD", [12, 11.5, 1.4]], + ], + // accesories + [] +]; + + +if($preview) + pcb(test_pcb); From 1af2e185948c7620326229dc86ebaab24a3eb593 Mon Sep 17 00:00:00 2001 From: Martin Budden Date: Tue, 25 Feb 2020 20:39:37 +0000 Subject: [PATCH 4/7] Added usb_Ax1 and potentiometer. --- tests/pcb.scad | 52 ++++++++++++++++++++++++----------------------- vitamins/pcb.scad | 37 +++++++++++++++++++++++++++++---- 2 files changed, 60 insertions(+), 29 deletions(-) diff --git a/tests/pcb.scad b/tests/pcb.scad index b0f2aec..83a58e3 100644 --- a/tests/pcb.scad +++ b/tests/pcb.scad @@ -25,7 +25,7 @@ include <../vitamins/d_connectors.scad> test_pcb = ["TestPCB", "Test PCB", - 40, 420, 1.6, // length, width, thickness + 40, 480, 1.6, // length, width, thickness 3, // Corner radius 2.75, // Mounting hole diameter 6, // Pad around mounting hole @@ -42,30 +42,32 @@ test_pcb = ["TestPCB", "Test PCB", [ 20, 30, 0, "2p54socket", 3, 1, undef, undef, undef, "red" ], [ 10, 40, 0, "chip", 5, 10, 1, grey20], // E2 stop [ 10, 60, 0, "rj45"], - [ 10, 80, 0, "usb_Ax2"], - [ 10, 100, 0, "usb_uA"], - [ 10, 120, 0, "usb_B"], - [ 10, 140, 0, "buzzer"], - [ 10, 155, 0, "jack"], - [ 10, 165, 0, "barrel_jack"], - [ 10, 180, 0, "hdmi"], - [ 10, 200, 0, "mini_hdmi"], - [ 10, 210, 0, "flex"], - [ 10, 225, 0, "flat_flex"], - [ 10, 240, 0, "D_plug", DCONN9], - [ 10, 255, 0, "molex_hdr", 2], - [ 10, 265, 0, "jst_xh", 2], - [ 10, 275, 0, "term254", 3], - [ 10, 290, 0, "gterm35", 4], - [ 10, 310, 0, "gterm635", 2], - [ 10, 330, 0, "term35", 4], - [ 10, 345, 0, "transition", 5], - [ 10, 355, 0, "block", 10,5, 8], - [ 10, 365, 0, "button_6mm"], - [ 10, 375, 0, "microswitch", small_microswitch], - //[ 10, 360, 0, "pcb"], - [ 10, 390, 0, "standoff", 5, 4.5, 12.5, 2.54], - [ 10, 400, 0, "uSD", [12, 11.5, 1.4]], + [ 10, 80, 0, "usb_A"], + [ 10, 100, 0, "usb_Ax2"], + [ 10, 120, 0, "usb_uA"], + [ 10, 140, 0, "usb_B"], + [ 10, 160, 0, "buzzer"], + [ 10, 175, 0, "potentiometer"], + [ 10, 190, 0, "jack"], + [ 10, 200, 0, "barrel_jack"], + [ 10, 220, 0, "hdmi"], + [ 10, 240, 0, "mini_hdmi"], + [ 10, 250, 0, "flex"], + [ 10, 265, 0, "flat_flex"], + [ 10, 280, 0, "D_plug", DCONN9], + [ 10, 300, 0, "molex_hdr", 2], + [ 10, 310, 0, "jst_xh", 2], + [ 10, 320, 0, "term254", 3], + [ 10, 340, 0, "gterm35", 4], + [ 10, 360, 0, "gterm635", 2], + [ 10, 380, 0, "term35", 4], + [ 10, 400, 0, "transition", 5], + [ 10, 410, 0, "block", 10,5, 8], + [ 10, 420, 0, "button_6mm"], + [ 10, 435, 0, "microswitch", small_microswitch], + //[ 10, 440, 0, "pcb"], + [ 10, 450, 0, "standoff", 5, 4.5, 12.5, 2.54], + [ 10, 460, 0, "uSD", [12, 11.5, 1.4]], ], // accesories [] diff --git a/vitamins/pcb.scad b/vitamins/pcb.scad index a25fccd..537fdf8 100644 --- a/vitamins/pcb.scad +++ b/vitamins/pcb.scad @@ -31,6 +31,7 @@ include use <../utils/rounded_cylinder.scad> use <../utils/dogbones.scad> +use <../utils/thread.scad> use <../utils/tube.scad> use @@ -79,16 +80,21 @@ module chip(length, width, thickness, colour, cutout = false) //! Draw a coloure color(colour) translate_z(thickness / 2) cube([length, width, thickness], center = true); +module usb_Ax1(cutout = false) { //! Draw USB type A single socket + usb_A(h = 6.5, v_flange_l = 4.5, bar = 0, cutout = cutout); +} + module usb_Ax2(cutout = false) { //! Draw USB type A dual socket + usb_A(h = 15.6, v_flange_l = 12.15, bar = 3.4, cutout = cutout); +} + +module usb_A(h, v_flange_l, bar, cutout) { l = 17; w = 13.25; - h = 15.6; flange_t = 0.4; h_flange_h = 0.8; h_flange_l = 11; v_flange_h = 1; - v_flange_l = 12.15; - bar = 3.4; socket_h = (h - 2 * flange_t - bar) / 2; translate_z(h / 2) @@ -203,11 +209,32 @@ module jack(cutout = false) { //! Draw 3.5mm jack module buzzer(height, diameter, colour) { //! Draw PCB buzzer with specified height, diameter and color color (colour) - tube(or = diameter / 2, ir = height > 5 ? 1 : 0.75, h = height); + tube(or = diameter / 2, ir = height > 5 ? 1 : 0.75, h = height, center = false); color("white") cylinder(d = 2, h = max(height - 3 , 0.5)); } +module potentiometer(h1, h2) { + color("silver") { + baseSize = [12, 11, 6]; + translate_z(baseSize.z / 2) + cube(baseSize, center = true); + translate_z(baseSize.z) { + cylinder(d = 5, h = h1 - 0.5); + if (show_threads) + male_metric_thread(6, metric_coarse_pitch(5), length = h1 - 0.5, center = false); + } + translate_z(baseSize.z + h1 - 0.5) + cylinder(d = 3, h = 0.5); + translate_z(baseSize.z + h1) + linear_extrude(h2) + difference() { + circle(d=5); + square([0.75,5], center = true); + } + } +} + function hdmi_depth(type) = type[2]; //! Front to back depth function hdmi_width1(type) = type[3]; //! Inside width at the top function hdmi_width2(type) = type[4]; //! Inside width at the bottom @@ -715,10 +742,12 @@ module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb compon if(show(comp, "2p54socket")) pin_socket(2p54header, comp[4], comp[5], param(6, false), param(7), param(8, false), cutouts, param(9, undef)); if(show(comp, "chip")) chip(comp[4], comp[5], comp[6], param(7, grey30), cutouts); if(show(comp, "rj45")) rj45(cutouts); + if(show(comp, "usb_A")) usb_Ax1(cutouts); if(show(comp, "usb_Ax2")) usb_Ax2(cutouts); if(show(comp, "usb_uA")) usb_uA(cutouts); if(show(comp, "usb_B")) usb_B(cutouts); if(show(comp, "buzzer")) buzzer(param(4, 9), param(5, 12), param(6, grey20)); + if(show(comp, "potentiometer")) potentiometer(param(4, 5), param(5, 9)); if(show(comp, "jack")) jack(cutouts); if(show(comp, "barrel_jack")) barrel_jack(cutouts); if(show(comp, "hdmi")) hdmi(hdmi_full, cutouts); From 0e58e92fbc50a9f3ad39960d4ccab3bfe4d74bb1 Mon Sep 17 00:00:00 2001 From: Martin Budden Date: Tue, 25 Feb 2020 21:01:04 +0000 Subject: [PATCH 5/7] Allowed parameterised green terminals on PCBs. --- tests/pcb.scad | 16 ++++++++++------ vitamins/pcb.scad | 1 + 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/pcb.scad b/tests/pcb.scad index 83a58e3..e667c5f 100644 --- a/tests/pcb.scad +++ b/tests/pcb.scad @@ -22,10 +22,11 @@ use <../vitamins/pcb.scad> include <../vitamins/microswitches.scad> include <../vitamins/d_connectors.scad> - +gt_5x17 = ["gt_5x17", 5, 10, 17, 5, 11, 0.4, 9, 2,1.5, 1, 3, 6, 0, 0, 0]; +gt_5x11 = ["gt_5x11", 5, 8, 11, 5, 7, 0.4, 7, 1.5,1.5, 1,2.5, 6, 0, 0, 0]; test_pcb = ["TestPCB", "Test PCB", - 40, 480, 1.6, // length, width, thickness + 50, 480, 1.6, // length, width, thickness 3, // Corner radius 2.75, // Mounting hole diameter 6, // Pad around mounting hole @@ -36,10 +37,10 @@ test_pcb = ["TestPCB", "Test PCB", // components [ [ 10, 10, 0, "2p54header", 3, 1], - [ 20, 10, 0, "2p54header", 3, 1, undef, "blue" ], + [ 25, 10, 0, "2p54header", 3, 1, undef, "blue" ], [ 10, 20, 0, "2p54boxhdr", 2, 1], [ 10, 30, 0, "2p54socket", 2, 1], - [ 20, 30, 0, "2p54socket", 3, 1, undef, undef, undef, "red" ], + [ 25, 30, 0, "2p54socket", 3, 1, undef, undef, undef, "red" ], [ 10, 40, 0, "chip", 5, 10, 1, grey20], // E2 stop [ 10, 60, 0, "rj45"], [ 10, 80, 0, "usb_A"], @@ -58,11 +59,14 @@ test_pcb = ["TestPCB", "Test PCB", [ 10, 300, 0, "molex_hdr", 2], [ 10, 310, 0, "jst_xh", 2], [ 10, 320, 0, "term254", 3], - [ 10, 340, 0, "gterm35", 4], + [ 10, 340, 0, "gterm35", 4, [1,2]], + [ 25, 340, 0, "gterm", gt_5x11, 3], [ 10, 360, 0, "gterm635", 2], + [ 25, 360, 0, "gterm", gt_5x17, 2, undef, grey20], + [ 40, 360, 0, "gterm", gt_5x17, 3, [1], "red"], [ 10, 380, 0, "term35", 4], [ 10, 400, 0, "transition", 5], - [ 10, 410, 0, "block", 10,5, 8], + [ 10, 410, 0, "block", 10, 5, 8, "orange"], [ 10, 420, 0, "button_6mm"], [ 10, 435, 0, "microswitch", small_microswitch], //[ 10, 440, 0, "pcb"], diff --git a/vitamins/pcb.scad b/vitamins/pcb.scad index 537fdf8..cb65afa 100644 --- a/vitamins/pcb.scad +++ b/vitamins/pcb.scad @@ -758,6 +758,7 @@ module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb compon if(show(comp, "molex_hdr")) if(!cutouts) molex_254(comp[4]); if(show(comp, "jst_xh")) if(!cutouts) jst_xh_header(jst_xh_header, comp[4], param(5, false), param(6, "white"), param(7, undef)); if(show(comp, "term254")) if(!cutouts) green_terminal(gt_2p54,comp[4], comp[5]); + if(show(comp, "gterm")) if(!cutouts) green_terminal(comp[4], comp[5], comp[6], param(7,"lime")); if(show(comp, "gterm35")) if(!cutouts) green_terminal(gt_3p5, comp[4], comp[5]); if(show(comp, "gterm635")) if(!cutouts) green_terminal(gt_6p35, comp[4], comp[5]); if(show(comp, "term35")) if(!cutouts) terminal_35(comp[4]); From c364bf06b246bf7e7b16599bda705abc1c3ec3b7 Mon Sep 17 00:00:00 2001 From: Martin Budden Date: Tue, 25 Feb 2020 22:34:13 +0000 Subject: [PATCH 6/7] Code tidy. --- tests/pcb.scad | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/pcb.scad b/tests/pcb.scad index e667c5f..c794ed4 100644 --- a/tests/pcb.scad +++ b/tests/pcb.scad @@ -41,7 +41,7 @@ test_pcb = ["TestPCB", "Test PCB", [ 10, 20, 0, "2p54boxhdr", 2, 1], [ 10, 30, 0, "2p54socket", 2, 1], [ 25, 30, 0, "2p54socket", 3, 1, undef, undef, undef, "red" ], - [ 10, 40, 0, "chip", 5, 10, 1, grey20], // E2 stop + [ 10, 40, 0, "chip", 5, 10, 1, grey20], [ 10, 60, 0, "rj45"], [ 10, 80, 0, "usb_A"], [ 10, 100, 0, "usb_Ax2"], @@ -80,3 +80,4 @@ test_pcb = ["TestPCB", "Test PCB", if($preview) pcb(test_pcb); + From e87dffd92c681913d9c525d10967ec319bc43875 Mon Sep 17 00:00:00 2001 From: Martin Budden Date: Wed, 26 Feb 2020 07:19:55 +0000 Subject: [PATCH 7/7] More pcb component examples. Allowed more colour setting. --- tests/pcb.scad | 105 +++++++++++++++++++++++++++++----------------- vitamins/pcb.scad | 12 +++--- 2 files changed, 72 insertions(+), 45 deletions(-) diff --git a/tests/pcb.scad b/tests/pcb.scad index c794ed4..7be8597 100644 --- a/tests/pcb.scad +++ b/tests/pcb.scad @@ -25,8 +25,26 @@ include <../vitamins/d_connectors.scad> gt_5x17 = ["gt_5x17", 5, 10, 17, 5, 11, 0.4, 9, 2,1.5, 1, 3, 6, 0, 0, 0]; gt_5x11 = ["gt_5x11", 5, 8, 11, 5, 7, 0.4, 7, 1.5,1.5, 1,2.5, 6, 0, 0, 0]; +TMC2130HeatSinkColor = "DeepSkyBlue"; +TMC2130 = ["TMC2130", "TMC2130", + 20, 14, 1.6, 0, 3, 0, "white", false, [], + [ + [ 10, 1, 0, "-2p54header", 8, 1 ,undef, "blue" ], + [ 10, 13, 0, "-2p54header", 8, 1], + [ 12, 7, 0, "-chip", 6, 4, 1, grey20 ], + // mock up a heat sink + [ 10, 7, 0, "block", 9, 9, 2, TMC2130HeatSinkColor ], + [ 10, 11, 0, "block", 9, 1, 11, TMC2130HeatSinkColor ], + [ 10, 9, 0, "block", 9, 1, 11, TMC2130HeatSinkColor ], + [ 10, 7, 0, "block", 9, 1, 11, TMC2130HeatSinkColor ], + [ 10, 5, 0, "block", 9, 1, 11, TMC2130HeatSinkColor ], + [ 10, 3, 0, "block", 9, 1, 11, TMC2130HeatSinkColor ], + ], + [] +]; + test_pcb = ["TestPCB", "Test PCB", - 50, 480, 1.6, // length, width, thickness + 50, 500, 1.6, // length, width, thickness 3, // Corner radius 2.75, // Mounting hole diameter 6, // Pad around mounting hole @@ -36,48 +54,57 @@ test_pcb = ["TestPCB", "Test PCB", [ [3, 3], [3, -3], [-3, 3], [-3, -3] ], // components [ - [ 10, 10, 0, "2p54header", 3, 1], - [ 25, 10, 0, "2p54header", 3, 1, undef, "blue" ], - [ 10, 20, 0, "2p54boxhdr", 2, 1], - [ 10, 30, 0, "2p54socket", 2, 1], - [ 25, 30, 0, "2p54socket", 3, 1, undef, undef, undef, "red" ], - [ 10, 40, 0, "chip", 5, 10, 1, grey20], - [ 10, 60, 0, "rj45"], - [ 10, 80, 0, "usb_A"], - [ 10, 100, 0, "usb_Ax2"], - [ 10, 120, 0, "usb_uA"], - [ 10, 140, 0, "usb_B"], - [ 10, 160, 0, "buzzer"], - [ 10, 175, 0, "potentiometer"], - [ 10, 190, 0, "jack"], - [ 10, 200, 0, "barrel_jack"], - [ 10, 220, 0, "hdmi"], - [ 10, 240, 0, "mini_hdmi"], - [ 10, 250, 0, "flex"], - [ 10, 265, 0, "flat_flex"], - [ 10, 280, 0, "D_plug", DCONN9], - [ 10, 300, 0, "molex_hdr", 2], - [ 10, 310, 0, "jst_xh", 2], - [ 10, 320, 0, "term254", 3], - [ 10, 340, 0, "gterm35", 4, [1,2]], - [ 25, 340, 0, "gterm", gt_5x11, 3], - [ 10, 360, 0, "gterm635", 2], - [ 25, 360, 0, "gterm", gt_5x17, 2, undef, grey20], - [ 40, 360, 0, "gterm", gt_5x17, 3, [1], "red"], - [ 10, 380, 0, "term35", 4], - [ 10, 400, 0, "transition", 5], - [ 10, 410, 0, "block", 10, 5, 8, "orange"], - [ 10, 420, 0, "button_6mm"], - [ 10, 435, 0, "microswitch", small_microswitch], - //[ 10, 440, 0, "pcb"], - [ 10, 450, 0, "standoff", 5, 4.5, 12.5, 2.54], - [ 10, 460, 0, "uSD", [12, 11.5, 1.4]], + [ 10, 10, 0, "2p54header", 4, 1], + [ 25, 10, 0, "2p54header", 5, 1, undef, "blue" ], + [ 10, 20, 0, "2p54boxhdr", 4, 2], + [ 10, 30, 0, "2p54socket", 6, 1], + [ 25, 30, 0, "2p54socket", 4, 1, undef, undef, undef, "red" ], + [ 10, 40, 0, "chip", 10, 5, 1, grey20], + [ 10, 60, 180, "rj45"], + [ 8, 80, 180, "usb_A"], + [ 8, 100, 180, "usb_Ax2"], + [ 3, 120, 180, "usb_uA"], + [ 8, 140, 180, "usb_B"], + [ 10, 160, 0, "buzzer"], + [ 25, 160, 0, "buzzer", 4.5, 8.5], + [ 10, 175, 0, "potentiometer"], + [ 30, 175, 0, "potentiometer", 7, 8], + [ 8, 190, 180, "jack"], + [ 6, 200, 180, "barrel_jack"], + [ 5, 220, 180, "hdmi"], + [ 3, 240, 180, "mini_hdmi"], + [ 10, 250, 0, "flex"], + [ 10, 265, 0, "flat_flex"], + [ 10, 280, 0, "D_plug", DCONN9], + [ 10, 300, 0, "molex_hdr", 2], + [ 10, 310, 0, "jst_xh", 2], + [ 10, 320, 180, "term254", 3], + [ 20, 320, 180, "term254", 3, undef, grey20], + [ 10, 340, 180, "gterm35", 4, [1,2]], + [ 20, 340, 180, "gterm35", 4, [1,2], "red"], + [ 30, 340, 180, "gterm", gt_5x11, 3], + [ 10, 360, 180, "gterm635", 2], + [ 25, 360, 180, "gterm635", 2, undef, "blue"], + [ 40, 360, 180, "gterm", gt_5x17, 2, undef, grey20], + [ 40, 340, 180, "gterm", gt_5x17, 3, [1], "red"], + [ 10, 380, 180, "term35", 4], + [ 20, 380, 180, "term35", 3, "lime"], + [ 10, 400, 0, "transition", 5], + [ 10, 410, 0, "block", 10, 5, 8, "orange"], + [ 10, 420, 0, "button_6mm"], + [ 10, 435, 0, "microswitch", small_microswitch], + [ 12, 450, 0, "pcb", 11, TMC2130 ], + [ 12, 456, 0, "2p54socket", 8, 1 ], + [ 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]], ], - // accesories + // accessories [] ]; if($preview) - pcb(test_pcb); + let($show_threads = true) + pcb(test_pcb); diff --git a/vitamins/pcb.scad b/vitamins/pcb.scad index cb65afa..8778a34 100644 --- a/vitamins/pcb.scad +++ b/vitamins/pcb.scad @@ -601,7 +601,7 @@ module flat_flex(cutout = false) { //! Draw flat flexistrip connector as used on } } -module terminal_35(ways) { //! Draw 3.5mm terminal block +module terminal_35(ways, colour = "blue") { //! Draw 3.5mm terminal block vitamin(str("terminal_35(", ways, "): Terminal block ", ways, " way 3.5mm")); pitch = 3.5; width = ways * pitch; @@ -619,7 +619,7 @@ module terminal_35(ways) { //! Draw 3.5mm terminal block module single() { screw_r = 1; - color("blue") { + color(colour) { rotate([90, 0, 0]) linear_extrude(height = pitch, center = true) polygon(points = [ @@ -757,11 +757,11 @@ module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb compon if(show(comp, "D_plug")) if(!cutouts) translate_z(d_pcb_offset(comp[4])) d_plug(comp[4], pcb = true); if(show(comp, "molex_hdr")) if(!cutouts) molex_254(comp[4]); if(show(comp, "jst_xh")) if(!cutouts) jst_xh_header(jst_xh_header, comp[4], param(5, false), param(6, "white"), param(7, undef)); - if(show(comp, "term254")) if(!cutouts) green_terminal(gt_2p54,comp[4], comp[5]); + if(show(comp, "term254")) if(!cutouts) green_terminal(gt_2p54,comp[4], comp[5], param(6,"lime")); if(show(comp, "gterm")) if(!cutouts) green_terminal(comp[4], comp[5], comp[6], param(7,"lime")); - if(show(comp, "gterm35")) if(!cutouts) green_terminal(gt_3p5, comp[4], comp[5]); - if(show(comp, "gterm635")) if(!cutouts) green_terminal(gt_6p35, comp[4], comp[5]); - if(show(comp, "term35")) if(!cutouts) terminal_35(comp[4]); + if(show(comp, "gterm35")) if(!cutouts) green_terminal(gt_3p5, comp[4], comp[5], param(6,"lime")); + if(show(comp, "gterm635")) if(!cutouts) green_terminal(gt_6p35, comp[4], comp[5], param(6,"lime")); + if(show(comp, "term35")) if(!cutouts) terminal_35(comp[4], param(5,"blue")); if(show(comp, "transition")) if(!cutouts) idc_transition(2p54header, comp[4], comp[5]); if(show(comp, "block")) color(comp[7]) if(!cutouts) translate_z(comp[6] / 2) cube([comp[4], comp[5], comp[6]], center = true);