diff --git a/libtest.png b/libtest.png index c779512..1341670 100644 Binary files a/libtest.png and b/libtest.png differ diff --git a/readme.md b/readme.md index 35d4695..9888c3c 100644 --- a/readme.md +++ b/readme.md @@ -3010,6 +3010,7 @@ Threaded pillars. Each end can be male or female. | Function | Description | |:--- |:--- | | `pillar_bot_thread(type)` | Bottom thread length, + for male, - for female | +| `pillar_chamfered(type)` | True if pillar is chamfered | | `pillar_height(type)` | Body height | | `pillar_i_colour(type)` | Colour of the inner part | | `pillar_id(type)` | Inner diameter of metal part | diff --git a/tests/PCBs.scad b/tests/PCBs.scad index 23856fa..7c6009b 100644 --- a/tests/PCBs.scad +++ b/tests/PCBs.scad @@ -50,4 +50,5 @@ module pcbs() { pcb(p); } if($preview) - pcbs(); + let($show_threads = false) + pcbs(); diff --git a/tests/png/d_connectors.png b/tests/png/d_connectors.png index b0e1042..ef0ee32 100644 Binary files a/tests/png/d_connectors.png and b/tests/png/d_connectors.png differ diff --git a/tests/png/pcbs.png b/tests/png/pcbs.png index 76563fd..3eee1fc 100644 Binary files a/tests/png/pcbs.png and b/tests/png/pcbs.png differ diff --git a/tests/png/pillars.png b/tests/png/pillars.png index 675fe63..1e75035 100644 Binary files a/tests/png/pillars.png and b/tests/png/pillars.png differ diff --git a/vitamins/d_connector.scad b/vitamins/d_connector.scad index fa29ca8..2add7ac 100644 --- a/vitamins/d_connector.scad +++ b/vitamins/d_connector.scad @@ -23,6 +23,7 @@ include <../utils/core/core.scad> use <../utils/thread.scad> use <../utils/pcb_utils.scad> +use d_pillar_colour = grey(90); d_plug_shell_colour = grey(80); @@ -62,17 +63,13 @@ module d_pillar() { //! Draw a pillar for a D-connector color(d_pillar_colour) cylinder(d = screw, h = screw_length + 1); - color(d_pillar_colour) { - linear_extrude(height) - difference() { - circle(r = rad, $fn = 6); - circle(d = screw); - } - } - if(show_threads) - female_metric_thread(screw, pitch, height, false, colour = d_pillar_colour); + draw_nut(rad * 2, screw, height, pitch, d_pillar_colour, show_threads); + + color(d_pillar_colour) + cylinder(d = screw + eps, h = 1); } + module d_plug_D(length, width, rad) { //! D plug D shape d = width / 2 - rad; offset = d * sin(10); diff --git a/vitamins/pillar.scad b/vitamins/pillar.scad index c6c6961..97bafba 100644 --- a/vitamins/pillar.scad +++ b/vitamins/pillar.scad @@ -22,6 +22,7 @@ // include <../utils/core/core.scad> use <../utils/thread.scad> +use function pillar_name(type) = type[1]; //! Name of part function pillar_thread(type) = type[2]; //! Thread diameter @@ -34,6 +35,7 @@ function pillar_o_colour(type) = type[8]; //! Colour of the outer part function pillar_i_colour(type) = type[9]; //! Colour of the inner part function pillar_top_thread(type) = type[10]; //! Top thread length, + for male, - for female function pillar_bot_thread(type) = type[11]; //! Bottom thread length, + for male, - for female +function pillar_chamfered(type) = type[12]; //! True if pillar is chamfered module pillar(type) { //! Draw specified pillar function sex(thread) = thread > 0 ? "M" : "F"; @@ -67,12 +69,15 @@ module pillar(type) { //! Draw specified pillar color(thread_colour) cylinder(h = top_thread_l, d = thread_d); - color(pillar_i_colour(type)) { - linear_extrude(height) - difference() { - circle(d = pillar_id(type), $fn = fn(pillar_ifn(type))); - circle(d = thread_d); - } + color(thread_colour) { + if(pillar_chamfered(type)) + draw_nut(pillar_id(type), thread_d, height, 0, thread_colour, false); + else + linear_extrude(height) + difference() { + circle(d = pillar_id(type), $fn = fn(pillar_ifn(type))); + circle(d = thread_d); + } top = height + min(top_thread_l, 0); bot = -min(bot_thread_l, 0); @@ -85,10 +90,10 @@ module pillar(type) { //! Draw specified pillar if(top_thread_l < 0) translate_z(height) vflip() - female_metric_thread(thread_d, pitch, -top_thread_l, false, colour = thread_colour); + female_metric_thread(thread_d, pitch, -top_thread_l, bot = 1, false, colour = thread_colour); if(bot_thread_l < 0) - female_metric_thread(thread_d, pitch, -bot_thread_l, false, colour = thread_colour); + female_metric_thread(thread_d, pitch, -bot_thread_l, false, bot = 1, colour = thread_colour); } if(pillar_od(type) > pillar_id(type)) diff --git a/vitamins/pillars.scad b/vitamins/pillars.scad index 9ec9098..89682e6 100644 --- a/vitamins/pillars.scad +++ b/vitamins/pillars.scad @@ -20,23 +20,23 @@ // // Nylon pillars // -// n t h o i o i o i b t -// a h e d d f f -// m r i n n c c t t -// e e g o o h h -// a h l l r r -// d t o o e e -// u u a a -// d r r d d -// -M2x16_brass_pillar = ["M2x16_brass_pillar", "nurled", 2, 16, 3.17, 3.17, 0, 0, brass, brass, 3,-3]; -M3x6_hex_pillar = ["M3x6_hex_pillar", "hex", 3, 6, 5/cos(30), 5/cos(30), 6, 6, brass, brass, -5, 6]; -M3x13_hex_pillar = ["M3x13_hex_pillar", "hex", 3, 13, 5/cos(30), 5/cos(30), 6, 6, "silver", silver, -6, 6]; -M3x20_hex_pillar = ["M3x20_hex_pillar", "hex", 3, 20, 5/cos(30), 5/cos(30), 6, 6, "silver", silver, -8, 8]; -M3x20_nylon_pillar = ["M3x20_nylon_pillar", "nylon", 3, 20, 8, 5/cos(30), 0, 6, "white", brass, -6, 6]; -M4x17_nylon_pillar = ["M4x17_nylon_pillar", "nylon", 4, 20, 8, 5/cos(30), 0, 6, "white", brass, -6, 6]; -M3x20_nylon_hex_pillar = ["M3x20_nylon_hex_pillar", "hex nylon", 3, 20, 8/cos(30), 8/cos(30), 6, 6, grey(20), grey(20), -6, 6]; -M3x10_nylon_hex_pillar = ["M3x10_nylon_hex_pillar", "hex nylon", 3, 10,5.5/cos(30),5.5/cos(30),6, 6, grey(20), grey(20), -6, 6]; +// n t h o i o i o i b t c +// a h e d d f f h +// m r i n n c c t t a +// e e g o o h h m +// a h l l r r f +// d t o o e e e +// u u a a r +// d r r d d e +// d +M2x16_brass_pillar = ["M2x16_brass_pillar", "nurled", 2, 16, 3.17, 3.17, 0, 0, brass, brass, 3,-3, false]; +M3x6_hex_pillar = ["M3x6_hex_pillar", "hex", 3, 6, 5/cos(30), 5/cos(30), 6, 6, brass, brass, -5, 6, true]; +M3x13_hex_pillar = ["M3x13_hex_pillar", "hex", 3, 13, 5/cos(30), 5/cos(30), 6, 6, "silver", silver, -6, 6, true]; +M3x20_hex_pillar = ["M3x20_hex_pillar", "hex", 3, 20, 5/cos(30), 5/cos(30), 6, 6, "silver", silver, -8, 8, true]; +M3x20_nylon_pillar = ["M3x20_nylon_pillar", "nylon", 3, 20, 8, 5/cos(30), 0, 6, "white", brass, -6, 6, false]; +M4x17_nylon_pillar = ["M4x17_nylon_pillar", "nylon", 4, 20, 8, 5/cos(30), 0, 6, "white", brass, -6, 6, false]; +M3x20_nylon_hex_pillar = ["M3x20_nylon_hex_pillar", "hex nylon", 3, 20, 8/cos(30), 8/cos(30), 6, 6, grey(20), grey(20), -6, 6, false]; +M3x10_nylon_hex_pillar = ["M3x10_nylon_hex_pillar", "hex nylon", 3, 10,5.5/cos(30),5.5/cos(30),6, 6, grey(20), grey(20), -6, 6, false]; pillars = [M2x16_brass_pillar, M3x6_hex_pillar, M3x13_hex_pillar, M3x20_hex_pillar, M3x20_nylon_pillar, M4x17_nylon_pillar, M3x10_nylon_hex_pillar, M3x20_nylon_hex_pillar];