1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-08-01 21:20:11 +02:00

Added ability to set socket color.

This commit is contained in:
Martin Budden
2020-01-29 17:59:48 +00:00
parent c1833f0820
commit bc1f135e40
2 changed files with 4 additions and 3 deletions

View File

@@ -712,7 +712,7 @@ module pcb_component(comp, cutouts = false, angle = undef) { //! Draw pcb compon
rotate(comp.z) { 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);
if(show(comp, "2p54boxhdr")) box_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, "chip")) chip(comp[4], comp[5], comp[6], param(7, grey30), cutouts);
if(show(comp, "rj45")) rj45(cutouts); if(show(comp, "rj45")) rj45(cutouts);
if(show(comp, "usb_Ax2")) usb_Ax2(cutouts); if(show(comp, "usb_Ax2")) usb_Ax2(cutouts);

View File

@@ -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); pitch = hdr_pitch(type);
length = pitch * cols + 0.5; length = pitch * cols + 0.5;
width = pitch * rows - 0.08; width = pitch * rows - 0.08;
depth = height ? height : hdr_socket_depth(type); depth = height ? height : hdr_socket_depth(type);
base_colour = colour ? colour : hdr_base_colour(type);
ra_offset = 1.5; ra_offset = 1.5;
if(cutout) if(cutout)
; ;
else { else {
vitamin(str("pin_socket(", type[0], ", ", cols, ", ", rows, arg(right_angle, false, "right_angle"), arg(height, 0, "height"), arg(smt, false, "smt"), 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" : "")); "): 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]) translate([0, right_angle ? -ra_offset - pitch / 2 : 0, right_angle ? width / 2 : 0])
rotate([right_angle ? 90 : 0, 0, 0]) rotate([right_angle ? 90 : 0, 0, 0])
translate_z(depth / 2) translate_z(depth / 2)