mirror of
https://github.com/nophead/NopSCADlib.git
synced 2025-08-11 18:04:02 +02:00
Box top bezels can now be modified by adding a child that gets subtracted.
This commit is contained in:
@@ -30,6 +30,10 @@
|
|||||||
//! 
|
//! 
|
||||||
//!
|
//!
|
||||||
//! Normally the side sheets are the same type but they can be overridden individually as long as the substitute has the same thickness.
|
//! Normally the side sheets are the same type but they can be overridden individually as long as the substitute has the same thickness.
|
||||||
|
//!
|
||||||
|
//! A box can have an optional name to allow more than one in the same project.
|
||||||
|
//!
|
||||||
|
//! The top bezel can have an optional child, which is subtracted to allow modification.
|
||||||
//
|
//
|
||||||
include <../utils/core/core.scad>
|
include <../utils/core/core.scad>
|
||||||
use <../vitamins/sheet.scad>
|
use <../vitamins/sheet.scad>
|
||||||
@@ -92,7 +96,7 @@ function box_bezel_height(type, bottom) = //! Bezel height for top or bottom
|
|||||||
let(t1 = sheet_thickness(box_base_sheet(type)), t2 = sheet_thickness(box_top_sheet(type)))
|
let(t1 = sheet_thickness(box_base_sheet(type)), t2 = sheet_thickness(box_top_sheet(type)))
|
||||||
box_corner_rad(type) + box_profile_overlap(type) + (bottom ? max(t1, t2) : t2) - sheet_thickness(box_sheets(type));
|
box_corner_rad(type) + box_profile_overlap(type) + (bottom ? max(t1, t2) : t2) - sheet_thickness(box_sheets(type));
|
||||||
|
|
||||||
function box_bc_name(type, suffix) = let(name = box_name(type)) name == "box" ? suffix : str(name, "_", suffix); // Backwards compatibale name
|
function box_bc_name(type, suffix) = let(name = box_name(type)) name == "box" ? suffix : str(name, "_", suffix); // Backwards compatible name
|
||||||
|
|
||||||
grill_hole = 5;
|
grill_hole = 5;
|
||||||
grill_gap = 1.9;
|
grill_gap = 1.9;
|
||||||
@@ -285,6 +289,12 @@ module box_bezel(type, bottom) { //! Generates top and bottom bezel STLs
|
|||||||
box_screw_hole_positions(type)
|
box_screw_hole_positions(type)
|
||||||
poly_circle(screw_clearance_radius(box_screw(type)));
|
poly_circle(screw_clearance_radius(box_screw(type)));
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
// Optional child to subtract
|
||||||
|
//
|
||||||
|
if($children && !bottom)
|
||||||
|
translate_z(-box_profile_overlap(type))
|
||||||
|
children();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -373,7 +383,9 @@ module box_bezel_section(type, bottom, rows, cols, x, y) { //! Generates interlo
|
|||||||
union() {
|
union() {
|
||||||
clip(xmin = 0, xmax = w, ymin = 0, ymax = h)
|
clip(xmin = 0, xmax = w, ymin = 0, ymax = h)
|
||||||
translate([tw / 2 - x * w, th / 2 - y * h, profile_overlap])
|
translate([tw / 2 - x * w, th / 2 - y * h, profile_overlap])
|
||||||
box_bezel(type, bottom);
|
box_bezel(type, bottom)
|
||||||
|
if($children && !bottom)
|
||||||
|
children();
|
||||||
|
|
||||||
if(x < cols - 1 && y == 0)
|
if(x < cols - 1 && y == 0)
|
||||||
translate([w, 0])
|
translate([w, 0])
|
||||||
|
@@ -50,7 +50,9 @@ assembly(box_name(type)) {
|
|||||||
translate_z(z * (box_height(type) / 2 - box_corner_gap(type) + 50 * exploded()))
|
translate_z(z * (box_height(type) / 2 - box_corner_gap(type) + 50 * exploded()))
|
||||||
rotate([z * 90 - 90, 0, 0])
|
rotate([z * 90 - 90, 0, 0])
|
||||||
if(bezels && (z > 0 ? top : base))
|
if(bezels && (z > 0 ? top : base))
|
||||||
stl_colour(pp1_colour) render() box_bezel(type, z < 0);
|
stl_colour(pp1_colour) render() box_bezel(type, z < 0)
|
||||||
|
if(z > 0 && $children)
|
||||||
|
children();
|
||||||
|
|
||||||
translate_z(z * (box_height(type) / 2 + sheet_thickness + 50 * exploded()))
|
translate_z(z * (box_height(type) / 2 + sheet_thickness + 50 * exploded()))
|
||||||
box_screw_hole_positions(type)
|
box_screw_hole_positions(type)
|
||||||
|
@@ -4450,6 +4450,10 @@ screw type and printed part wall thickness. This diagram shows how the various d
|
|||||||
|
|
||||||
Normally the side sheets are the same type but they can be overridden individually as long as the substitute has the same thickness.
|
Normally the side sheets are the same type but they can be overridden individually as long as the substitute has the same thickness.
|
||||||
|
|
||||||
|
A box can have an optional name to allow more than one in the same project.
|
||||||
|
|
||||||
|
The top bezel can have an optional child, which is subtracted to allow modification.
|
||||||
|
|
||||||
[printed/box.scad](printed/box.scad) Implementation.
|
[printed/box.scad](printed/box.scad) Implementation.
|
||||||
|
|
||||||
[tests/box.scad](tests/box.scad) Code for this example.
|
[tests/box.scad](tests/box.scad) Code for this example.
|
||||||
|
Reference in New Issue
Block a user