wobblyhead hg > 3dprints > hinged_box
comparison main.scad @ 4:80122df4a6c5
reinforced latch hook
| author | ark |
|---|---|
| date | 2026-11-16 11:01 +0100 |
| parents | e8b0aed6e3d8 |
| children | fdd022a1bfb1 |
comparison
equal
deleted
inserted
replaced
| 3:a9b270c1da96 | 4:80122df4a6c5 |
|---|---|
| 135 _detent(m) < latch_detent ? _hook_angle(m, hi, n - 1) : _hook_angle(lo, m, n - 1); | 135 _detent(m) < latch_detent ? _hook_angle(m, hi, n - 1) : _hook_angle(lo, m, n - 1); |
| 136 hook_a = _hook_angle(0, 90); | 136 hook_a = _hook_angle(0, 90); |
| 137 plate_t = latch_layers*lh; | 137 plate_t = latch_layers*lh; |
| 138 plate_u = knuckle_u + knuckle_r + 2*cl; | 138 plate_u = knuckle_u + knuckle_r + 2*cl; |
| 139 plate_bz = bar_z - hook_ro - latch_grip; | 139 plate_bz = bar_z - hook_ro - latch_grip; |
| 140 latch_slot = (latch_width - 2*knuckle_gap)/3; | 140 // a latch wider than the hinge span is narrowed to it |
| 141 latch_w = min(latch_width, hinge_span); | |
| 142 latch_slot = (latch_w - 2*knuckle_gap)/3; | |
| 141 // y start of the two outer latch slots | 143 // y start of the two outer latch slots |
| 142 latch_outer_y0 = [-latch_width/2, latch_slot/2 + knuckle_gap]; | 144 latch_outer_y0 = [-latch_w/2, latch_slot/2 + knuckle_gap]; |
| 143 | 145 |
| 144 assert(_detent(90) > latch_detent, "latch_detent too large for the filament bar"); | 146 assert(_detent(90) > latch_detent, "latch_detent too large for the filament bar"); |
| 145 assert(knuckle_l > 2*lw, "hinge knuckles too short, reduce hinge_knuckles"); | 147 assert(knuckle_l > 2*lw, "hinge knuckles too short, reduce hinge_knuckles"); |
| 146 assert(latch_width <= hinge_span, "latch wider than the box front"); | |
| 147 assert(body_ih > 0, "inner height too low for the lid"); | 148 assert(body_ih > 0, "inner height too low for the lid"); |
| 148 assert(chamfer_h <= floor_t, "chamfer higher than the floor"); | 149 assert(chamfer_h <= floor_t, "chamfer higher than the floor"); |
| 149 | 150 |
| 150 // lid sweep over a centred paper stack: radius of the lowest lid ceiling | 151 // lid sweep over a centred paper stack: radius of the lowest lid ceiling |
| 151 // point over the paper minus radius of the paper's front top corner | 152 // point over the paper minus radius of the paper's front top corner |
| 161 echo(str("WARNING: body_ratio ", body_ratio, " leaves the lid too low, using ", | 162 echo(str("WARNING: body_ratio ", body_ratio, " leaves the lid too low, using ", |
| 162 body_ih/inner_height)); | 163 body_ih/inner_height)); |
| 163 echo("body height", seam_z, "mm, lid height", lid_h, "mm, body ratio", body_ih/inner_height); | 164 echo("body height", seam_z, "mm, lid height", lid_h, "mm, body ratio", body_ih/inner_height); |
| 164 echo("pin hole", pin_d, "mm, knuckle diameter", 2*knuckle_r, "mm"); | 165 echo("pin hole", pin_d, "mm, knuckle diameter", 2*knuckle_r, "mm"); |
| 165 echo("hinge knuckle length", knuckle_l, "mm"); | 166 echo("hinge knuckle length", knuckle_l, "mm"); |
| 167 if (latch_w < latch_width) | |
| 168 echo(str("WARNING: latch_width ", latch_width, " is wider than the box front, using ", | |
| 169 latch_w)); | |
| 170 echo("latch width", latch_w, "mm"); | |
| 166 echo("latch plate outer face", plate_u + plate_t, "mm from the front"); | 171 echo("latch plate outer face", plate_u + plate_t, "mm from the front"); |
| 167 echo("latch hook reaches", hook_a, "degrees past the bar bottom, detent", _detent(hook_a), "mm"); | 172 echo("latch hook reaches", hook_a, "degrees past the bar bottom, detent", _detent(hook_a), "mm"); |
| 168 echo("lid sweep clearance over centred paper", sweep_margin, "mm"); | 173 echo("lid sweep clearance over centred paper", sweep_margin, "mm"); |
| 169 | 174 |
| 170 // rounded box outline, inset by d | 175 // rounded box outline, inset by d |
| 203 cylinder(d=pin_d, h=out_y + 2, center=true); | 208 cylinder(d=pin_d, h=out_y + 2, center=true); |
| 204 } | 209 } |
| 205 | 210 |
| 206 module _latch_pin() { | 211 module _latch_pin() { |
| 207 translate([latch_x, 0, latch_z]) rotate([90, 0, 0]) | 212 translate([latch_x, 0, latch_z]) rotate([90, 0, 0]) |
| 208 cylinder(d=pin_d, h=latch_width + 2, center=true); | 213 cylinder(d=pin_d, h=latch_w + 2, center=true); |
| 209 } | 214 } |
| 210 | 215 |
| 211 module _bar_pin() { | 216 module _bar_pin() { |
| 212 translate([latch_x, 0, bar_z]) rotate([90, 0, 0]) | 217 translate([latch_x, 0, bar_z]) rotate([90, 0, 0]) |
| 213 cylinder(d=pin_d, h=latch_width + 2, center=true); | 218 cylinder(d=pin_d, h=latch_w + 2, center=true); |
| 214 } | 219 } |
| 215 | 220 |
| 216 module body() { | 221 module body() { |
| 217 // knuckle at height z with a web down to the wall up to z1, chamfered | 222 // knuckle at height z with a web down to the wall up to z1, chamfered |
| 218 // below for printing | 223 // below for printing |
| 285 } | 290 } |
| 286 | 291 |
| 287 // in assembly position, closed | 292 // in assembly position, closed |
| 288 module latch() { | 293 module latch() { |
| 289 // hook around the bar, from the plate side down under the bar and | 294 // hook around the bar, from the plate side down under the bar and |
| 290 // hook_a degrees up its wall side | 295 // hook_a degrees up its wall side. its back is filled with a web down |
| 296 // to the plate, sloped like the knuckle webs. a web reaching closer | |
| 297 // than 2 extrusions to the grip edge is cut off there, but never above | |
| 298 // the bottom of the hook | |
| 291 module _hook() { | 299 module _hook() { |
| 292 tip_a = 270 - hook_a; | 300 tip_a = 270 - hook_a; |
| 301 web_z = bar_z - hook_ro - (plate_u - knuckle_u); | |
| 302 cut_z = min(plate_bz + 2*lw, bar_z - hook_ro); | |
| 293 difference() { | 303 difference() { |
| 294 hull() { | 304 intersection() { |
| 295 translate([knuckle_u, bar_z]) circle(r=hook_ro); | 305 hull() { |
| 296 translate([knuckle_u, bar_z - hook_ro]) | 306 translate([knuckle_u, bar_z]) circle(r=hook_ro); |
| 297 square([plate_u - knuckle_u + epsilon, hook_ro]); | 307 translate([plate_u, web_z]) square([epsilon, bar_z - web_z]); |
| 308 } | |
| 309 translate([0, cut_z]) square([plate_u + epsilon, bar_z - cut_z]); | |
| 298 } | 310 } |
| 299 translate([knuckle_u, bar_z]) circle(r=hook_ri); | 311 translate([knuckle_u, bar_z]) circle(r=hook_ri); |
| 300 // open wedge over the top and the wall side of the bar | 312 // open wedge over the top and the wall side of the bar |
| 301 translate([knuckle_u, bar_z]) | 313 translate([knuckle_u, bar_z]) |
| 302 polygon(concat([[0, 0]], | 314 polygon(concat([[0, 0]], |
| 305 } | 317 } |
| 306 } | 318 } |
| 307 | 319 |
| 308 difference() { | 320 difference() { |
| 309 _front() union() { | 321 _front() union() { |
| 310 _yslab(-latch_width/2, latch_width/2) | 322 _yslab(-latch_w/2, latch_w/2) |
| 311 translate([plate_u, plate_bz]) square([plate_t, latch_z - plate_bz]); | 323 translate([plate_u, plate_bz]) square([plate_t, latch_z - plate_bz]); |
| 312 _yslab(-latch_slot/2, latch_slot/2) { | 324 _yslab(-latch_slot/2, latch_slot/2) { |
| 313 hull() { | 325 hull() { |
| 314 translate([knuckle_u, latch_z]) circle(r=knuckle_r); | 326 translate([knuckle_u, latch_z]) circle(r=knuckle_r); |
| 315 translate([plate_u, latch_z - knuckle_r]) square([plate_t, knuckle_r]); | 327 translate([plate_u, latch_z - knuckle_r]) square([plate_t, knuckle_r]); |
| 336 | 348 |
| 337 module _assembly() { | 349 module _assembly() { |
| 338 color("steelblue") body(); | 350 color("steelblue") body(); |
| 339 if (preview_hardware && $preview) { | 351 if (preview_hardware && $preview) { |
| 340 _filament(hinge_x, seam_z, hinge_span); | 352 _filament(hinge_x, seam_z, hinge_span); |
| 341 _filament(latch_x, bar_z, latch_width); | 353 _filament(latch_x, bar_z, latch_w); |
| 342 } | 354 } |
| 343 translate([hinge_x, 0, seam_z]) rotate([0, preview_lid_angle, 0]) | 355 translate([hinge_x, 0, seam_z]) rotate([0, preview_lid_angle, 0]) |
| 344 translate([-hinge_x, 0, -seam_z]) { | 356 translate([-hinge_x, 0, -seam_z]) { |
| 345 color("lightsteelblue") lid(); | 357 color("lightsteelblue") lid(); |
| 346 if (preview_hardware && $preview) _filament(latch_x, latch_z, latch_width); | 358 if (preview_hardware && $preview) _filament(latch_x, latch_z, latch_w); |
| 347 translate([latch_x, 0, latch_z]) rotate([0, preview_latch_angle, 0]) | 359 translate([latch_x, 0, latch_z]) rotate([0, preview_latch_angle, 0]) |
| 348 translate([-latch_x, 0, -latch_z]) color("orange") latch(); | 360 translate([-latch_x, 0, -latch_z]) color("orange") latch(); |
| 349 } | 361 } |
| 350 if (preview_paper && $preview) _paper(); | 362 if (preview_paper && $preview) _paper(); |
| 351 } | 363 } |
