diff --git a/readme.md b/readme.md index dac6920..7c5ffd7 100644 --- a/readme.md +++ b/readme.md @@ -2677,7 +2677,7 @@ Pin headers and sockets, etc. |:--- |:--- | | `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 | -| `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_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 | diff --git a/tests/pin_headers.scad b/tests/pin_headers.scad index 9639c08..e9d107d 100644 --- a/tests/pin_headers.scad +++ b/tests/pin_headers.scad @@ -64,8 +64,9 @@ module pin_headers() { pin_socket(pin_headers[$i], 3, 3, right_angle = true); } - for(i = [0, 1], p = [5, 2][i], j = [0 , 1]) { - h = [jst_ph_header, jst_xh_header][j]; + headers = [jst_zh_header, jst_ph_header, jst_xh_header]; + for(i = [0, 1], p = [5, 2][i], j = [0 : len(headers) - 1]) { + h = headers[j]; translate([-20 * (i + 1), 0 + j * 40]) jst_xh_header(h, p); diff --git a/tests/png/pin_headers.png b/tests/png/pin_headers.png index f451af3..4bd6bca 100644 Binary files a/tests/png/pin_headers.png and b/tests/png/pin_headers.png differ diff --git a/vitamins/pin_header.scad b/vitamins/pin_header.scad index f12a383..d2d1d42 100644 --- a/vitamins/pin_header.scad +++ b/vitamins/pin_header.scad @@ -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); pin_colour = pin_colour ? pin_colour : hdr_pin_colour(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) 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); horizontalPinLength = hdr_pin_length(type) - hdr_pin_below(type) + ra_box_offset; translate([pitch * (x - (pin_count - 1) / 2), 0]) { - pin(type, verticalPinLength); + translate_z(below) + pin(type, verticalPinLength - below); if(right_angle) { translate([0, -pinWidth / 2, ra_z - pinWidth / 2 + y_offset]) diff --git a/vitamins/pin_headers.scad b/vitamins/pin_headers.scad index adf9b93..0081c34 100644 --- a/vitamins/pin_headers.scad +++ b/vitamins/pin_headers.scad @@ -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_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 ];