comparison main.scad @ 2:e8b0aed6e3d8

adjusted lid hinge knuckles to maximise body ratio
author ark
date 2026-11-06 22:34 +0100
parents d17ae0060cba
children 80122df4a6c5
comparison
equal deleted inserted replaced
1:d17ae0060cba 2:e8b0aed6e3d8
22 // inner size left to right, the thickness of the paper stack 22 // inner size left to right, the thickness of the paper stack
23 inner_width = 92; // [10:1:300] 23 inner_width = 92; // [10:1:300]
24 // inner height, floor to lid ceiling 24 // inner height, floor to lid ceiling
25 inner_height = 92; // [10:1:300] 25 inner_height = 92; // [10:1:300]
26 // share of the inner height taken by the body 26 // share of the inner height taken by the body
27 body_ratio = .85; // [.1:.01:.95] 27 body_ratio = .85; // [.1:.01:.99]
28 // radius of the vertical outer edges 28 // radius of the vertical outer edges
29 edge_radius = 2; // [0:.1:10] 29 edge_radius = 2; // [0:.1:10]
30 // paper edge length, for the preview mockup and the lid sweep check 30 // paper size front to back, for the preview mockup and the lid sweep check
31 paper_size = 90; // [10:1:300] 31 paper_depth = 90; // [10:1:300]
32 // paper height, for the preview mockup and the lid sweep check
33 paper_height = 90; // [10:1:300]
32 34
33 /* [walls] */ 35 /* [walls] */
34 // wall thickness in extrusions 36 // wall thickness in extrusions
35 wall_lines = 4; // [2:1:10] 37 wall_lines = 4; // [2:1:10]
36 // lip thickness in extrusions: the inner part of the body wall, raised into the lid 38 // lip thickness in extrusions: the inner part of the body wall, raised into the lid
83 chamfer_h = chamfer_layers*lh; 85 chamfer_h = chamfer_layers*lh;
84 out_x = inner_depth + 2*wall_t; 86 out_x = inner_depth + 2*wall_t;
85 out_y = inner_width + 2*wall_t; 87 out_y = inner_width + 2*wall_t;
86 edge_r = min(edge_radius, min(out_x, out_y)/2 - epsilon); 88 edge_r = min(edge_radius, min(out_x, out_y)/2 - epsilon);
87 89
88 // heights. the seam between body and lid sits on a layer boundary
89 body_ih = round(body_ratio*inner_height/lh)*lh;
90 seam_z = floor_t + body_ih;
91 top_z = floor_t + inner_height + floor_t;
92 lid_h = top_z - seam_z;
93
94 // knuckles, shared by hinge and latch 90 // knuckles, shared by hinge and latch
95 pin_d = filament_diameter + 2*cl; 91 pin_d = filament_diameter + 2*cl;
96 knuckle_r = pin_d/2 + hinge_lines*lw; 92 knuckle_r = pin_d/2 + hinge_lines*lw;
97 // axis distance from the outer wall face 93 // axis distance from the outer wall face
98 knuckle_u = knuckle_r + 2*cl; 94 knuckle_u = knuckle_r + 2*cl;
99 // axial gap between knuckles 95 // axial gap between knuckles
100 knuckle_gap = 2*cl; 96 knuckle_gap = 2*cl;
97
98 // heights. the seam between body and lid sits on a layer boundary.
99 // the lid needs room for the wall around the latch pin hole, which sits
100 // one knuckle radius plus clearance above the seam, and for one layer of
101 // skirt wall above the recess over the lip. a body ratio that leaves less
102 // is lowered to the highest layer that fits
103 lid_min_h = max(2*knuckle_r + cl, floor_t + lip_h + 2*lh);
104 body_ih_max = floor((inner_height + floor_t - lid_min_h)/lh)*lh;
105 body_ih_req = round(body_ratio*inner_height/lh)*lh;
106 body_ih = min(body_ih_req, body_ih_max);
107 seam_z = floor_t + body_ih;
108 top_z = floor_t + inner_height + floor_t;
109 lid_h = top_z - seam_z;
101 110
102 // hinge 111 // hinge
103 hinge_x = out_x/2 + knuckle_u; 112 hinge_x = out_x/2 + knuckle_u;
104 hinge_span = out_y - 2*edge_r; 113 hinge_span = out_y - 2*edge_r;
105 knuckle_l = (hinge_span - (hinge_knuckles - 1)*knuckle_gap)/hinge_knuckles; 114 knuckle_l = (hinge_span - (hinge_knuckles - 1)*knuckle_gap)/hinge_knuckles;
133 latch_outer_y0 = [-latch_width/2, latch_slot/2 + knuckle_gap]; 142 latch_outer_y0 = [-latch_width/2, latch_slot/2 + knuckle_gap];
134 143
135 assert(_detent(90) > latch_detent, "latch_detent too large for the filament bar"); 144 assert(_detent(90) > latch_detent, "latch_detent too large for the filament bar");
136 assert(knuckle_l > 2*lw, "hinge knuckles too short, reduce hinge_knuckles"); 145 assert(knuckle_l > 2*lw, "hinge knuckles too short, reduce hinge_knuckles");
137 assert(latch_width <= hinge_span, "latch wider than the box front"); 146 assert(latch_width <= hinge_span, "latch wider than the box front");
138 assert(seam_z + knuckle_r + knuckle_u <= top_z, "lid too low for the hinge knuckles"); 147 assert(body_ih > 0, "inner height too low for the lid");
139 assert(latch_z + knuckle_r + knuckle_u <= top_z, "lid too low for the latch knuckles");
140 assert(lid_h > floor_t + lip_h + lh, "lid too low for the lip");
141 assert(chamfer_h <= floor_t, "chamfer higher than the floor"); 148 assert(chamfer_h <= floor_t, "chamfer higher than the floor");
142 149
143 // lid sweep over a centred paper stack: radius of the lowest lid ceiling 150 // lid sweep over a centred paper stack: radius of the lowest lid ceiling
144 // point over the paper minus radius of the paper's front top corner 151 // point over the paper minus radius of the paper's front top corner
145 sweep_margin = 152 sweep_margin =
146 norm([hinge_x + inner_depth/2, lip_h + lh]) 153 norm([hinge_x + inner_depth/2, lip_h + lh])
147 - norm([hinge_x + paper_size/2, floor_t + paper_size - seam_z]); 154 - norm([hinge_x + paper_depth/2, floor_t + paper_height - seam_z]);
148 155
149 echo("wall thickness", wall_t, "mm", wall_lines, "extrusions"); 156 echo("wall thickness", wall_t, "mm", wall_lines, "extrusions");
150 echo("lip thickness", wall_t - skirt_t - cl, "mm, height", lip_h, "mm"); 157 echo("lip thickness", wall_t - skirt_t - cl, "mm, height", lip_h, "mm");
151 echo("outer size", out_x, out_y, top_z, "mm"); 158 echo("outer size", out_x, out_y, top_z, "mm");
152 echo("chamfer", chamfer_h, "mm", chamfer_layers, "layers"); 159 echo("chamfer", chamfer_h, "mm", chamfer_layers, "layers");
153 echo("body height", seam_z, "mm, lid height", lid_h, "mm"); 160 if (body_ih < body_ih_req)
161 echo(str("WARNING: body_ratio ", body_ratio, " leaves the lid too low, using ",
162 body_ih/inner_height));
163 echo("body height", seam_z, "mm, lid height", lid_h, "mm, body ratio", body_ih/inner_height);
154 echo("pin hole", pin_d, "mm, knuckle diameter", 2*knuckle_r, "mm"); 164 echo("pin hole", pin_d, "mm, knuckle diameter", 2*knuckle_r, "mm");
155 echo("hinge knuckle length", knuckle_l, "mm"); 165 echo("hinge knuckle length", knuckle_l, "mm");
156 echo("latch plate outer face", plate_u + plate_t, "mm from the front"); 166 echo("latch plate outer face", plate_u + plate_t, "mm from the front");
157 echo("latch hook reaches", hook_a, "degrees past the bar bottom, detent", _detent(hook_a), "mm"); 167 echo("latch hook reaches", hook_a, "degrees past the bar bottom, detent", _detent(hook_a), "mm");
158 echo("lid sweep clearance over centred paper", sweep_margin, "mm"); 168 echo("lid sweep clearance over centred paper", sweep_margin, "mm");
236 } 246 }
237 247
238 // in assembly position, closed 248 // in assembly position, closed
239 module lid() { 249 module lid() {
240 // knuckle at height z with a web up to the wall from z0, chamfered 250 // knuckle at height z with a web up to the wall from z0, chamfered
241 // towards the lid top for printing upside down 251 // towards the lid top for printing upside down. the web reaches into
252 // the wall by the chamfer height, so where it meets the lid top it
253 // fills the edge chamfer. a knuckle that would reach past the lid top
254 // is cut off there and stands on the print bed
242 module _knuckle(z, z0) { 255 module _knuckle(z, z0) {
243 hull() { 256 web_u = chamfer_h + epsilon;
244 translate([knuckle_u, z]) circle(r=knuckle_r); 257 intersection() {
245 translate([-epsilon, z0]) 258 hull() {
246 square([epsilon, z + knuckle_r + knuckle_u - z0]); 259 translate([knuckle_u, z]) circle(r=knuckle_r);
260 translate([-web_u, z0])
261 square([web_u, z + knuckle_r + knuckle_u - z0]);
262 }
263 translate([-web_u - 1, z - knuckle_r - 1])
264 square([web_u + knuckle_u + knuckle_r + 2, top_z - (z - knuckle_r - 1)]);
247 } 265 }
248 } 266 }
249 267
250 difference() { 268 difference() {
251 union() { 269 union() {
304 } 322 }
305 323
306 module _paper() { 324 module _paper() {
307 stack_t = inner_width - 2; 325 stack_t = inner_width - 2;
308 color("white", .6) 326 color("white", .6)
309 translate([-paper_size/2, -stack_t/2, floor_t]) cube([paper_size, stack_t, paper_size]); 327 translate([-paper_depth/2, -stack_t/2, floor_t])
328 cube([paper_depth, stack_t, paper_height]);
310 } 329 }
311 330
312 // filament of length l along y at x, z 331 // filament of length l along y at x, z
313 module _filament(x, z, l) { 332 module _filament(x, z, l) {
314 color("dimgray") translate([x, 0, z]) rotate([90, 0, 0]) 333 color("dimgray") translate([x, 0, z]) rotate([90, 0, 0])
363 382
364 function paramstring(prefix="", suffix="") = str( 383 function paramstring(prefix="", suffix="") = str(
365 prefix, 384 prefix,
366 part == "all" ? "" : str(part, "_"), 385 part == "all" ? "" : str(part, "_"),
367 "w", inner_width, "d", inner_depth, "h", inner_height, 386 "w", inner_width, "d", inner_depth, "h", inner_height,
368 "b", round(100*body_ratio), 387 "b", round(100*body_ih/inner_height),
369 "_lw", round(100*line_width), "lh", round(100*layer_height), 388 "_lw", round(100*line_width), "lh", round(100*layer_height),
370 suffix); 389 suffix);
371 390
372 echo(paramstring("hinged_box_")); 391 echo(paramstring("hinged_box_"));