wobblyhead hg > 3dprints > hinged_box
comparison main.scad @ 5:fdd022a1bfb1
reworked latch hook reinforcement, now a simple line count
| author | ark |
|---|---|
| date | 2026-11-16 19:26 +0100 |
| parents | 80122df4a6c5 |
| children | f2694e49cec1 |
comparison
equal
deleted
inserted
replaced
| 4:80122df4a6c5 | 5:fdd022a1bfb1 |
|---|---|
| 59 latch_layers = 8; // [4:1:20] | 59 latch_layers = 8; // [4:1:20] |
| 60 // radial overlap the hook tip has to pass at the filament bar. 0 for a free swinging latch | 60 // radial overlap the hook tip has to pass at the filament bar. 0 for a free swinging latch |
| 61 latch_detent = .3; // [0:.05:.7] | 61 latch_detent = .3; // [0:.05:.7] |
| 62 // grip tab length below the hook | 62 // grip tab length below the hook |
| 63 latch_grip = 5; // [0:.5:20] | 63 latch_grip = 5; // [0:.5:20] |
| 64 // hook wall around the filament bar, in extrusions | |
| 65 latch_hook_lines = 3; // [2:1:8] | |
| 64 | 66 |
| 65 /* [print settings] */ | 67 /* [print settings] */ |
| 66 line_width = .4; // [0:.01:1] | 68 line_width = .4; // [0:.01:1] |
| 67 layer_height = .2; // [0:.01:.5] | 69 layer_height = .2; // [0:.01:.5] |
| 68 clearance = .1; // [0:.01:.5] | 70 clearance = .1; // [0:.01:.5] |
| 113 hinge_span = out_y - 2*edge_r; | 115 hinge_span = out_y - 2*edge_r; |
| 114 knuckle_l = (hinge_span - (hinge_knuckles - 1)*knuckle_gap)/hinge_knuckles; | 116 knuckle_l = (hinge_span - (hinge_knuckles - 1)*knuckle_gap)/hinge_knuckles; |
| 115 | 117 |
| 116 // latch. the flap hangs from lid knuckles and its hook wraps around a | 118 // latch. the flap hangs from lid knuckles and its hook wraps around a |
| 117 // filament bar held by body knuckles straight below the flap axis. | 119 // filament bar held by body knuckles straight below the flap axis. |
| 118 // in the front frame u runs outward from the front face, z up | 120 // in the front frame u runs outward from the front face, z up. |
| 121 // a latch wider than the hinge span is narrowed to it | |
| 122 latch_w = min(latch_width, hinge_span); | |
| 119 latch_x = -out_x/2 - knuckle_u; | 123 latch_x = -out_x/2 - knuckle_u; |
| 120 latch_z = seam_z + knuckle_r + cl; | 124 latch_z = seam_z + knuckle_r + cl; |
| 121 bar_z = seam_z - cl - knuckle_r; | 125 bar_z = seam_z - cl - knuckle_r; |
| 122 bar_r = filament_diameter/2; | 126 bar_r = filament_diameter/2; |
| 123 // distance between flap axis and bar axis | 127 // distance between flap axis and bar axis |
| 124 bar_h = latch_z - bar_z; | 128 bar_h = latch_z - bar_z; |
| 125 hook_ri = bar_r + cl; | 129 hook_ri = bar_r + cl; |
| 126 hook_ro = hook_ri + hinge_lines*lw; | 130 hook_ro = hook_ri + latch_hook_lines*lw; |
| 127 // outer radius of the bar minus radius of the hook tip, both around the | 131 // outer radius of the bar minus radius of the hook tip, both around the |
| 128 // flap axis, for a hook reaching angle b past the bottom of the bar | 132 // flap axis, for a hook reaching angle b past the bottom of the bar |
| 129 function _detent(b) = | 133 function _detent(b) = |
| 130 bar_h + bar_r - norm([hook_ri*sin(b), bar_h + hook_ri*cos(b)]); | 134 bar_h + bar_r - norm([hook_ri*sin(b), bar_h + hook_ri*cos(b)]); |
| 131 // bisection for the angle that gives latch_detent | 135 // bisection for the angle that gives latch_detent |
| 135 _detent(m) < latch_detent ? _hook_angle(m, hi, n - 1) : _hook_angle(lo, m, n - 1); | 139 _detent(m) < latch_detent ? _hook_angle(m, hi, n - 1) : _hook_angle(lo, m, n - 1); |
| 136 hook_a = _hook_angle(0, 90); | 140 hook_a = _hook_angle(0, 90); |
| 137 plate_t = latch_layers*lh; | 141 plate_t = latch_layers*lh; |
| 138 plate_u = knuckle_u + knuckle_r + 2*cl; | 142 plate_u = knuckle_u + knuckle_r + 2*cl; |
| 139 plate_bz = bar_z - hook_ro - latch_grip; | 143 plate_bz = bar_z - hook_ro - latch_grip; |
| 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; | 144 latch_slot = (latch_w - 2*knuckle_gap)/3; |
| 143 // y start of the two outer latch slots | 145 // y start of the two outer latch slots |
| 144 latch_outer_y0 = [-latch_w/2, latch_slot/2 + knuckle_gap]; | 146 latch_outer_y0 = [-latch_w/2, latch_slot/2 + knuckle_gap]; |
| 145 | 147 |
| 146 assert(_detent(90) > latch_detent, "latch_detent too large for the filament bar"); | 148 assert(_detent(90) > latch_detent, "latch_detent too large for the filament bar"); |
| 160 echo("chamfer", chamfer_h, "mm", chamfer_layers, "layers"); | 162 echo("chamfer", chamfer_h, "mm", chamfer_layers, "layers"); |
| 161 if (body_ih < body_ih_req) | 163 if (body_ih < body_ih_req) |
| 162 echo(str("WARNING: body_ratio ", body_ratio, " leaves the lid too low, using ", | 164 echo(str("WARNING: body_ratio ", body_ratio, " leaves the lid too low, using ", |
| 163 body_ih/inner_height)); | 165 body_ih/inner_height)); |
| 164 echo("body height", seam_z, "mm, lid height", lid_h, "mm, body ratio", body_ih/inner_height); | 166 echo("body height", seam_z, "mm, lid height", lid_h, "mm, body ratio", body_ih/inner_height); |
| 167 if (latch_w < latch_width) | |
| 168 echo(str("WARNING: latch_width ", latch_width, " is wider than the hinge span, using ", | |
| 169 latch_w)); | |
| 165 echo("pin hole", pin_d, "mm, knuckle diameter", 2*knuckle_r, "mm"); | 170 echo("pin hole", pin_d, "mm, knuckle diameter", 2*knuckle_r, "mm"); |
| 166 echo("hinge knuckle length", knuckle_l, "mm"); | 171 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"); | |
| 171 echo("latch plate outer face", plate_u + plate_t, "mm from the front"); | 172 echo("latch plate outer face", plate_u + plate_t, "mm from the front"); |
| 172 echo("latch hook reaches", hook_a, "degrees past the bar bottom, detent", _detent(hook_a), "mm"); | 173 echo("latch hook reaches", hook_a, "degrees past the bar bottom, detent", _detent(hook_a), "mm"); |
| 173 echo("lid sweep clearance over centred paper", sweep_margin, "mm"); | 174 echo("lid sweep clearance over centred paper", sweep_margin, "mm"); |
| 174 | 175 |
| 175 // rounded box outline, inset by d | 176 // rounded box outline, inset by d |
| 290 } | 291 } |
| 291 | 292 |
| 292 // in assembly position, closed | 293 // in assembly position, closed |
| 293 module latch() { | 294 module latch() { |
| 294 // hook around the bar, from the plate side down under the bar and | 295 // hook around the bar, from the plate side down under the bar and |
| 295 // hook_a degrees up its wall side. its back is filled with a web down | 296 // hook_a degrees up its wall side |
| 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 | |
| 299 module _hook() { | 297 module _hook() { |
| 300 tip_a = 270 - hook_a; | 298 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); | |
| 303 difference() { | 299 difference() { |
| 304 intersection() { | 300 hull() { |
| 305 hull() { | 301 translate([knuckle_u, bar_z]) circle(r=hook_ro); |
| 306 translate([knuckle_u, bar_z]) circle(r=hook_ro); | 302 translate([knuckle_u, bar_z - hook_ro]) |
| 307 translate([plate_u, web_z]) square([epsilon, bar_z - web_z]); | 303 square([plate_u - knuckle_u + epsilon, hook_ro]); |
| 308 } | |
| 309 translate([0, cut_z]) square([plate_u + epsilon, bar_z - cut_z]); | |
| 310 } | 304 } |
| 311 translate([knuckle_u, bar_z]) circle(r=hook_ri); | 305 translate([knuckle_u, bar_z]) circle(r=hook_ri); |
| 312 // open wedge over the top and the wall side of the bar | 306 // open wedge over the top and the wall side of the bar |
| 313 translate([knuckle_u, bar_z]) | 307 translate([knuckle_u, bar_z]) |
| 314 polygon(concat([[0, 0]], | 308 polygon(concat([[0, 0]], |
