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])