From 34719c33607f8720701eb59719af337cb4a1b777 Mon Sep 17 00:00:00 2001 From: Chris Palmer Date: Sat, 28 Jan 2023 20:25:38 +0000 Subject: [PATCH] Box shelves now have screws in the corners to hold them down. --- printed/box.scad | 18 +++++++++++++++--- readme.md | 4 ++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/printed/box.scad b/printed/box.scad index 2b2661f..62c9d1f 100644 --- a/printed/box.scad +++ b/printed/box.scad @@ -474,16 +474,19 @@ function subst_sheet(type, sheet) = let(s = box_sheets(type)) sheet ? assert(sheet_thickness(sheet) == sheet_thickness(s)) sheet : s; -module box_shelf_blank(type, sheet = false) { //! Generates a 2D template for a shelf sheet +module box_shelf_blank(type, sheet = false, wall = undef) { //! Generates a 2D template for a shelf sheet difference() { sheet_2D(subst_sheet(type, sheet), box_width(type) - bezel_clearance, box_depth(type) - bezel_clearance, 1); offset(bezel_clearance / 2) box_corner_quadrants(type, box_width(type), box_depth(type)); + + box_shelf_screw_positions(type, [], 0, wall) + drill(screw_clearance_radius(box_shelf_screw(type)), 0); } } -module box_shelf_screw_positions(type, screw_positions, thickness = 0, wall = undef) { //! Place children at the shelf screw positions +module box_shelf_screw_positions(type, screw_positions, thickness = 0, wall = undef, top_screws = true) { //! Place children at the shelf screw positions w = is_undef(wall) ? box_wall(type) : wall; insert = box_shelf_insert(type); translate_z(-insert_boss_radius(insert, w)) @@ -491,13 +494,22 @@ module box_shelf_screw_positions(type, screw_positions, thickness = 0, wall = un multmatrix(p) translate_z(thickness) children(); + + r = box_boss_r(type); + inset = box_intrusion(type) - r + (r + insert_boss_radius(insert, w) + bezel_clearance / 2) / sqrt(2); + if(top_screws) + translate_z(thickness) + for(x = [-1, 1], y = [-1, 1]) + translate([x * (box_width(type) / 2 - inset), y * (box_depth(type) / 2 - inset)]) + rotate(45 * x * (2 + y)) + children(); } module box_shelf_bracket(type, screw_positions, wall = undef) { //! Generates a shelf bracket, the first optional child is a 2D cutout and the second 3D cutouts w = is_undef(wall) ? box_wall(type) : wall; insert = box_shelf_insert(type); lip = 2 * insert_boss_radius(insert, w); - width = insert_length(insert) + w; + width = max(insert_length(insert) + w, lip); module shape() difference() { diff --git a/readme.md b/readme.md index b99124f..39ae2b1 100644 --- a/readme.md +++ b/readme.md @@ -4617,10 +4617,10 @@ The top bezel can have an optional child, which is subtracted to allow modificat | `box_left_blank(type, sheet = false)` | Generates a 2D template for the left sheet, `sheet` can be set to override the type | | `box_right(type)` | Default right side, can be overridden to customise | | `box_right_blank(type, sheet = false)` | Generates a 2D template for the right sheet, `sheet` can be set to override the type | -| `box_shelf_blank(type, sheet = false)` | Generates a 2D template for a shelf sheet | +| `box_shelf_blank(type, sheet = false, wall = undef)` | Generates a 2D template for a shelf sheet | | `box_shelf_bracket(type, screw_positions, wall = undef)` | Generates a shelf bracket, the first optional child is a 2D cutout and the second 3D cutouts | | `box_shelf_bracket_section(type, rows, cols, x, y)` | Generates sections of the shelf bracket to allow it to be bigger than the printer | -| `box_shelf_screw_positions(type, screw_positions, thickness = 0, wall = undef)` | Place children at the shelf screw positions | +| `box_shelf_screw_positions(type, screw_positions, thickness = 0, wall = undef, top_screws = true)` | Place children at the shelf screw positions | | `box_top(type)` | Default top, can be overridden to customise | | `box_top_blank(type)` | Generates a 2D template for the top sheet | | `grill(width, height, r = 1000, poly = false, h = 0)` | A staggered array of 5mm holes to make grills in sheets. Can be constrained to be circular. Set `poly` `true` for printing, `false` for milling. |