Fixed linked strap parametrization

This commit is contained in:
Dejvino 2021-01-17 16:49:08 +01:00
parent 78e7a2b34a
commit 384480e824

View File

@ -1,14 +1,24 @@
links_count=3; links_count=15;
//validation=1; //validation=1;
VALIDATE_INTERSECTION=1; VALIDATE_INTERSECTION=1;
//xray=1;
use <BOSL/transforms.scad> use <BOSL/transforms.scad>
use <BOSL/shapes.scad> use <BOSL/shapes.scad>
include <BOSL/constants.scad> include <BOSL/constants.scad>
function get_link_segment_size() = [10, 20, 5]; function get_link_segment_size() = [15, 30, 5];
function get_link_pin_diameter() = 2; function get_link_pin_diameter() = 2;
function get_link_socket_slack() = [1, 4, 1];
echo("===============================");
echo(str("Strap length: ", (links_count * get_link_segment_size().x), " mm"));
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() {
segment_size=get_link_segment_size(); segment_size=get_link_segment_size();
@ -18,21 +28,26 @@ module link() {
back(h/2) xrot(90) cylinder(h=h, d=d, $fn=$preview ? 10 : 30); back(h/2) xrot(90) cylinder(h=h, d=d, $fn=$preview ? 10 : 30);
} }
module pin_socket_area() { module pin_socket_area() {
h=segment_size.y-3; h=segment_size.y-get_link_socket_slack().y;
d=segment_size.z; d=segment_size.z;
back(h/2) xrot(90) cylinder(h=h, d=d, $fn=$preview ? 10 : 30); back(h/2) xrot(90) cylinder(h=h, d=d, $fn=$preview ? 10 : 30);
} }
module pin_socket() { module pin_socket() {
difference() { difference() {
pin_socket_area(); pin_socket_area();
scale(1.1) pin(); 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() { module joiner() {
gap=2; gap=2;
arm_size=[8, 3, segment_size.z];
module arm() { module arm() {
arm_size=[segment_size.x*0.9, 2, segment_size.z]; 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);
fwd(segment_size.y/2) right(segment_size.x/4) cuboid(arm_size, fillet=1, edges=EDGES_FRONT + EDGES_Y_ALL);
} }
module armFront() { module armFront() {
arm(); arm();
@ -41,15 +56,15 @@ module link() {
scale([1, -1, 1]) arm(); scale([1, -1, 1]) arm();
} }
module armJoiner() { module armJoiner() {
joiner_size=[4, segment_size.y, segment_size.z]; joiner_size=[arm_size.x*0.48, segment_size.y, segment_size.z];
right(segment_size.x/2) cuboid(joiner_size, fillet=1, edges=EDGES_Z_ALL + EDGES_BOTTOM); right(joiner_size.x + 1) cuboid(joiner_size, fillet=1, edges=EDGES_Z_ALL + EDGES_BOTTOM);
} }
module socketJoiner() { module socketJoiner() {
joiner_size=[segment_size.x-4, joiner_size=[segment_size.x-4,
segment_size.y-4, segment_size.y-4,
segment_size.z]; segment_size.z];
difference() { difference() {
right(segment_size.x/2 + 2.5) cuboid(joiner_size, fillet=1, edges=EDGES_Z_ALL + EDGES_BOTTOM); right(joiner_size.x/2 + 4.5) cuboid(joiner_size, fillet=1, edges=EDGES_Z_ALL + EDGES_BOTTOM);
right(segment_size.x) scale([1, 2, 1]) pin_socket_area(); right(segment_size.x) scale([1, 2, 1]) pin_socket_area();
} }
} }
@ -76,6 +91,13 @@ if (!is_undef(validation)) {
right(2*segment_size.x) link(); right(2*segment_size.x) link();
} }
} }
} else if (!is_undef(xray)) {
intersection() {
cube([1000, 1000, 1000]);
for (i = [0:links_count-1]) {
right(i*segment_size.x) link();
}
}
} else { } else {
for (i = [0:links_count-1]) { for (i = [0:links_count-1]) {
right(i*segment_size.x) link(); right(i*segment_size.x) link();