1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-08-12 18:33:58 +02:00

Fixed box_shelf_bracket() horizontal holes.

Added a third child to box_shelf_bracket() to allow custom additions.
This commit is contained in:
Chris Palmer
2024-03-14 21:36:04 +00:00
parent 67408f8422
commit 5579c0d988
2 changed files with 12 additions and 6 deletions

View File

@@ -494,7 +494,8 @@ module box_shelf_screw_positions(type, screw_positions, thickness = 0, wall = un
for(p = screw_positions) for(p = screw_positions)
multmatrix(p) multmatrix(p)
translate_z(thickness) translate_z(thickness)
children(); let($horizontal = true)
children();
r = box_boss_r(type); r = box_boss_r(type);
inset = box_intrusion(type) - r + (r + insert_boss_radius(insert, w) + bezel_clearance / 2) / sqrt(2); inset = box_intrusion(type) - r + (r + insert_boss_radius(insert, w) + bezel_clearance / 2) / sqrt(2);
@@ -503,10 +504,11 @@ module box_shelf_screw_positions(type, screw_positions, thickness = 0, wall = un
for(x = [-1, 1], y = [-1, 1]) for(x = [-1, 1], y = [-1, 1])
translate([x * (box_width(type) / 2 - inset), y * (box_depth(type) / 2 - inset)]) translate([x * (box_width(type) / 2 - inset), y * (box_depth(type) / 2 - inset)])
rotate(45 * x * (2 + y)) rotate(45 * x * (2 + y))
children(); let($horizontal = false)
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 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, third child is 3D additions.
w = is_undef(wall) ? box_wall(type) : wall; w = is_undef(wall) ? box_wall(type) : wall;
insert = box_shelf_insert(type); insert = box_shelf_insert(type);
lip = 2 * insert_boss_radius(insert, w); lip = 2 * insert_boss_radius(insert, w);
@@ -561,9 +563,13 @@ module box_shelf_bracket(type, screw_positions, wall = undef) { //! Generates a
children(0); children(0);
} }
hflip() hflip() {
box_shelf_screw_positions(type, screw_positions, 0, w) box_shelf_screw_positions(type, screw_positions, 0, w)
boss(); boss();
if($children > 2)
children(2);
}
} }
if($children > 1) if($children > 1)
hflip() hflip()
@@ -571,7 +577,7 @@ module box_shelf_bracket(type, screw_positions, wall = undef) { //! Generates a
hflip() hflip()
box_shelf_screw_positions(type, screw_positions, 0, w) box_shelf_screw_positions(type, screw_positions, 0, w)
insert_hole(insert, counterbore = 1, horizontal = true); insert_hole(insert, counterbore = 1, horizontal = $horizontal);
} }
} }

View File

@@ -5206,7 +5206,7 @@ The top bezel can have an optional child, which is subtracted to allow modificat
| `box_right(type)` | Default right side, can be overridden to customise | | `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_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, wall = undef)` | 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(type, screw_positions, wall = undef)` | Generates a shelf bracket, the first optional child is a 2D cutout and the second 3D cutouts, third child is 3D additions. |
| `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_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, top_screws = true)` | 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(type)` | Default top, can be overridden to customise |