130 lines
4.2 KiB
OpenSCAD
130 lines
4.2 KiB
OpenSCAD
links_count=6;
|
|
include_terminal=true;
|
|
|
|
//validation=1;
|
|
VALIDATE_INTERSECTION=1;
|
|
|
|
//xray=1;
|
|
|
|
use <BOSL/transforms.scad>
|
|
use <BOSL/shapes.scad>
|
|
include <BOSL/constants.scad>
|
|
|
|
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"));
|
|
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) {
|
|
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);
|
|
}
|
|
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;
|
|
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() {
|
|
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() {
|
|
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();
|
|
}
|
|
}
|
|
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();
|
|
joiner();
|
|
if (!terminal) {
|
|
right(segment_size.x) pin_socket();
|
|
}
|
|
}
|
|
|
|
segment_size=get_link_segment_size();
|
|
if (!is_undef(validation)) {
|
|
if (validation==VALIDATE_INTERSECTION) {
|
|
intersection() {
|
|
right(0*segment_size.x) link();
|
|
right(1*segment_size.x) link();
|
|
}
|
|
intersection() {
|
|
right(1*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 {
|
|
for (i = [0:links_count-1]) {
|
|
terminal=(i==links_count-1) && include_terminal;
|
|
right(i*segment_size.x) link(terminal=terminal);
|
|
}
|
|
}
|
|
|