Works very well now

This commit is contained in:
Matthias Neeracher 2024-09-01 00:51:10 +03:00
parent 93cd7de90b
commit e27e31d3c2
2 changed files with 63 additions and 32 deletions

View File

@ -6,48 +6,79 @@
$fn = $preview ? 32 : 64; $fn = $preview ? 32 : 64;
module _top_post(thickness, axis, ridge, funnel, tol) { // Thickness of walls
overlap = ridge+tol; thickness = 3.0; // [2:5:.5]
dia = 2*thickness+axis;
f_diag = (axis+2*funnel)/sqrt(2); // Diameter of axle
axle = 2.5; // [2:5:.5]
// Clearance above bottom
clearance = 3; // [0:10:1]
// Width of latch
width = 10; // [5:50:1]
// Length of latch
length = 20; // [5:100:1]
/* Other parameters - tune if necessary */
// Tolerance of parts
tolerance = .2; // [0:1:.1]
module _top_post(THICK, AXLE, CLEAR, TOL) {
dia = 2*THICK+AXLE;
center = AXLE/2+CLEAR;
f_diag = (2*AXLE)/sqrt(2);
difference() { difference() {
union() { union() {
translate([0, -dia/2, 0]) cube([thickness, dia, dia/2+overlap]); translate([0, -dia/2, 0]) cube([THICK, dia, AXLE/2+CLEAR]);
translate([thickness, 0, dia/2+overlap]) rotate([0, -90, 0]) cylinder(h=thickness, d=dia); translate([THICK, 0, center]) rotate([0, -90, 0]) cylinder(h=THICK, d=dia);
} }
translate([thickness, 0, dia/2+overlap]) rotate([0, -90, 0]) cylinder(h=thickness, d=axis+tol); translate([THICK, 0, center]) rotate([0, -90, 0]) cylinder(h=THICK, d=AXLE+TOL);
translate([0, 0, dia/2-axis/2+overlap]) cube([thickness, dia/2, axis]); translate([0, AXLE/2, CLEAR]) rotate([90, 0, 90]) linear_extrude(THICK) polygon([[0, TOL/2], [0, AXLE-TOL/2], [dia/2, 1.5*AXLE], [dia/2, -0.5*AXLE]]);
translate([0, dia/2, dia/2+overlap+tol]) rotate([-45, 0, 0]) translate([0, -f_diag/2, -f_diag/2]) cube([thickness, f_diag, f_diag]); translate([0, 0, CLEAR+TOL]) cube([THICK, AXLE/2, AXLE-2*TOL]);
translate([0, -dia, -dia]) cube([THICK, dia, dia]);
} }
} }
module latch_top(spacing=10, thickness=3, axis=2.5, ridge=.7, funnel=.7, tol=.2) { module latch_top(WIDTH=width, THICK=thickness, AXLE=axle, CLEAR=clearance, TOL=tolerance) {
translate([spacing/2, 0, 0]) _top_post(thickness, axis, ridge, funnel, tol); translate([WIDTH/2+TOL, 0, 0]) _top_post(THICK, AXLE, CLEAR, TOL);
translate([-spacing/2-thickness, 0, 0]) _top_post(thickness, axis, ridge, funnel, tol); translate([-WIDTH/2-THICK-TOL, 0, 0]) _top_post(THICK, AXLE, CLEAR, TOL);
} }
module latch_tongue(length=20, width=10, thickness=3, axis=2.5, ridge=.7, tol=.2) { module latch_tongue(LENGTH=length, WIDTH=width, THICK=thickness, AXLE=axle, TOL=tolerance) {
overlap = ridge+thickness; angle = 50;
translate([width+thickness, 0, thickness/2]) rotate([0, -90, 0]) cylinder(h=width+2*thickness, d=axis); mid = THICK/2;
translate([0, 0, THICK]) linear_extrude(WIDTH) {
hull() { hull() {
translate([width-tol, 0, thickness/2]) rotate([0, -90, 0]) cylinder(h=width-tol, d=thickness); translate([mid, 0]) circle(d=THICK);
translate([width-tol, length+thickness-.5, .5]) rotate([0, -90, 0]) cylinder(h=width-tol, d=1); translate([AXLE/2+THICK, 0]) circle(d=AXLE);
translate([0, thickness/2, thickness/2]) cube([width-tol, length+thickness/2, thickness/2]);
} }
translate([0, length, thickness]) cube([width-tol, thickness, overlap+ridge-.5]);
hull() { hull() {
translate([width-tol, length, thickness+overlap+ridge/2]) rotate([0, -90, 0]) cylinder(h=width-tol, d=ridge); translate([mid, 0]) circle(d=THICK);
translate([width-tol, length+thickness-.5, thickness+overlap+ridge-.5]) rotate([0, -90, 0]) cylinder(h=width-tol, d=1); translate([mid, -LENGTH-3*AXLE]) circle(d=THICK);
} }
difference() {
translate([AXLE/2+THICK, -LENGTH+AXLE/2]) circle(d=2*THICK+AXLE);
translate([AXLE/2+THICK, -LENGTH+AXLE/2]) circle(d=AXLE+TOL);
translate([THICK, -LENGTH+AXLE/2]) square([AXLE, THICK]);
translate([AXLE/2+THICK, -LENGTH+AXLE/2]) rotate(-angle) translate([-50, 0]) square(100, 100);
}
translate([AXLE/2+THICK+sin(angle)*(AXLE+THICK)/2, -LENGTH+AXLE/2-cos(angle)*(AXLE+THICK)/2]) circle(d=THICK);
}
translate([AXLE/2+THICK, 0]) cylinder(h=WIDTH+2*THICK, d=AXLE);
} }
module latch_catch(width=10, thickness=3, axis=2.5, ridge=.7, tol=.2) { module latch_catch(WIDTH=width, THICK=thickness, AXLE=axle, CLEAR=clearance, TOL=tolerance) {
overlap = ridge; center = AXLE/2+CLEAR;
translate([-width/2, 0, 0]) cube([width-tol, thickness, (thickness+ridge)/2+overlap]); translate([WIDTH/2+THICK+TOL, AXLE/2, center]) rotate([0, -90, 0]) cylinder(h=WIDTH+2*THICK+2*TOL, d=AXLE);
translate([width/2-tol, 0, thickness/2+overlap]) rotate([0, -90, 0]) cylinder(h=width-tol, d=ridge); translate([WIDTH/2+TOL, 0, 0]) cube([THICK, AXLE, center]);
translate([-WIDTH/2-THICK-TOL, 0, 0]) cube([THICK, AXLE, center]);
} }
translate([-8, -20, 0]) cube([16, 24.25, 3]); translate([0, 0, 8.2]) rotate([0, 90, 0]) {
translate([0, 0, 3]) latch_top(); translate([-8.2, -20, 0]) cube([16.4, 24.25, 3]);
translate([20, 0, 0]) mirror([0, 1, 0]) latch_tongue(); translate([0, 0, 3]) latch_top();
translate([0, -20, 3]) latch_catch(); translate([0, -20, 3]) latch_catch();
}
translate([20, 0, 0]) latch_tongue();

BIN
latch.stl

Binary file not shown.