More pcb component examples. Allowed more colour setting.

This commit is contained in:
Martin Budden 2020-02-26 07:19:55 +00:00
parent c364bf06b2
commit e87dffd92c
2 changed files with 72 additions and 45 deletions

View File

@ -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);

View File

@ -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);