1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-08-24 08:02:57 +02:00

Butt_box now has a thin_blocks property to make it use 2screw_blocks instead of fixing blocks along the edges.

This commit is contained in:
Chris Palmer
2022-01-29 13:49:04 +00:00
parent c4ccc30b35
commit 43408843af
2 changed files with 18 additions and 7 deletions

View File

@@ -31,7 +31,8 @@
//! * An optional list of fixing blocks to be omitted can be given. //! * An optional list of fixing blocks to be omitted can be given.
//! * Star washers can be omitted by setting the 11th parameter to false. //! * Star washers can be omitted by setting the 11th parameter to false.
//! //!
//! Uses [fixing blocks](#fixing_block) and [corner blocks](#corner_block). //! Uses [fixing blocks](#fixing_block) and [corner blocks](#corner_block) by default. Setting `thin_blocks` uses 2screw_blocks instead of
//! fixing_blocks along the sides.
// //
use <fixing_block.scad> use <fixing_block.scad>
@@ -49,9 +50,10 @@ function bbox_height(type) = type[7]; //! Internal height
function bbox_name(type) = type[8]; //! Optional name if there is more than one box in a project function bbox_name(type) = type[8]; //! Optional name if there is more than one box in a project
function bbox_skip_blocks(type)= type[9]; //! List of fixing blocks to skip, used to allow a hinged panel for example function bbox_skip_blocks(type)= type[9]; //! List of fixing blocks to skip, used to allow a hinged panel for example
function bbox_star_washers(type)= type[10];//! Set to false to remove star washers. function bbox_star_washers(type)= type[10];//! Set to false to remove star washers.
function bbox_thin_blocks(type) = type[11];//! Set for 2 screw blocks instead of three hole fixing blocks.
function bbox(screw, sheets, base_sheet, top_sheet, span, size, name = "bbox", skip_blocks = [], star_washers = true) = //! Construct the property list for a butt_box function bbox(screw, sheets, base_sheet, top_sheet, span, size, name = "bbox", skip_blocks = [], star_washers = true, thin_blocks = false) = //! Construct the property list for a butt_box
[ screw, sheets, base_sheet, top_sheet, span, size.x, size.y, size.z, name, skip_blocks, star_washers ]; [ screw, sheets, base_sheet, top_sheet, span, size.x, size.y, size.z, name, skip_blocks, star_washers, thin_blocks ];
function bbox_volume(type) = bbox_width(type) * bbox_depth(type) * bbox_height(type) / 1000000; //! Internal volume in litres function bbox_volume(type) = bbox_width(type) * bbox_depth(type) * bbox_height(type) / 1000000; //! Internal volume in litres
function bbox_area(type) = let(w = bbox_width(type), d = bbox_depth(type), h = bbox_height(type)) //! Internal surface area in m^2 function bbox_area(type) = let(w = bbox_width(type), d = bbox_depth(type), h = bbox_height(type)) //! Internal surface area in m^2
@@ -108,7 +110,10 @@ function fixing_block_positions(type) = let(
rotate([y > 0 ? 180 : 0, x * y * 90, 0]), rotate([y > 0 ? 180 : 0, x * y * 90, 0]),
]; ];
function side_holes(type) = [for(p = fixing_block_positions(type), q = fixing_block_holes(bbox_screw(type))) p * q]; function side_holes(type) = let(
screw = bbox_screw(type),
holes = bbox_thin_blocks(type) ? 2screw_block_holes(screw) : fixing_block_holes(screw))
[for(p = fixing_block_positions(type), q = holes) p * q];
module bbox_drill_holes(type, t) module bbox_drill_holes(type, t)
position_children(concat(corner_holes(type), side_holes(type)), t) position_children(concat(corner_holes(type), side_holes(type)), t)
@@ -232,6 +237,7 @@ module _bbox_assembly(type, top = true, base = true, left = true, right = true,
bt = sheet_thickness(bbox_base_sheet(type)); bt = sheet_thickness(bbox_base_sheet(type));
tt = sheet_thickness(bbox_top_sheet(type)); tt = sheet_thickness(bbox_top_sheet(type));
star_washers = bbox_star_washers(type); star_washers = bbox_star_washers(type);
thin_blocks = bbox_thin_blocks(type);
function is_missing_screw(p) = p.y > depth / 2 - 1 ? !back : false; function is_missing_screw(p) = p.y > depth / 2 - 1 ? !back : false;
@@ -247,6 +253,9 @@ module _bbox_assembly(type, top = true, base = true, left = true, right = true,
for(p = fixing_block_positions(type)) for(p = fixing_block_positions(type))
let(q = transform([0, 0, 0], p), thickness = q.z > h ? tt : q.z < -h ? bt : t) let(q = transform([0, 0, 0], p), thickness = q.z > h ? tt : q.z < -h ? bt : t)
multmatrix(p) multmatrix(p)
if(thin_blocks)
fastened_2screw_block_assembly(is_missing_screw(q) ? 0 : t, bbox_screw(type), thickness_below = thickness, star_washers = star_washers);
else
fastened_fixing_block_assembly(is_missing_screw(q) ? 0 : t, bbox_screw(type), thickness2 = thickness, star_washers = star_washers); fastened_fixing_block_assembly(is_missing_screw(q) ? 0 : t, bbox_screw(type), thickness2 = thickness, star_washers = star_washers);
for(x = [-1, 1]) for(x = [-1, 1])

View File

@@ -4568,7 +4568,8 @@ maximum spacing.
* An optional list of fixing blocks to be omitted can be given. * An optional list of fixing blocks to be omitted can be given.
* Star washers can be omitted by setting the 11th parameter to false. * Star washers can be omitted by setting the 11th parameter to false.
Uses [fixing blocks](#fixing_block) and [corner blocks](#corner_block). Uses [fixing blocks](#fixing_block) and [corner blocks](#corner_block) by default. Setting `thin_blocks` uses 2screw_blocks instead of
fixing_blocks along the sides.
[printed/butt_box.scad](printed/butt_box.scad) Implementation. [printed/butt_box.scad](printed/butt_box.scad) Implementation.
@@ -4586,13 +4587,14 @@ Uses [fixing blocks](#fixing_block) and [corner blocks](#corner_block).
| `bbox_skip_blocks(type)` | List of fixing blocks to skip, used to allow a hinged panel for example | | `bbox_skip_blocks(type)` | List of fixing blocks to skip, used to allow a hinged panel for example |
| `bbox_span(type)` | Maximum span between fixing blocks | | `bbox_span(type)` | Maximum span between fixing blocks |
| `bbox_star_washers(type)` | Set to false to remove star washers. | | `bbox_star_washers(type)` | Set to false to remove star washers. |
| `bbox_thin_blocks(type)` | Set for 2 screw blocks instead of three hole fixing blocks. |
| `bbox_top_sheet(type)` | Sheet type for the top | | `bbox_top_sheet(type)` | Sheet type for the top |
| `bbox_width(type)` | Internal width | | `bbox_width(type)` | Internal width |
### Functions ### Functions
| Function | Description | | Function | Description |
|:--- |:--- | |:--- |:--- |
| `bbox(screw, sheets, base_sheet, top_sheet, span, size, name = "bbox", skip_blocks = [], star_washers = true)` | Construct the property list for a butt_box | | `bbox(screw, sheets, base_sheet, top_sheet, span, size, name = "bbox", skip_blocks = [], star_washers = true, thin_blocks = false)` | Construct the property list for a butt_box |
| `bbox_area(type)` | Internal surface area in m^2 | | `bbox_area(type)` | Internal surface area in m^2 |
| `bbox_volume(type)` | Internal volume in litres | | `bbox_volume(type)` | Internal volume in litres |