From 8c51183ba6163ba15080058096965a9e43c95215 Mon Sep 17 00:00:00 2001 From: Chris Palmer Date: Tue, 22 Oct 2019 15:34:08 +0100 Subject: [PATCH] Added volume and area functions to butt_box. --- printed/butt_box.scad | 6 +++++- readme.md | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/printed/butt_box.scad b/printed/butt_box.scad index 6880fa9..703e704 100644 --- a/printed/butt_box.scad +++ b/printed/butt_box.scad @@ -50,6 +50,10 @@ function bbox_name(type) = type[8] ? type[8] : "bbox"; //! Optional name i function bbox_skip_blocks(type)= type[9] ? type[9] : []; //! List of fixing blocks to skip, used to allow a hinged panel for example function star_washers(type) = type[10] ? type[10] : is_undef(type[10]); //! Set to false to remove star washers. +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 surdface area in m^2 + 2 * (w * d + w * h + d * h) / 1000000; + module bbox_shelf_blank(type) { //! 2D template for a shelf dxf(str(bbox_name(type), "_shelf")); @@ -205,7 +209,7 @@ module _bbox_assembly(type, top = true, base = true, left = true, right = true, width = bbox_width(type); depth = bbox_depth(type); height = bbox_height(type); - echo("Box:", width, depth, height); + echo("Box:", width, depth, height, volume = bbox_volume(type), area = bbox_area(type)); t = sheet_thickness(bbox_sheets(type)); bt = sheet_thickness(bbox_base_sheet(type)); diff --git a/readme.md b/readme.md index 9bb787b..3a766b0 100644 --- a/readme.md +++ b/readme.md @@ -3243,6 +3243,12 @@ Uses [fixing blocks](#fixing_block) and [corner blocks](#corner_block). | ```bbox_width(type)``` | Internal width | | ```star_washers(type)``` | Set to false to remove star washers. | +### Functions +| Function | Description | +|:--- |:--- | +| ```bbox_area(type)``` | Internal surdface area in m^2 | +| ```bbox_volume(type)``` | Internal volume in litres | + ### Modules | Module | Description | |:--- |:--- | @@ -3253,6 +3259,7 @@ Uses [fixing blocks](#fixing_block) and [corner blocks](#corner_block). | ```bbox_base_blank(type)``` | 2D template for the base | | ```bbox_front(type)``` | Default front, can be overridden to customise | | ```bbox_front_blank(type, sheet = false)``` | 2D template for the front | +| ```bbox_front_blank(type, sheet = false, width = 0)``` | 2D template for the front | | ```bbox_left(type)``` | Default left side, can be overridden to customise | | ```bbox_left_blank(type, sheet = false)``` | 2D template for the left side | | ```bbox_right(type)``` | Default right side, can be overridden to customise |