PinePhoneBoy/src/strap_common.scad

69 lines
1.8 KiB
OpenSCAD
Raw Normal View History

2021-01-20 11:56:26 +00:00
include <export.scad>
use <BOSL/transforms.scad>
use <BOSL/shapes.scad>
include <BOSL/constants.scad>
use <specs_strap.scad>
2021-01-20 14:55:17 +00:00
use <common.scad>
2021-01-20 11:56:26 +00:00
module pin() {
segment_size=get_link_segment_size();
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 arm() {
segment_size=get_link_segment_size();
arm_size=get_link_joiner_arm_size();
2021-01-20 14:55:17 +00:00
fwd(segment_size.y/2 + arm_size.y/2 - 1) right(arm_size.x/2 - 1) cubi(arm_size, fillet=1, edges=EDGES_FRONT + EDGES_Y_ALL);
2021-01-20 11:56:26 +00:00
}
module armFront() {
arm();
}
module armBack() {
scale([1, -1, 1]) arm();
}
module armJoiner() {
gap=get_link_socket_roundgap();
arm_size=get_link_joiner_arm_size();
segment_size=get_link_segment_size();
joiner_size=[arm_size.x-get_link_socket_size().x, segment_size.y, segment_size.z];
2021-01-20 14:55:17 +00:00
right(joiner_size.x/2 + get_link_socket_size().x/2 + gap) cubi(joiner_size, fillet=1, edges=EDGES_Z_ALL + EDGES_BOTTOM);
2021-01-20 11:56:26 +00:00
}
module link_arms() {
2021-01-20 14:55:17 +00:00
$fn=$preview?4:20;
2021-01-20 11:56:26 +00:00
armFront();
armBack();
armJoiner();
}
module link_connector_pin() {
pin();
link_arms();
}
module link_connector_socket() {
pin_socket();
}