wobblyhead hg > 3dprints > hinged_box
comparison main.scad @ 8:ac8f2ecb6c18
latch: block style, middle knuckle share, middle-width plate
Add latch_style with a new block latch: a solid piece in the middle slot
with the profile of the body knuckles, extended below the hook by
latch_grip. Between knuckle and hook only the knuckle ring and the front
wall remain; below the bar the opening follows the hook tip line to the
back face. A notch at the bottom of the back face takes a fingernail.
Add latch_middle_ratio for the share of the latch width taken by the
middle knuckle, clamped with a warning so no slot is narrower than two
extrusions.
Add latch_plate_full. Without it the plate is only as wide as the middle
slot, and the latch exports standing on its side with the plate
thickness rounded up to whole extrusions. The block also prints on its
side.
The latch file name gets the style, and all names get the middle share
when it is not .33. Extrude slabs with convexity 4 so the preview shows
the block profile correctly. README updated.
| author | ark |
|---|---|
| date | 2026-11-17 12:32 +0100 |
| parents | 1933892bab51 |
| children | 4b89f95689a8 |
comparison
equal
deleted
inserted
replaced
| 7:1933892bab51 | 8:ac8f2ecb6c18 |
|---|---|
| 63 hinge_knuckles = 5; // [3:2:15] | 63 hinge_knuckles = 5; // [3:2:15] |
| 64 // knuckle wall around the pin hole, in extrusions | 64 // knuckle wall around the pin hole, in extrusions |
| 65 hinge_lines = 3; // [2:1:8] | 65 hinge_lines = 3; // [2:1:8] |
| 66 | 66 |
| 67 /* [latch] */ | 67 /* [latch] */ |
| 68 // latch shape: a plate in front of the knuckles joining knuckle and hook, or a solid block between the bar knuckles | |
| 69 latch_style = "plate"; // [plate, block] | |
| 68 // latch width | 70 // latch width |
| 69 latch_width = 20; // [8:1:100] | 71 latch_width = 20; // [8:1:100] |
| 70 // latch plate thickness in layers, printed flat | 72 // share of the latch width taken by the middle knuckle that carries the latch. the outer knuckles share the rest |
| 73 latch_middle_ratio = .33; // [.1:.01:.9] | |
| 74 // plate style: plate across the full latch width, printed flat. otherwise only as wide as the middle knuckle, printed standing on its side | |
| 75 latch_plate_full = true; | |
| 76 // latch plate thickness in layers. a plate printed on its side is rounded up to whole extrusions | |
| 71 latch_layers = 8; // [4:1:20] | 77 latch_layers = 8; // [4:1:20] |
| 72 // radial overlap the hook tip has to pass at the filament bar. 0 for a free swinging latch | 78 // radial overlap the hook tip has to pass at the filament bar. 0 for a free swinging latch |
| 73 latch_detent = .3; // [0:.05:.7] | 79 latch_detent = .3; // [0:.05:.7] |
| 74 // grip tab length below the hook | 80 // grip length below the hook: the plate's grip tab, or the block's extension |
| 75 latch_grip = 5; // [0:.5:20] | 81 latch_grip = 5; // [0:.5:20] |
| 76 // hook wall around the filament bar, in extrusions | 82 // hook wall around the filament bar, in extrusions |
| 77 latch_hook_lines = 3; // [2:1:8] | 83 latch_hook_lines = 3; // [2:1:8] |
| 78 | 84 |
| 79 /* [print settings] */ | 85 /* [print settings] */ |
| 129 // hinge | 135 // hinge |
| 130 hinge_x = out_x/2 + knuckle_u; | 136 hinge_x = out_x/2 + knuckle_u; |
| 131 hinge_span = out_y - 2*edge_r; | 137 hinge_span = out_y - 2*edge_r; |
| 132 knuckle_l = (hinge_span - (hinge_knuckles - 1)*knuckle_gap)/hinge_knuckles; | 138 knuckle_l = (hinge_span - (hinge_knuckles - 1)*knuckle_gap)/hinge_knuckles; |
| 133 | 139 |
| 134 // latch. the flap hangs from lid knuckles and its hook wraps around a | 140 // latch. the latch hangs from lid knuckles and its hook wraps around a |
| 135 // filament bar held by body knuckles straight below the flap axis. | 141 // filament bar held by body knuckles straight below the latch axis. |
| 136 // in the front frame u runs outward from the front face, z up. | 142 // in the front frame u runs outward from the front face, z up. |
| 137 // a latch wider than the hinge span is narrowed to it | 143 // a latch wider than the hinge span is narrowed to it |
| 138 latch_w = min(latch_width, hinge_span); | 144 latch_w = min(latch_width, hinge_span); |
| 139 latch_x = -out_x/2 - knuckle_u; | 145 latch_x = -out_x/2 - knuckle_u; |
| 140 latch_z = seam_z + knuckle_r + cl; | 146 latch_z = seam_z + knuckle_r + cl; |
| 143 // distance between flap axis and bar axis | 149 // distance between flap axis and bar axis |
| 144 bar_h = latch_z - bar_z; | 150 bar_h = latch_z - bar_z; |
| 145 hook_ri = bar_r + cl; | 151 hook_ri = bar_r + cl; |
| 146 hook_ro = hook_ri + latch_hook_lines*lw; | 152 hook_ro = hook_ri + latch_hook_lines*lw; |
| 147 // outer radius of the bar minus radius of the hook tip, both around the | 153 // outer radius of the bar minus radius of the hook tip, both around the |
| 148 // flap axis, for a hook reaching angle b past the bottom of the bar | 154 // latch axis, for a hook reaching angle b past the bottom of the bar |
| 149 function _detent(b) = | 155 function _detent(b) = |
| 150 bar_h + bar_r - norm([hook_ri*sin(b), bar_h + hook_ri*cos(b)]); | 156 bar_h + bar_r - norm([hook_ri*sin(b), bar_h + hook_ri*cos(b)]); |
| 151 // bisection for the angle that gives latch_detent | 157 // bisection for the angle that gives latch_detent |
| 152 function _hook_angle(lo, hi, n=40) = | 158 function _hook_angle(lo, hi, n=40) = |
| 153 n == 0 ? (lo + hi)/2 : | 159 n == 0 ? (lo + hi)/2 : |
| 154 let(m = (lo + hi)/2) | 160 let(m = (lo + hi)/2) |
| 155 _detent(m) < latch_detent ? _hook_angle(m, hi, n - 1) : _hook_angle(lo, m, n - 1); | 161 _detent(m) < latch_detent ? _hook_angle(m, hi, n - 1) : _hook_angle(lo, m, n - 1); |
| 156 hook_a = _hook_angle(0, 90); | 162 hook_a = _hook_angle(0, 90); |
| 157 plate_t = latch_layers*lh; | 163 |
| 164 // knuckle slots across the latch width: the middle one carries the latch, | |
| 165 // the outer ones have a lid knuckle above and a body knuckle below. a | |
| 166 // ratio that leaves a slot narrower than 2 extrusions is clamped | |
| 167 latch_span = latch_w - 2*knuckle_gap; | |
| 168 slot_min = 2*lw; | |
| 169 latch_ratio = min(max(latch_middle_ratio, slot_min/latch_span), 1 - 2*slot_min/latch_span); | |
| 170 latch_mid = latch_ratio*latch_span; | |
| 171 latch_outer = (latch_span - latch_mid)/2; | |
| 172 // y start of the two outer latch slots | |
| 173 latch_outer_y0 = [-latch_w/2, latch_mid/2 + knuckle_gap]; | |
| 174 | |
| 175 // the latch prints standing on its side, its profile in the print plane, | |
| 176 // unless it is a plate across the full latch width | |
| 177 latch_block = latch_style == "block"; | |
| 178 latch_on_side = latch_block || !latch_plate_full; | |
| 179 | |
| 180 // plate style. on its side, the thickness is rounded up to whole | |
| 181 // extrusions; the small margin keeps an exact multiple from rounding up | |
| 182 plate_w = latch_on_side ? latch_mid : latch_w; | |
| 183 plate_lines = ceil(latch_layers*lh/lw - .001); | |
| 184 plate_t = latch_on_side ? plate_lines*lw : latch_layers*lh; | |
| 158 plate_u = knuckle_u + knuckle_r + 2*cl; | 185 plate_u = knuckle_u + knuckle_r + 2*cl; |
| 159 plate_bz = bar_z - hook_ro - latch_grip; | 186 plate_bz = bar_z - hook_ro - latch_grip; |
| 160 latch_slot = (latch_w - 2*knuckle_gap)/3; | 187 |
| 161 // y start of the two outer latch slots | 188 // block style: the profile of the body knuckles, reaching from the latch |
| 162 latch_outer_y0 = [-latch_w/2, latch_slot/2 + knuckle_gap]; | 189 // knuckle down past the hook by latch_grip. blk_r is the radius of the |
| 190 // rounded front, blk_back the gap between back face and wall, blk_cz the | |
| 191 // centre of the lowest round and blk_bz the bottom end of the back face | |
| 192 blk_r = max(knuckle_r, hook_ro); | |
| 193 blk_back = 2*cl; | |
| 194 blk_cz = bar_z - latch_grip; | |
| 195 blk_bz = blk_cz - blk_r - (knuckle_u - blk_back); | |
| 196 // fingernail notch in the back face at the bottom edge: 3 extrusions | |
| 197 // deep, 8 extrusions high, kept 2 extrusions below the hook | |
| 198 nail_d = 3*lw; | |
| 199 nail_h = min(8*lw, bar_z - hook_ro - 2*lw - blk_bz); | |
| 200 | |
| 201 // how far the latch reaches out from the front face | |
| 202 latch_front_u = latch_block ? knuckle_u + blk_r : plate_u + plate_t; | |
| 163 | 203 |
| 164 assert(_detent(90) > latch_detent, "latch_detent too large for the filament bar"); | 204 assert(_detent(90) > latch_detent, "latch_detent too large for the filament bar"); |
| 165 assert(knuckle_l > 2*lw, "hinge knuckles too short, reduce hinge_knuckles"); | 205 assert(knuckle_l > 2*lw, "hinge knuckles too short, reduce hinge_knuckles"); |
| 166 assert(body_ih > 0, "inner height too low for the lid"); | 206 assert(body_ih > 0, "inner height too low for the lid"); |
| 167 assert(chamfer_h <= floor_t, "chamfer higher than the floor"); | 207 assert(chamfer_h <= floor_t, "chamfer higher than the floor"); |
| 194 body_ih/inner_height)); | 234 body_ih/inner_height)); |
| 195 echo("body height", seam_z, "mm, lid height", lid_h, "mm, body ratio", body_ih/inner_height); | 235 echo("body height", seam_z, "mm, lid height", lid_h, "mm, body ratio", body_ih/inner_height); |
| 196 if (latch_w < latch_width) | 236 if (latch_w < latch_width) |
| 197 echo(str("WARNING: latch_width ", latch_width, " is wider than the hinge span, using ", | 237 echo(str("WARNING: latch_width ", latch_width, " is wider than the hinge span, using ", |
| 198 latch_w)); | 238 latch_w)); |
| 239 if (latch_ratio != latch_middle_ratio) | |
| 240 echo(str("WARNING: latch_middle_ratio ", latch_middle_ratio, | |
| 241 " leaves a latch knuckle narrower than 2 extrusions, using ", latch_ratio)); | |
| 199 echo("pin hole", pin_d, "mm, knuckle diameter", 2*knuckle_r, "mm"); | 242 echo("pin hole", pin_d, "mm, knuckle diameter", 2*knuckle_r, "mm"); |
| 200 echo("hinge knuckle length", knuckle_l, "mm"); | 243 echo("hinge knuckle length", knuckle_l, "mm"); |
| 201 echo("latch plate outer face", plate_u + plate_t, "mm from the front"); | 244 echo("latch knuckle length: middle", latch_mid, "mm, outer", latch_outer, "mm"); |
| 245 echo(str("latch style ", latch_style, ", printed ", latch_on_side ? "on its side" : "flat")); | |
| 246 if (latch_block) { | |
| 247 echo("latch block length below the hook", latch_grip, "mm"); | |
| 248 if (nail_h > 0) | |
| 249 echo("fingernail notch", nail_d, "mm deep, reaching", nail_h, "mm above the bottom edge"); | |
| 250 else | |
| 251 echo("WARNING: latch_grip too short for the fingernail notch"); | |
| 252 } else if (latch_on_side) | |
| 253 echo("latch plate thickness", plate_t, "mm", plate_lines, "extrusions, width", plate_w, "mm"); | |
| 254 else | |
| 255 echo("latch plate thickness", plate_t, "mm", latch_layers, "layers, width", plate_w, "mm"); | |
| 256 echo("latch outer face", latch_front_u, "mm from the front"); | |
| 202 echo("latch hook reaches", hook_a, "degrees past the bar bottom, detent", _detent(hook_a), "mm"); | 257 echo("latch hook reaches", hook_a, "degrees past the bar bottom, detent", _detent(hook_a), "mm"); |
| 203 if (cont_x < content_depth) | 258 if (cont_x < content_depth) |
| 204 echo(str("WARNING: content_depth ", content_depth, " is larger than the cell, using ", cont_x)); | 259 echo(str("WARNING: content_depth ", content_depth, " is larger than the cell, using ", cont_x)); |
| 205 if (cont_y < content_width) | 260 if (cont_y < content_width) |
| 206 echo(str("WARNING: content_width ", content_width, " is larger than the cell, using ", cont_y)); | 261 echo(str("WARNING: content_width ", content_width, " is larger than the cell, using ", cont_y)); |
| 223 translate([0, 0, chamfer_h]) linear_extrude(h - chamfer_h) _outline(0); | 278 translate([0, 0, chamfer_h]) linear_extrude(h - chamfer_h) _outline(0); |
| 224 } | 279 } |
| 225 | 280 |
| 226 // extrude a 2d profile drawn in x/z between y0 and y1 | 281 // extrude a 2d profile drawn in x/z between y0 and y1 |
| 227 module _yslab(y0, y1) { | 282 module _yslab(y0, y1) { |
| 228 translate([0, y1, 0]) rotate([90, 0, 0]) linear_extrude(y1 - y0) children(); | 283 translate([0, y1, 0]) rotate([90, 0, 0]) linear_extrude(y1 - y0, convexity=4) children(); |
| 229 } | 284 } |
| 230 | 285 |
| 231 // frame with u outward from the back face | 286 // frame with u outward from the back face |
| 232 module _back() { | 287 module _back() { |
| 233 translate([out_x/2, 0, 0]) children(); | 288 translate([out_x/2, 0, 0]) children(); |
| 287 } | 342 } |
| 288 for (i = [0:2:hinge_knuckles - 1]) | 343 for (i = [0:2:hinge_knuckles - 1]) |
| 289 _back() _yslab(_knuckle_y0(i), _knuckle_y0(i) + knuckle_l) | 344 _back() _yslab(_knuckle_y0(i), _knuckle_y0(i) + knuckle_l) |
| 290 _knuckle(seam_z, seam_z - cl); | 345 _knuckle(seam_z, seam_z - cl); |
| 291 for (y0 = latch_outer_y0) | 346 for (y0 = latch_outer_y0) |
| 292 _front() _yslab(y0, y0 + latch_slot) _knuckle(bar_z, bar_z + knuckle_r); | 347 _front() _yslab(y0, y0 + latch_outer) _knuckle(bar_z, bar_z + knuckle_r); |
| 293 } | 348 } |
| 294 translate([0, 0, floor_t]) linear_extrude(top_z) _outline(wall_t); | 349 translate([0, 0, floor_t]) linear_extrude(top_z) _outline(wall_t); |
| 295 _hinge_pin(); | 350 _hinge_pin(); |
| 296 _bar_pin(); | 351 _bar_pin(); |
| 297 } | 352 } |
| 332 translate([0, 0, top_z]) mirror([0, 0, 1]) _block(lid_h); | 387 translate([0, 0, top_z]) mirror([0, 0, 1]) _block(lid_h); |
| 333 for (i = [1:2:hinge_knuckles - 1]) | 388 for (i = [1:2:hinge_knuckles - 1]) |
| 334 _back() _yslab(_knuckle_y0(i), _knuckle_y0(i) + knuckle_l) | 389 _back() _yslab(_knuckle_y0(i), _knuckle_y0(i) + knuckle_l) |
| 335 _knuckle(seam_z, seam_z + cl); | 390 _knuckle(seam_z, seam_z + cl); |
| 336 for (y0 = latch_outer_y0) | 391 for (y0 = latch_outer_y0) |
| 337 _front() _yslab(y0, y0 + latch_slot) _knuckle(latch_z, seam_z + cl); | 392 _front() _yslab(y0, y0 + latch_outer) _knuckle(latch_z, seam_z + cl); |
| 338 } | 393 } |
| 339 translate([0, 0, seam_z - epsilon]) | 394 translate([0, 0, seam_z - epsilon]) |
| 340 linear_extrude(lid_h - floor_t + epsilon) _outline(wall_t); | 395 linear_extrude(lid_h - floor_t + epsilon) _outline(wall_t); |
| 341 // recess over the lip, one layer higher than the lip | 396 // recess over the lip, one layer higher than the lip |
| 342 translate([0, 0, seam_z - epsilon]) | 397 translate([0, 0, seam_z - epsilon]) |
| 344 _hinge_pin(); | 399 _hinge_pin(); |
| 345 _latch_pin(); | 400 _latch_pin(); |
| 346 } | 401 } |
| 347 } | 402 } |
| 348 | 403 |
| 349 // in assembly position, closed | 404 // in assembly position, closed. the plate style has a knuckle and a hook |
| 405 // in the middle slot, joined by a plate in front of the outer knuckles. the | |
| 406 // block style is one solid profile across the middle slot | |
| 350 module latch() { | 407 module latch() { |
| 408 tip_a = 270 - hook_a; | |
| 409 axis = [knuckle_u, latch_z]; | |
| 410 bar = [knuckle_u, bar_z]; | |
| 411 // length of the hook tip line from the bar centre to past the back face | |
| 412 tip_l = (knuckle_u + 1)/max(abs(cos(tip_a)), .1); | |
| 413 | |
| 414 // sector of radius r from angle a0 to a1, counterclockwise | |
| 415 module _sector(r, a0, a1) { | |
| 416 polygon(concat([[0, 0]], | |
| 417 [for (a = [a0:10:a1]) r*[cos(a), sin(a)]], | |
| 418 [r*[cos(a1), sin(a1)]])); | |
| 419 } | |
| 420 | |
| 351 // hook around the bar, from the plate side down under the bar and | 421 // hook around the bar, from the plate side down under the bar and |
| 352 // hook_a degrees up its wall side | 422 // hook_a degrees up its wall side |
| 353 module _hook() { | 423 module _hook() { |
| 354 tip_a = 270 - hook_a; | |
| 355 difference() { | 424 difference() { |
| 356 hull() { | 425 hull() { |
| 357 translate([knuckle_u, bar_z]) circle(r=hook_ro); | 426 translate([knuckle_u, bar_z]) circle(r=hook_ro); |
| 358 translate([knuckle_u, bar_z - hook_ro]) | 427 translate([knuckle_u, bar_z - hook_ro]) |
| 359 square([plate_u - knuckle_u + epsilon, hook_ro]); | 428 square([plate_u - knuckle_u + epsilon, hook_ro]); |
| 360 } | 429 } |
| 361 translate([knuckle_u, bar_z]) circle(r=hook_ri); | 430 translate(bar) circle(r=hook_ri); |
| 362 // open wedge over the top and the wall side of the bar | 431 // open wedge over the top and the wall side of the bar |
| 363 translate([knuckle_u, bar_z]) | 432 translate(bar) _sector(2*hook_ro, 0, tip_a); |
| 364 polygon(concat([[0, 0]], | 433 } |
| 365 [for (a = [0:10:tip_a]) 2*hook_ro*[cos(a), sin(a)]], | 434 } |
| 366 [2*hook_ro*[cos(tip_a), sin(tip_a)]])); | 435 |
| 436 module _plate() { | |
| 437 _yslab(-plate_w/2, plate_w/2) | |
| 438 translate([plate_u, plate_bz]) square([plate_t, latch_z - plate_bz]); | |
| 439 _yslab(-latch_mid/2, latch_mid/2) { | |
| 440 hull() { | |
| 441 translate(axis) circle(r=knuckle_r); | |
| 442 translate([plate_u, latch_z - knuckle_r]) square([plate_t, knuckle_r]); | |
| 443 } | |
| 444 _hook(); | |
| 445 } | |
| 446 } | |
| 447 | |
| 448 // profile of the block: rounded at the front, the back face flat along | |
| 449 // the wall, sloped at the bottom like the body knuckles | |
| 450 module _block() { | |
| 451 difference() { | |
| 452 intersection() { | |
| 453 hull() { | |
| 454 translate(axis) circle(r=knuckle_r); | |
| 455 translate(bar) circle(r=blk_r); | |
| 456 translate([knuckle_u, blk_cz]) circle(r=blk_r); | |
| 457 translate([blk_back, blk_bz]) square([epsilon, latch_z - blk_bz]); | |
| 458 } | |
| 459 // keep the back face off the wall where the hook is larger | |
| 460 // than the knuckle | |
| 461 translate([blk_back, blk_bz - 1]) | |
| 462 square([knuckle_u + blk_r + 1, latch_z + knuckle_r - blk_bz + 2]); | |
| 463 } | |
| 464 translate(bar) circle(r=hook_ri); | |
| 465 // opening for the bar, leaving the knuckle ring and the front | |
| 466 // wall: from the knuckle down to the bar, front to the far side | |
| 467 // of the bar hole, and on the wall side down to the line of the | |
| 468 // hook tip face, which runs on through the bar centre to the | |
| 469 // back face | |
| 470 difference() { | |
| 471 polygon([ | |
| 472 bar, | |
| 473 bar + tip_l*[cos(tip_a), sin(tip_a)], | |
| 474 [-1, latch_z], | |
| 475 [knuckle_u + hook_ri, latch_z], | |
| 476 [knuckle_u + hook_ri, bar_z]]); | |
| 477 translate(axis) circle(r=knuckle_r); | |
| 478 } | |
| 479 // fingernail notch | |
| 480 if (nail_h > 0) | |
| 481 translate([blk_back - epsilon, blk_bz - epsilon]) | |
| 482 square([nail_d + epsilon, nail_h + epsilon]); | |
| 367 } | 483 } |
| 368 } | 484 } |
| 369 | 485 |
| 370 difference() { | 486 difference() { |
| 371 _front() union() { | 487 _front() |
| 372 _yslab(-latch_w/2, latch_w/2) | 488 if (latch_block) _yslab(-latch_mid/2, latch_mid/2) _block(); |
| 373 translate([plate_u, plate_bz]) square([plate_t, latch_z - plate_bz]); | 489 else _plate(); |
| 374 _yslab(-latch_slot/2, latch_slot/2) { | |
| 375 hull() { | |
| 376 translate([knuckle_u, latch_z]) circle(r=knuckle_r); | |
| 377 translate([plate_u, latch_z - knuckle_r]) square([plate_t, knuckle_r]); | |
| 378 } | |
| 379 _hook(); | |
| 380 } | |
| 381 } | |
| 382 _latch_pin(); | 490 _latch_pin(); |
| 383 } | 491 } |
| 384 } | 492 } |
| 385 | 493 |
| 386 // content block centred in each cell | 494 // content block centred in each cell |
| 412 } | 520 } |
| 413 if (preview_content && $preview) _content(); | 521 if (preview_content && $preview) _content(); |
| 414 } | 522 } |
| 415 | 523 |
| 416 module part_view() { | 524 module part_view() { |
| 417 cut_s = max(out_x/2 + plate_u + plate_t, top_z) | 525 cut_s = max(out_x/2 + latch_front_u, top_z) |
| 418 + (preview_lid_angle > 0 ? out_x : 0) + 1; | 526 + (preview_lid_angle > 0 ? out_x : 0) + 1; |
| 419 if ($preview && preview_cut) | 527 if ($preview && preview_cut) |
| 420 difference() { | 528 difference() { |
| 421 children(); | 529 children(); |
| 422 translate([-cut_s, -cut_s, -cut_s]) cube([2*cut_s, cut_s, 2*cut_s]); | 530 translate([-cut_s, -cut_s, -cut_s]) cube([2*cut_s, cut_s, 2*cut_s]); |
| 435 if ($preview) lid(); | 543 if ($preview) lid(); |
| 436 else translate([0, 0, top_z]) rotate([180, 0, 0]) lid(); | 544 else translate([0, 0, top_z]) rotate([180, 0, 0]) lid(); |
| 437 else if (part == "latch") | 545 else if (part == "latch") |
| 438 part_view() | 546 part_view() |
| 439 if ($preview) latch(); | 547 if ($preview) latch(); |
| 440 else translate([latch_z, 0, out_x/2 + plate_u + plate_t]) | 548 // on its side: the width along z, standing on the print bed |
| 549 else if (latch_on_side) | |
| 550 translate([0, 0, latch_mid/2]) rotate([90, 0, 0]) | |
| 551 translate([-latch_x, 0, -latch_z]) latch(); | |
| 552 // flat: the plate face on the print bed | |
| 553 else translate([latch_z, 0, out_x/2 + latch_front_u]) | |
| 441 rotate([0, -90, 0]) latch(); | 554 rotate([0, -90, 0]) latch(); |
| 442 } | 555 } |
| 443 | 556 |
| 444 main(); | 557 main(); |
| 445 | 558 |
| 446 function paramstring(prefix="", suffix="") = str( | 559 function paramstring(prefix="", suffix="") = str( |
| 447 prefix, | 560 prefix, |
| 448 part == "all" ? "" : str(part, "_"), | 561 part == "all" ? "" : str(part, "_"), |
| 562 part == "latch" ? | |
| 563 str(latch_block ? "block" : latch_plate_full ? "plate" : "plate-middle", "_") : "", | |
| 449 columns > 1 || rows > 1 ? str("c", columns, "r", rows, "_") : "", | 564 columns > 1 || rows > 1 ? str("c", columns, "r", rows, "_") : "", |
| 450 "w", inner_width, "d", inner_depth, "h", inner_height, | 565 "w", inner_width, "d", inner_depth, "h", inner_height, |
| 451 "b", round(100*body_ih/inner_height), | 566 "b", round(100*body_ih/inner_height), |
| 567 // latch middle share, only when it differs from the default | |
| 568 round(100*latch_ratio) == 33 ? "" : str("lm", round(100*latch_ratio)), | |
| 452 "_lw", round(100*line_width), "lh", round(100*layer_height), | 569 "_lw", round(100*line_width), "lh", round(100*layer_height), |
| 453 suffix); | 570 suffix); |
| 454 | 571 |
| 455 echo(paramstring("hinged_box_")); | 572 echo(paramstring("hinged_box_")); |
