wc-licht/3d/lock/lock_0.3.scad
2023-11-29 23:44:31 +01:00

156 lines
3.5 KiB
OpenSCAD

render_lock = true;
render_wings = false;
d = 4; // Thickness (button/wall distance)
btn_s = 6; // Button (edge) size
btn_dist = 34; // Button distance from floor
btn_d = 3.2; // Button depth
hub = 1.5; // Button hub
h = btn_dist+btn_s+1.4+2;
fil = 0.32; // Filament thickness
l_d = 24; // Ledge size
l_thick = fil*4; // Ledge thickness
foot_s = 34; // Foot size
w_t = fil*4; // Wing thickness
w_h = 8; // Wing height
w_l = 4; // Wing length (per wing)
w_notch = 1; // Notch depth
module ring(dia, thickness, w) {
translate([0, w, 0]) rotate ([90, 0, 0])
difference() {
cylinder(w, dia, dia, $fn=128);
translate([0, 0, -0.1])
cylinder(w+0.2, dia-thickness, dia-thickness, $fn=128);
}
}
if (render_lock) {
rotate([90, 0, 0]) {
/* Base */
//difference() {
translate([0, 0, foot_s/2])
cube([d, btn_s, h-foot_s/2]);
// Wing notch cut-out
//translate([-0.4, btn_s-w_notch-0.4, btn_dist-w_h*2+w_t-0.2])
// cube([w_t+0.8, w_notch+0.5, w_h/2+0.8]);
//}
/* Top clamp */
translate([d, 0, h-fil*4])
cube([btn_d, btn_s, fil*4]);
/* Bottom clamp */
translate([d, 0, h-btn_s-(fil*4*2)-0.4])
cube([btn_d, btn_s, fil*4]);
/* Notch */
notch = fil*4;
translate([0, 0, h-btn_s+btn_s/4-fil*4-0.2])
difference() {
cube([d, btn_s+notch, btn_s/2]);
translate([-0.1, 0.1, 4*fil])
cube([d-4*fil+0.1, btn_s+notch+0.2, btn_s/2-8*fil]);
}
/* Angel wing clamp */
/*
translate([d, 0, btn_dist-w_h*2]) {
cube([w_t+0.6, btn_s, fil*4]);
translate([w_t+0.6, 0, 0])
cube([fil*4, btn_s, w_h]);
}
*/
/* Wire clamp */
/*
w_s = 1.2;
translate([d, 0, btn_dist-10-w_s]) {
cube([w_s, btn_s/2, fil*4]);
translate([w_s, 0, 0])
cube([fil*4, btn_s/2, 10]);
}
*/
/* Ledge */
translate([d+btn_d+hub+0.2, 0, h-42+l_thick])
intersection() {
translate([42, 0, 42])
ring(42, l_thick, btn_s);
cube([8, 42, 42]);
}
// Extension
ext = 2;
translate([0, 0, h+l_thick])
cube([l_thick, btn_s, ext]);
translate([d+btn_d+hub+0.2, 0, h+l_thick])
cube([l_thick, btn_s, ext]);
translate([0, 0, h])
difference() {
cube([l_thick*2, btn_s, l_thick]);
translate([l_thick*2, -0.1, l_thick]) rotate([-90, 0, 0])
cylinder(btn_s+0.2, l_thick, l_thick, $fn=64);
}
translate([(d+btn_d+hub+l_thick+0.2)/2, 0, h+l_thick+ext])
intersection() {
ring((d+btn_d+hub+l_thick+0.2)/2, l_thick, btn_s);
translate([-10, 0, 0])
cube([20, 10, 10]);
}
/* Foot */
translate([foot_s, 0, foot_s/2])
intersection() {
ring(foot_s, d, btn_s);
translate([-foot_s, -0.1, -foot_s])
cube([foot_s-12, btn_s+0.2, foot_s]);
}
}
} // endif (render_lock)
/* Angel wings */
if (render_wings) {
translate([-20, 0, 0]) {
// Middle piece
translate([0, -0.2, 0])
cube([w_t, btn_s+0.4, w_h]);
// Middle
translate([0, -w_t-0.2, 0])
cube([d+w_t, w_t, w_h]);
translate([0, btn_s+0.2, 0])
cube([d+w_t, w_t, w_h]);
// Notch
translate([d, -0.2, 0])
cube([w_t, w_notch, w_h/2]);
// Wings
translate([d, -w_l-w_t-0.2, 0])
cube([w_t, w_l, w_h]);
translate([d, btn_s+w_t+0.2, 0])
cube([w_t, w_l, w_h]);
// Wire clamps
wire = 1.2;
translate([d-w_t-wire, -w_l-w_t-0.2, 0])
cube([w_t, w_l-wire, w_h/2]);
translate([d-wire, -w_l-w_t-0.2, 0])
cube([wire, w_t, w_h/2]);
translate([d-w_t-wire, btn_s+w_t+0.2+wire, 0])
cube([w_t, w_l-wire, w_h/2]);
translate([d-wire, btn_s+w_t+w_l+0.2-w_t])
cube([wire, w_t, w_h/2]);
}
} // endif (render_wings)