From f17455be4f6b3c4b6264958e03ee296be07ebdd6 Mon Sep 17 00:00:00 2001 From: Dejvino Date: Tue, 19 Jan 2021 14:47:16 +0100 Subject: [PATCH] Improved link strap interoperability --- strap_link.scad | 144 +++++++++++++++++++++++++----------------------- 1 file changed, 76 insertions(+), 68 deletions(-) diff --git a/strap_link.scad b/strap_link.scad index 7001609..14eee30 100644 --- a/strap_link.scad +++ b/strap_link.scad @@ -1,6 +1,6 @@ -links_count=6; // [1..20] +links_count=3; // [1..20] include_terminal=true; // [true,false] -export=3; // [0:6] +export=0; // [0:6] MODEL_DEMO=0; MODEL_LINKS=1; @@ -33,6 +33,7 @@ function get_link_socket_size() = [get_link_segment_size().z, get_link_segment_size().z]; function get_link_clip_size() = [get_link_pin_diameter()*5, get_link_segment_size().y - 5, get_link_segment_size().z]; +function get_link_socket_roundgap() = 2; echo("==============================="); echo(str("Strap length: ", (links_count * get_link_segment_size().x), " mm")); @@ -41,46 +42,68 @@ 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(terminal=false) { +module pin() { segment_size=get_link_segment_size(); - module pin() { - h=segment_size.y; - d=get_link_pin_diameter(); - back(h/2) xrot(90) cylinder(h=h, d=d, $fn=$preview ? 10 : 30); + h=segment_size.y; + d=get_link_pin_diameter(); + back(h/2) xrot(90) cylinder(h=h, d=d, $fn=$preview ? 10 : 30); +} +module pin_socket_area() { + segment_size=get_link_segment_size(); + h=segment_size.y-get_link_socket_slack().y; + d=segment_size.z; + back(h/2) xrot(90) cylinder(h=h, d=d, $fn=$preview ? 10 : 30); +} +module pin_socket() { + difference() { + pin_socket_area(); + scaleup = [ + ((get_link_pin_diameter() + get_link_socket_slack().x) / get_link_pin_diameter()), + ((get_link_pin_diameter() + get_link_socket_slack().y) / get_link_pin_diameter()), + ((get_link_pin_diameter() + get_link_socket_slack().z) / get_link_pin_diameter()) + ]; + scale(scaleup) pin(); } - module pin_socket_area() { - h=segment_size.y-get_link_socket_slack().y; - d=segment_size.z; - back(h/2) xrot(90) cylinder(h=h, d=d, $fn=$preview ? 10 : 30); - } - module pin_socket() { - difference() { - pin_socket_area(); - scaleup = [ - ((get_link_pin_diameter() + get_link_socket_slack().x) / get_link_pin_diameter()), - ((get_link_pin_diameter() + get_link_socket_slack().y) / get_link_pin_diameter()), - ((get_link_pin_diameter() + get_link_socket_slack().z) / get_link_pin_diameter()) - ]; - scale(scaleup) pin(); - } - } - module joiner() { - gap=2; +} + +module arm() { + arm_size=get_link_joiner_arm_size(); + 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); +} +module armFront() { + arm(); +} +module armBack() { + scale([1, -1, 1]) arm(); +} +module armJoiner() { + gap=get_link_socket_roundgap(); + arm_size=get_link_joiner_arm_size(); + 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 link_arms() { + armFront(); + armBack(); + armJoiner(); +} + +module link_connector_pin() { + pin(); + link_arms(); +} + +module link_connector_socket() { + pin_socket(); +} + +module link(terminal=false) { + + module link_joiner() { + gap=get_link_socket_roundgap(); 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); - } - module armFront() { - arm(); - } - module armBack() { - scale([1, -1, 1]) arm(); - } - module armJoiner() { - 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() { + + module pin_to_socket_joiner() { joiner_size=[segment_size.x-get_link_socket_size().x+get_link_socket_size().x*0.2, segment_size.y-4, segment_size.z]; @@ -89,31 +112,16 @@ module link(terminal=false) { right(segment_size.x) scale([1, 2, 1]) pin_socket_area(); } } - 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_to_socket_joiner(); } - pin(); - joiner(); - if (!terminal) { - right(segment_size.x) pin_socket(); + link_connector_pin(); + if (terminal) { + right(segment_size.x + 2) zrot(180) link_connector_pin(); + } else { + link_joiner(); + right(segment_size.x) link_connector_socket(); } } @@ -141,7 +149,7 @@ module clip() { module joiner(groove) { slack=groove?0.5:0; joiner_size=[entry_size.x-6+slack, entry_size.y-6+slack, entry_size.z-4+slack]; - joiner_pos=[entry_pos.x, entry_pos.y, entry_pos.z - entry_size.z/2]; + joiner_pos=[entry_pos.x, entry_pos.y, entry_pos.z - entry_size.z/2 + joiner_size.z/2]; translate(joiner_pos) cube(joiner_size, center=true); } @@ -175,7 +183,7 @@ module clip() { } } -module clip_ratcheting(ratchet_length=30) { +module clip_ratcheting(ratchet_length=28) { socket_size=get_link_socket_size(); clip_size=get_link_clip_size(); pin_diam=get_link_pin_diameter(); @@ -195,10 +203,10 @@ module clip_ratcheting(ratchet_length=30) { } } module hookRight() { - hook(); + right(12.5) zrot(180) link_connector_pin(); } module hookLeft() { - scale([-1, 1, 1]) hook(); + left(12.5) link_connector_pin(); } wall=2; tooth_size=[4, 3, 3]; @@ -296,7 +304,7 @@ module clip_ratcheting(ratchet_length=30) { railBack(); } - if (is_model(MODEL_CLIP_RATCHETING_A) || is_model(MODEL_CLIP_RATCHETING)) { + left(2) if (is_model(MODEL_CLIP_RATCHETING_A) || is_model(MODEL_CLIP_RATCHETING)) { left(ratchet_length + wall + 1) { hookLeft(); left(0.1) { @@ -335,7 +343,7 @@ if (!is_undef(validation)) { left(get_link_clip_size().x) clip(); } if (is_model(MODEL_CLIP_RATCHETING) || is_model(MODEL_CLIP_RATCHETING_A) || is_model(MODEL_CLIP_RATCHETING_B)) { - left(get_link_clip_size().x) clip_ratcheting(); + left(get_link_clip_size().x * 2 + 3) clip_ratcheting(); } if (is_model(MODEL_LINKS)) for (i = [0:links_count-1]) { terminal=(i==links_count-1) && include_terminal;