1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-01-17 21:48:43 +01:00

Added crude representation of JST ZH connectors.

This commit is contained in:
Chris Palmer 2021-08-31 22:25:31 +01:00
parent 1045502efb
commit 540f841163
5 changed files with 9 additions and 5 deletions

View File

@ -2677,7 +2677,7 @@ Pin headers and sockets, etc.
|:--- |:--- | |:--- |:--- |
| `box_header(type, cols = 1, rows = 1, smt = false, cutout = false)` | Draw box header | | `box_header(type, cols = 1, rows = 1, smt = false, cutout = false)` | Draw box header |
| `idc_transition(type, cols = 5, skip = [], cutout = false)` | Draw IDC transition header | | `idc_transition(type, cols = 5, skip = [], cutout = false)` | Draw IDC transition header |
| `jst_xh_header(type, pin_count, right_angle = false, colour = false, pin_colour = false)` | Draw JST XH connector | | `jst_xh_header(type, pin_count, right_angle = false, colour = false, pin_colour = false, smt = false)` | Draw JST XH connector |
| `pin(type, length = undef)` | Draw a header pin | | `pin(type, length = undef)` | Draw a header pin |
| `pin_header(type, cols = 1, rows = 1, smt = false, right_angle = false, cutout = false, colour)` | Draw pin header | | `pin_header(type, cols = 1, rows = 1, smt = false, right_angle = false, cutout = false, colour)` | Draw pin header |
| `pin_socket(type, cols = 1, rows = 1, right_angle = false, height = 0, smt = false, cutout = false, colour)` | Draw pin socket | | `pin_socket(type, cols = 1, rows = 1, right_angle = false, height = 0, smt = false, cutout = false, colour)` | Draw pin socket |

View File

@ -64,8 +64,9 @@ module pin_headers() {
pin_socket(pin_headers[$i], 3, 3, right_angle = true); pin_socket(pin_headers[$i], 3, 3, right_angle = true);
} }
for(i = [0, 1], p = [5, 2][i], j = [0 , 1]) { headers = [jst_zh_header, jst_ph_header, jst_xh_header];
h = [jst_ph_header, jst_xh_header][j]; for(i = [0, 1], p = [5, 2][i], j = [0 : len(headers) - 1]) {
h = headers[j];
translate([-20 * (i + 1), 0 + j * 40]) translate([-20 * (i + 1), 0 + j * 40])
jst_xh_header(h, p); jst_xh_header(h, p);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 KiB

After

Width:  |  Height:  |  Size: 146 KiB

View File

@ -229,7 +229,7 @@ module pin_socket(type, cols = 1, rows = 1, right_angle = false, height = 0, smt
} }
} }
module jst_xh_header(type, pin_count, right_angle = false, colour = false, pin_colour = false) { //! Draw JST XH connector module jst_xh_header(type, pin_count, right_angle = false, colour = false, pin_colour = false, smt = false) { //! Draw JST XH connector
colour = colour ? colour : hdr_base_colour(type); colour = colour ? colour : hdr_base_colour(type);
pin_colour = pin_colour ? pin_colour : hdr_pin_colour(type); pin_colour = pin_colour ? pin_colour : hdr_pin_colour(type);
pitch = hdr_pitch(type); pitch = hdr_pitch(type);
@ -306,10 +306,12 @@ module jst_xh_header(type, pin_count, right_angle = false, colour = false, pin_c
color(pin_colour) color(pin_colour)
for(x = [0 : pin_count - 1]) { for(x = [0 : pin_count - 1]) {
below = !smt ? 0 : hdr_pin_below(type);
verticalPinLength = right_angle ? hdr_pin_below(type) + ra_z + y_offset : hdr_pin_length(type); verticalPinLength = right_angle ? hdr_pin_below(type) + ra_z + y_offset : hdr_pin_length(type);
horizontalPinLength = hdr_pin_length(type) - hdr_pin_below(type) + ra_box_offset; horizontalPinLength = hdr_pin_length(type) - hdr_pin_below(type) + ra_box_offset;
translate([pitch * (x - (pin_count - 1) / 2), 0]) { translate([pitch * (x - (pin_count - 1) / 2), 0]) {
pin(type, verticalPinLength); translate_z(below)
pin(type, verticalPinLength - below);
if(right_angle) { if(right_angle) {
translate([0, -pinWidth / 2, ra_z - pinWidth / 2 + y_offset]) translate([0, -pinWidth / 2, ra_z - pinWidth / 2 + y_offset])

View File

@ -29,6 +29,7 @@
jst_xh_header = ["jst_xh_header",2.5, 10, 3.4, 0.64, gold, grey(90), 0, [4.9, 5.75, 7], 0.8, 0.525, 0.6, 6.1]; jst_xh_header = ["jst_xh_header",2.5, 10, 3.4, 0.64, gold, grey(90), 0, [4.9, 5.75, 7], 0.8, 0.525, 0.6, 6.1];
jst_ph_header = ["jst_ph_header",2.0, 9, 3.4, 0.64, silver, grey(90), 0, [3.9, 4.5, 6], 0.6, 0.55, 0.25, 4.8]; jst_ph_header = ["jst_ph_header",2.0, 9, 3.4, 0.64, silver, grey(90), 0, [3.9, 4.5, 6], 0.6, 0.55, 0.25, 4.8];
jst_zh_header = ["jst_zh_header",1.5, 7.4, 3.4, 0.5 , silver, grey(90), 0, [3.0, 3.5,4.5], 0.5, 0.45, 0.25, 3.7];
pin_headers = [ 2p54header ]; pin_headers = [ 2p54header ];