1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-02-19 23:24:39 +01:00
This commit is contained in:
Justin Lin 2019-09-18 17:36:52 +08:00
parent 25366f54e6
commit e572b6bf1f

View File

@ -0,0 +1,58 @@
module connector_peg(shaft_r = 2.5, spacing = 0.5, void = false, heads = false) {
lip_r = shaft_r * 1.2;
height = shaft_r * 2.6;
r_diff = lip_r - shaft_r;
h_unit = height / 7;
d_h_unit = h_unit * 2;
half_h_unit = h_unit / 2;
module base(shaft_r, lip_r) {
linear_extrude(height)
circle(shaft_r);
translate([0, 0, height])
rotate_extrude() {
translate([0, -d_h_unit]) hull() {
square([lip_r - r_diff, d_h_unit]);
translate([0, half_h_unit])
square([lip_r, half_h_unit]);
}
}
}
module peg() {
difference() {
base(shaft_r, lip_r);
translate([0, 0, d_h_unit])
linear_extrude(height - r_diff * 2)
square([r_diff * 2, lip_r * 2], center = true);
}
}
module peg_void() {
base(shaft_r + spacing, lip_r + spacing);
translate([0, 0, height])
linear_extrude(spacing)
circle(lip_r);
}
module head() {
if(void) {
peg_void();
}
else {
peg();
}
}
if(heads) {
translate([0, 0, height]) {
head();
mirror([0, 0, 1]) head();
}
}
else {
head();
}
}