From 61dbc1e75abb8d5132a1df70a2ade3b83abaedff Mon Sep 17 00:00:00 2001 From: Dejvino Date: Sun, 17 Jan 2021 22:33:57 +0100 Subject: [PATCH] Improve linked strap parametrization --- strap_link.scad | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/strap_link.scad b/strap_link.scad index ad7e31c..90a2cf4 100644 --- a/strap_link.scad +++ b/strap_link.scad @@ -1,4 +1,5 @@ -links_count=14; +links_count=6; +include_terminal=true; //validation=1; VALIDATE_INTERSECTION=1; @@ -12,6 +13,10 @@ include function get_link_segment_size() = [15, 30, 5]; function get_link_pin_diameter() = 2; function get_link_socket_slack() = [1, 4, 1]; +function get_link_joiner_arm_size() = [get_link_segment_size().x - 2, 3, segment_size.z]; +function get_link_socket_size() = [get_link_segment_size().z, + get_link_segment_size().y - get_link_joiner_arm_size().y*2, + get_link_segment_size().z]; echo("==============================="); echo(str("Strap length: ", (links_count * get_link_segment_size().x), " mm")); @@ -20,7 +25,7 @@ echo("==============================="); assert(get_link_segment_size().x >= 10, "Link segment is too short."); assert(get_link_segment_size().z >= (get_link_pin_diameter() + get_link_socket_slack().z + 1), "Link segment is too thin."); -module link() { +module link(terminal=false) { segment_size=get_link_segment_size(); module pin() { h=segment_size.y; @@ -45,7 +50,7 @@ module link() { } module joiner() { gap=2; - arm_size=[8, 3, segment_size.z]; + arm_size=get_link_joiner_arm_size(); module arm() { fwd(segment_size.y/2 + arm_size.y/2 - 1) right(arm_size.x/2 - 1) cuboid(arm_size, fillet=1, edges=EDGES_FRONT + EDGES_Y_ALL); } @@ -56,11 +61,11 @@ module link() { scale([1, -1, 1]) arm(); } module armJoiner() { - joiner_size=[arm_size.x*0.48, segment_size.y, segment_size.z]; - right(joiner_size.x + 1) cuboid(joiner_size, fillet=1, edges=EDGES_Z_ALL + EDGES_BOTTOM); + joiner_size=[arm_size.x-get_link_socket_size().x, segment_size.y, segment_size.z]; + right(joiner_size.x/2 + get_link_socket_size().x/2 + gap) cuboid(joiner_size, fillet=1, edges=EDGES_Z_ALL + EDGES_BOTTOM); } module socketJoiner() { - joiner_size=[segment_size.x-4, + joiner_size=[segment_size.x-get_link_socket_size().x+get_link_socket_size().x*0.2, segment_size.y-4, segment_size.z]; difference() { @@ -68,15 +73,32 @@ module link() { right(segment_size.x) scale([1, 2, 1]) pin_socket_area(); } } - socketJoiner(); + module terminalArm() { + left(5) { + shift=arm_size.x - get_link_pin_diameter(); + right(segment_size.x + shift + gap/2) pin(); + right(segment_size.x + gap/2) { + armFront(); + armBack(); + } + right(arm_size.x - get_link_socket_size().x + gap) armJoiner(); + } + } armFront(); armBack(); armJoiner(); + if (terminal) { + terminalArm(); + } else { + socketJoiner(); + } } pin(); - right(segment_size.x) pin_socket(); joiner(); + if (!terminal) { + right(segment_size.x) pin_socket(); + } } segment_size=get_link_segment_size(); @@ -100,7 +122,8 @@ if (!is_undef(validation)) { } } else { for (i = [0:links_count-1]) { - right(i*segment_size.x) link(); + terminal=(i==links_count-1) && include_terminal; + right(i*segment_size.x) link(terminal=terminal); } }