# HG changeset patch # User ark # Date 1794859421 -3600 # Node ID f2694e49cec18b38b22e109450c445635d24d128 # Parent fdd022a1bfb15b4b3fca7351606d44ca1117a61b added subdivisions; lid hinge overlap fix diff -r fdd022a1bfb1 -r f2694e49cec1 README.md --- a/README.md Mon Nov 16 19:26:19 2026 +0100 +++ b/README.md Mon Nov 16 21:03:41 2026 +0100 @@ -40,10 +40,12 @@ The console lists the derived sizes: wall thickness, outer size, body and lid height, pin hole diameter, knuckle length, latch detent and the -clearance of the lid over the paper stack when it opens. The last echo +clearance of the lid over the content when it opens. The last echo line is a file name that encodes the main parameters, for example `hinged_box_w92d92h92b85_lw40lh20`. With a single part selected, the name -includes the part, as in `hinged_box_lid_w92d92h92b85_lw40lh20`. +includes the part, as in `hinged_box_lid_w92d92h92b85_lw40lh20`. A box +with more than one cell adds the column and row count, as in +`hinged_box_c3r2_w92d92h92b85_lw40lh20`. After printing, push filament through the hinge knuckles, the latch knuckles and the bar knuckles. The pin holes are the filament diameter @@ -58,14 +60,26 @@ front to back, left to right and floor to lid ceiling. For a paper stack, `inner_width` is the thickness of the stack. +`columns` and `rows` divide the body into cells, columns left to right and +rows front to back as seen from the top front. `inner_width` and +`inner_depth` are then the size of one cell, and the box grows by the +cells and the divider walls between them. The dividers are +`divider_lines` extrusions thick and reach from the floor to the top of +the lip. The preview mockup puts the content in each cell, and the lid +sweep check uses the front row. + +`content_depth`, `content_width` and `content_height` give the size of +what goes into one cell, such as a paper stack. The preview mockup shows +it with `preview_content`, and the lid sweep check uses depth and height. +Nothing else uses them. A size larger than the cell or the inner height +is reduced to fit, and the console prints a warning with the size +actually used. + `body_ratio` is the share of the inner height taken by the body. The lid needs enough height for the latch knuckles and the lip recess. If the ratio leaves less, the body is made lower and the console prints a warning with the ratio actually used. -The preview mockup and the lid sweep check take the paper size from -`paper_depth` and `paper_height`. Nothing else uses them. - Walls are `wall_lines` extrusions thick. Floor and lid top are `floor_layers` layers. diff -r fdd022a1bfb1 -r f2694e49cec1 main.json --- a/main.json Mon Nov 16 19:26:19 2026 +0100 +++ b/main.json Mon Nov 16 21:03:41 2026 +0100 @@ -5,6 +5,9 @@ "body_ratio": "0.89000000000000001", "chamfer_layers": "3", "clearance": "0.10000000000000001", + "content_depth": "100", + "content_height": "100", + "content_width": "88", "edge_radius": "2", "filament_diameter": "1.8500000000000001", "floor_layers": "6", @@ -22,20 +25,21 @@ "line_width": "0.40000000000000002", "lip_layers": "4", "lip_lines": "2", - "paper_depth": "100", - "paper_height": "100", "part": "all", + "preview_content": "false", "preview_cut": "false", "preview_hardware": "false", "preview_latch_angle": "0", "preview_lid_angle": "0", - "preview_paper": "false", "wall_lines": "4" }, "calling cards box": { "body_ratio": "0.98999999999999999", "chamfer_layers": "3", "clearance": "0.10000000000000001", + "content_depth": "55", + "content_height": "85", + "content_width": "10", "edge_radius": "2", "filament_diameter": "1.8500000000000001", "floor_layers": "6", @@ -53,20 +57,21 @@ "line_width": "0.40000000000000002", "lip_layers": "4", "lip_lines": "2", - "paper_depth": "55", - "paper_height": "85", "part": "all", + "preview_content": "true", "preview_cut": "false", "preview_hardware": "true", "preview_latch_angle": "55", "preview_lid_angle": "8", - "preview_paper": "true", "wall_lines": "3" }, "contract bridge cards": { "body_ratio": "0.90000000000000002", "chamfer_layers": "3", "clearance": "0.10000000000000001", + "content_depth": "57", + "content_height": "88", + "content_width": "16", "edge_radius": "2", "filament_diameter": "1.8500000000000001", "floor_layers": "6", @@ -84,20 +89,21 @@ "line_width": "0.40000000000000002", "lip_layers": "4", "lip_lines": "2", - "paper_depth": "57", - "paper_height": "88", "part": "all", + "preview_content": "true", "preview_cut": "false", "preview_hardware": "true", "preview_latch_angle": "45", "preview_lid_angle": "30", - "preview_paper": "true", "wall_lines": "3" }, "uno cards": { "body_ratio": "0.92000000000000004", "chamfer_layers": "3", "clearance": "0.10000000000000001", + "content_depth": "62", + "content_height": "100", + "content_width": "11", "edge_radius": "2", "filament_diameter": "1.8500000000000001", "floor_layers": "6", @@ -115,15 +121,48 @@ "line_width": "0.40000000000000002", "lip_layers": "4", "lip_lines": "2", - "paper_depth": "62", - "paper_height": "100", "part": "all", + "preview_content": "true", "preview_cut": "false", "preview_hardware": "true", "preview_latch_angle": "45", "preview_lid_angle": "30", - "preview_paper": "true", "wall_lines": "3" + }, + "18650x10 battery box": { + "body_ratio": "0.90000000000000002", + "chamfer_layers": "3", + "clearance": "0.10000000000000001", + "columns": "5", + "content_depth": "18.5", + "content_height": "65", + "content_width": "18.5", + "divider_lines": "2", + "edge_radius": "10", + "filament_diameter": "1.75", + "floor_layers": "6", + "hinge_knuckles": "5", + "hinge_lines": "3", + "inner_depth": "18.800000000000001", + "inner_height": "67", + "inner_width": "18.800000000000001", + "latch_detent": "0.29999999999999999", + "latch_grip": "5", + "latch_hook_lines": "3", + "latch_layers": "8", + "latch_width": "30", + "layer_height": "0.20000000000000001", + "line_width": "0.40000000000000002", + "lip_layers": "4", + "lip_lines": "2", + "part": "all", + "preview_content": "false", + "preview_cut": "false", + "preview_hardware": "true", + "preview_latch_angle": "45", + "preview_lid_angle": "45", + "rows": "2", + "wall_lines": "4" } } } diff -r fdd022a1bfb1 -r f2694e49cec1 main.scad --- a/main.scad Mon Nov 16 19:26:19 2026 +0100 +++ b/main.scad Mon Nov 16 21:03:41 2026 +0100 @@ -7,8 +7,8 @@ part = "all"; // [all, body, lid, latch] // cut away the -y half in preview preview_cut = false; -// show a paper stack mockup in the assembly view -preview_paper = false; +// show a content mockup in each cell in the assembly view +preview_content = false; // show the filament pins and latch bar in the assembly view preview_hardware = false; // lid opening angle in the assembly view @@ -17,20 +17,32 @@ preview_latch_angle = 0; // [0:1:75] /* [box] */ -// inner size front to back -inner_depth = 92; // [10:1:300] -// inner size left to right, the thickness of the paper stack -inner_width = 92; // [10:1:300] +// inner size front to back, of one cell +inner_depth = 92; // [10:.1:300] +// inner size left to right of one cell +inner_width = 92; // [10:.1:300] // inner height, floor to lid ceiling -inner_height = 92; // [10:1:300] +inner_height = 92; // [10:.1:300] // share of the inner height taken by the body body_ratio = .85; // [.1:.01:.99] // radius of the vertical outer edges edge_radius = 2; // [0:.1:10] -// paper size front to back, for the preview mockup and the lid sweep check -paper_depth = 90; // [10:1:300] -// paper height, for the preview mockup and the lid sweep check -paper_height = 90; // [10:1:300] + +/* [dividers] */ +// number of cells left to right. inner_width is the width of one cell +columns = 1; // [1:1:10] +// number of cells front to back. inner_depth is the depth of one cell +rows = 1; // [1:1:10] +// divider wall thickness in extrusions +divider_lines = 2; // [1:1:10] + +/* [content] */ +// content size front to back, for the preview mockup and the lid sweep check. at most the cell depth +content_depth = 90; // [1:.1:300] +// content size left to right, for the preview mockup. at most the cell width +content_width = 90; // [1:.1:300] +// content height, for the preview mockup and the lid sweep check. at most the inner height +content_height = 90; // [1:.1:300] /* [walls] */ // wall thickness in extrusions @@ -85,8 +97,12 @@ lip_h = lip_layers*lh; floor_t = floor_layers*lh; chamfer_h = chamfer_layers*lh; -out_x = inner_depth + 2*wall_t; -out_y = inner_width + 2*wall_t; +// dividers and the total inner size over all cells +div_t = divider_lines*lw; +in_x = rows*inner_depth + (rows - 1)*div_t; +in_y = columns*inner_width + (columns - 1)*div_t; +out_x = in_x + 2*wall_t; +out_y = in_y + 2*wall_t; edge_r = min(edge_radius, min(out_x, out_y)/2 - epsilon); // knuckles, shared by hinge and latch @@ -150,14 +166,27 @@ assert(body_ih > 0, "inner height too low for the lid"); assert(chamfer_h <= floor_t, "chamfer higher than the floor"); -// lid sweep over a centred paper stack: radius of the lowest lid ceiling -// point over the paper minus radius of the paper's front top corner +// cell centres: x for row i from the front, y for column j from the left +function _cell_x(i) = -in_x/2 + inner_depth/2 + i*(inner_depth + div_t); +function _cell_y(j) = -in_y/2 + inner_width/2 + j*(inner_width + div_t); + +// content, clamped to one cell +cont_x = min(content_depth, inner_depth); +cont_y = min(content_width, inner_width); +cont_z = min(content_height, inner_height); + +// lid sweep over the content centred in the front row, the one furthest +// from the hinge: radius of the lowest lid ceiling point over the content +// minus radius of the content's front top corner sweep_margin = - norm([hinge_x + inner_depth/2, lip_h + lh]) - - norm([hinge_x + paper_depth/2, floor_t + paper_height - seam_z]); + norm([hinge_x + in_x/2, lip_h + lh]) + - norm([hinge_x - _cell_x(0) + cont_x/2, floor_t + cont_z - seam_z]); echo("wall thickness", wall_t, "mm", wall_lines, "extrusions"); echo("lip thickness", wall_t - skirt_t - cl, "mm, height", lip_h, "mm"); +if (columns > 1 || rows > 1) + echo("divider thickness", div_t, "mm", divider_lines, "extrusions"); +echo("inner size", in_x, in_y, inner_height, "mm"); echo("outer size", out_x, out_y, top_z, "mm"); echo("chamfer", chamfer_h, "mm", chamfer_layers, "layers"); if (body_ih < body_ih_req) @@ -171,7 +200,14 @@ echo("hinge knuckle length", knuckle_l, "mm"); echo("latch plate outer face", plate_u + plate_t, "mm from the front"); echo("latch hook reaches", hook_a, "degrees past the bar bottom, detent", _detent(hook_a), "mm"); -echo("lid sweep clearance over centred paper", sweep_margin, "mm"); +if (cont_x < content_depth) + echo(str("WARNING: content_depth ", content_depth, " is larger than the cell, using ", cont_x)); +if (cont_y < content_width) + echo(str("WARNING: content_width ", content_width, " is larger than the cell, using ", cont_y)); +if (cont_z < content_height) + echo(str("WARNING: content_height ", content_height, " is larger than the inner height, using ", + cont_z)); +echo("lid sweep clearance over the content in the front row", sweep_margin, "mm"); // rounded box outline, inset by d module _outline(d) { @@ -220,6 +256,16 @@ } module body() { + // divider walls between the cells, reaching into the outer wall + module _dividers() { + for (j = [1:1:columns - 1]) + translate([-in_x/2 - epsilon, _cell_y(j) - inner_width/2 - div_t]) + square([in_x + 2*epsilon, div_t]); + for (i = [1:1:rows - 1]) + translate([_cell_x(i) - inner_depth/2 - div_t, -in_y/2 - epsilon]) + square([div_t, in_y + 2*epsilon]); + } + // knuckle at height z with a web down to the wall up to z1, chamfered // below for printing module _knuckle(z, z1) { @@ -249,25 +295,35 @@ _hinge_pin(); _bar_pin(); } + // dividers from the floor to the top of the lip + translate([0, 0, floor_t - epsilon]) + linear_extrude(seam_z + lip_h - floor_t + epsilon) _dividers(); } // in assembly position, closed module lid() { // knuckle at height z with a web up to the wall from z0, chamfered - // towards the lid top for printing upside down. the web reaches into - // the wall by the chamfer height, so where it meets the lid top it - // fills the edge chamfer. a knuckle that would reach past the lid top - // is cut off there and stands on the print bed + // towards the lid top for printing upside down. the web joins the wall + // through a strip one epsilon thick just inside the outer face, so it + // stays out of the body wall below the seam. where the web reaches the + // edge chamfer at the lid top, a block fills the chamfer. a knuckle that + // would reach past the lid top is cut off there and stands on the print + // bed module _knuckle(z, z0) { - web_u = chamfer_h + epsilon; + web_z1 = z + knuckle_r + knuckle_u; + fill_z0 = max(z0, top_z - chamfer_h); intersection() { - hull() { - translate([knuckle_u, z]) circle(r=knuckle_r); - translate([-web_u, z0]) - square([web_u, z + knuckle_r + knuckle_u - z0]); + union() { + hull() { + translate([knuckle_u, z]) circle(r=knuckle_r); + translate([-epsilon, z0]) square([epsilon, web_z1 - z0]); + } + if (web_z1 > fill_z0) + translate([-chamfer_h - epsilon, fill_z0]) + square([chamfer_h + epsilon, web_z1 - fill_z0]); } - translate([-web_u - 1, z - knuckle_r - 1]) - square([web_u + knuckle_u + knuckle_r + 2, top_z - (z - knuckle_r - 1)]); + translate([-epsilon - 1, z - knuckle_r - 1]) + square([epsilon + knuckle_u + knuckle_r + 2, top_z - (z - knuckle_r - 1)]); } } @@ -327,11 +383,12 @@ } } -module _paper() { - stack_t = inner_width - 2; +// content block centred in each cell +module _content() { color("white", .6) - translate([-paper_depth/2, -stack_t/2, floor_t]) - cube([paper_depth, stack_t, paper_height]); + for (i = [0:1:rows - 1], j = [0:1:columns - 1]) + translate([_cell_x(i) - cont_x/2, _cell_y(j) - cont_y/2, floor_t]) + cube([cont_x, cont_y, cont_z]); } // filament of length l along y at x, z @@ -353,7 +410,7 @@ translate([latch_x, 0, latch_z]) rotate([0, preview_latch_angle, 0]) translate([-latch_x, 0, -latch_z]) color("orange") latch(); } - if (preview_paper && $preview) _paper(); + if (preview_content && $preview) _content(); } module part_view() { @@ -389,6 +446,7 @@ function paramstring(prefix="", suffix="") = str( prefix, part == "all" ? "" : str(part, "_"), + columns > 1 || rows > 1 ? str("c", columns, "r", rows, "_") : "", "w", inner_width, "d", inner_depth, "h", inner_height, "b", round(100*body_ih/inner_height), "_lw", round(100*line_width), "lh", round(100*layer_height),