mirror of
https://github.com/DJSundog/NopSCADlib.git
synced 2024-11-23 15:23:51 -05:00
Added functions to create property lists that are created by the client.
Foot, box, bbox, pbox, flat_hinge and strap_handle.
This commit is contained in:
parent
c9aad0178e
commit
70b13d2f27
@ -52,6 +52,9 @@ function box_width(type) = type[6]; //! Internal width
|
|||||||
function box_depth(type) = type[7]; //! Internal depth
|
function box_depth(type) = type[7]; //! Internal depth
|
||||||
function box_height(type) = type[8]; //! Internal height
|
function box_height(type) = type[8]; //! Internal height
|
||||||
|
|
||||||
|
function box(screw, wall, sheets, top_sheet, base_sheet, size, feet = false) = //! Construct a property list for a box.
|
||||||
|
concat([screw, wall, sheets, top_sheet, base_sheet, feet], size);
|
||||||
|
|
||||||
function box_bezel_clearance(type) = bezel_clearance;
|
function box_bezel_clearance(type) = bezel_clearance;
|
||||||
|
|
||||||
function box_corner_gap(type) = 3; //! Gap between box_sheets at the corners to connect inside and outside profiles
|
function box_corner_gap(type) = 3; //! Gap between box_sheets at the corners to connect inside and outside profiles
|
||||||
|
@ -50,6 +50,9 @@ 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 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 star_washers(type) = type[10] ? type[10] : is_undef(type[10]); //! Set to false to remove star washers.
|
||||||
|
|
||||||
|
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
|
||||||
|
[ screw, sheets, base_sheet, top_sheet, span, size.x, size.y, size.z, name, skip_blocks, star_washers ];
|
||||||
|
|
||||||
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 surdface area in m^2
|
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;
|
2 * (w * d + w * h + d * h) / 1000000;
|
||||||
|
@ -42,6 +42,9 @@ function hinge_screws(type) = type[8]; //! How many screws
|
|||||||
function hinge_clearance(type) = type[9]; //! Clearance between knuckles
|
function hinge_clearance(type) = type[9]; //! Clearance between knuckles
|
||||||
function hinge_margin(type) = type[10]; //! How far to keep the screws from the knuckes
|
function hinge_margin(type) = type[10]; //! How far to keep the screws from the knuckes
|
||||||
|
|
||||||
|
function flat_hinge(name, size, pin_d, knuckle_d, knuckles, screw, screws, clearance, margin) = //! Construct the property list for a flat hinge.
|
||||||
|
[name, size.x, size.y, size.z, pin_d, knuckle_d, knuckles, screw, screws, clearance, margin];
|
||||||
|
|
||||||
function hinge_radius(type) = washer_radius(screw_washer(hinge_screw(type))) + 1;
|
function hinge_radius(type) = washer_radius(screw_washer(hinge_screw(type))) + 1;
|
||||||
|
|
||||||
module hinge_screw_positions(type) { //! Place children at the screw positions
|
module hinge_screw_positions(type) { //! Place children at the screw positions
|
||||||
|
@ -24,8 +24,10 @@
|
|||||||
include <../core.scad>
|
include <../core.scad>
|
||||||
use <../vitamins/insert.scad>
|
use <../vitamins/insert.scad>
|
||||||
|
|
||||||
foot = [25, 12, 3, 2, M4_cap_screw, 10];
|
function Foot(d, h, t, r, screw, slant = 10) = [d, h, t, r, screw, slant]; //! Construct a foot property list
|
||||||
insert_foot = [20, 10, 0, 2, M3_cap_screw, 10];
|
|
||||||
|
foot = Foot(25, 12, 3, 2, M4_cap_screw);
|
||||||
|
insert_foot = Foot(20, 10, 0, 2, M3_cap_screw);
|
||||||
|
|
||||||
function insert_foot() = insert_foot; //! Default foot with insert
|
function insert_foot() = insert_foot; //! Default foot with insert
|
||||||
|
|
||||||
|
@ -30,6 +30,9 @@ include <../core.scad>
|
|||||||
use <../vitamins/insert.scad>
|
use <../vitamins/insert.scad>
|
||||||
use <foot.scad>
|
use <foot.scad>
|
||||||
|
|
||||||
|
function pbox(name, wall, top_t, base_t, radius, size, foot = false, screw = false, ridges = [0, 0]) //! Construct a printed box property list
|
||||||
|
= concat([name, wall, top_t, base_t, foot, screw, radius, ridges], size);
|
||||||
|
|
||||||
function pbox_name(type) = type[0]; //! Name to allow more than one box in a project
|
function pbox_name(type) = type[0]; //! Name to allow more than one box in a project
|
||||||
function pbox_wall(type) = type[1]; //! Wall thickness
|
function pbox_wall(type) = type[1]; //! Wall thickness
|
||||||
function pbox_top(type) = type[2]; //! Top thickness
|
function pbox_top(type) = type[2]; //! Top thickness
|
||||||
|
@ -24,8 +24,7 @@
|
|||||||
include <../core.scad>
|
include <../core.scad>
|
||||||
use <../vitamins/insert.scad>
|
use <../vitamins/insert.scad>
|
||||||
|
|
||||||
strap = [18, 2, M3_pan_screw, 3, 25];
|
strap = strap();
|
||||||
function strap() = strap;
|
|
||||||
|
|
||||||
wall = 2;
|
wall = 2;
|
||||||
clearance = 0.5;
|
clearance = 0.5;
|
||||||
@ -40,6 +39,10 @@ function strap_screw(type = strap) = type[2]; //! Screw type
|
|||||||
function strap_panel(type = strap) = type[3]; //! Panel thickness
|
function strap_panel(type = strap) = type[3]; //! Panel thickness
|
||||||
function strap_extension(type = strap) = type[4]; //! How much length of the strap that can pull out
|
function strap_extension(type = strap) = type[4]; //! How much length of the strap that can pull out
|
||||||
|
|
||||||
|
|
||||||
|
function strap(width = 18, thickness = 2, screw = M3_pan_screw, panel_thickness = 3, extension = 25) = //! Construct a property list for a strap
|
||||||
|
[ width, thickness, screw, panel_thickness, extension ];
|
||||||
|
|
||||||
function strap_insert(type) = screw_insert(strap_screw(type)); //! The insert type
|
function strap_insert(type) = screw_insert(strap_screw(type)); //! The insert type
|
||||||
function strap_key(type) = strap_panel(type) - panel_clearance;
|
function strap_key(type) = strap_panel(type) - panel_clearance;
|
||||||
function strap_height(type) = wall + max(insert_length(strap_insert(type)) - strap_key(type), strap_thickness(type) + clearance); //! Height of the ends
|
function strap_height(type) = wall + max(insert_length(strap_insert(type)) - strap_key(type), strap_thickness(type) + clearance); //! Height of the ends
|
||||||
|
10
readme.md
10
readme.md
@ -3863,6 +3863,7 @@ Normally the side sheets are the same type but they can be overridden individual
|
|||||||
### Functions
|
### Functions
|
||||||
| Function | Description |
|
| Function | Description |
|
||||||
|:--- |:--- |
|
|:--- |:--- |
|
||||||
|
| ```box(screw, wall, sheets, top_sheet, base_sheet, size, feet = false)``` | Construct a property list for a box. |
|
||||||
| ```box_bezel_height(type, bottom)``` | Bezel height for top or bottom |
|
| ```box_bezel_height(type, bottom)``` | Bezel height for top or bottom |
|
||||||
| ```box_corner_gap(type)``` | Gap between box_sheets at the corners to connect inside and outside profiles |
|
| ```box_corner_gap(type)``` | Gap between box_sheets at the corners to connect inside and outside profiles |
|
||||||
| ```box_inset(type)``` | How much the bezel intrudes on the specified width and length, away from the corners |
|
| ```box_inset(type)``` | How much the bezel intrudes on the specified width and length, away from the corners |
|
||||||
@ -3974,6 +3975,7 @@ Uses [fixing blocks](#fixing_block) and [corner blocks](#corner_block).
|
|||||||
### 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_area(type)``` | Internal surdface area in m^2 |
|
| ```bbox_area(type)``` | Internal surdface area in m^2 |
|
||||||
| ```bbox_volume(type)``` | Internal volume in litres |
|
| ```bbox_volume(type)``` | Internal volume in litres |
|
||||||
|
|
||||||
@ -4441,6 +4443,11 @@ This allows the hinges and one set of screws to belong to one assembly and the o
|
|||||||
| ```hinge_thickness(type)``` | Thickness of the leaves |
|
| ```hinge_thickness(type)``` | Thickness of the leaves |
|
||||||
| ```hinge_width(type)``` | Width |
|
| ```hinge_width(type)``` | Width |
|
||||||
|
|
||||||
|
### Functions
|
||||||
|
| Function | Description |
|
||||||
|
|:--- |:--- |
|
||||||
|
| ```flat_hinge(name, size, pin_d, knuckle_d, knuckles, screw, screws, clearance, margin)``` | Construct the property list for a flat hinge. |
|
||||||
|
|
||||||
### Modules
|
### Modules
|
||||||
| Module | Description |
|
| Module | Description |
|
||||||
|:--- |:--- |
|
|:--- |:--- |
|
||||||
@ -4502,6 +4509,7 @@ inserts don't grip well in rubber.
|
|||||||
### Functions
|
### Functions
|
||||||
| Function | Description |
|
| Function | Description |
|
||||||
|:--- |:--- |
|
|:--- |:--- |
|
||||||
|
| ```Foot(d, h, t, r, screw, slant = 10)``` | Construct a foot property list |
|
||||||
| ```insert_foot()``` | Default foot with insert |
|
| ```insert_foot()``` | Default foot with insert |
|
||||||
|
|
||||||
### Modules
|
### Modules
|
||||||
@ -4672,6 +4680,7 @@ It can also have printed feet on the base with the screws doubling up to hold th
|
|||||||
### Functions
|
### Functions
|
||||||
| Function | Description |
|
| Function | Description |
|
||||||
|:--- |:--- |
|
|:--- |:--- |
|
||||||
|
| ```pbox(name, wall, top_t, base_t, radius, size, foot = false, screw = false, ridges = [0, 0])``` | Construct a printed box property list |
|
||||||
| ```pbox_inclusion(type)``` | How far the ledge for the base extends inwards |
|
| ```pbox_inclusion(type)``` | How far the ledge for the base extends inwards |
|
||||||
| ```pbox_insert(type)``` | The insert for the base screws |
|
| ```pbox_insert(type)``` | The insert for the base screws |
|
||||||
| ```pbox_screw(type)``` | Foot screw if got feet else base_screw |
|
| ```pbox_screw(type)``` | Foot screw if got feet else base_screw |
|
||||||
@ -4999,6 +5008,7 @@ be fully customised by passing a list of properties.
|
|||||||
### Functions
|
### Functions
|
||||||
| Function | Description |
|
| Function | Description |
|
||||||
|:--- |:--- |
|
|:--- |:--- |
|
||||||
|
| ```strap(width = 18, thickness = 2, screw = M3_pan_screw, panel_thickness = 3, extension = 25)``` | Construct a property list for a strap |
|
||||||
| ```strap_end_width(type = strap)``` | Width of the ends |
|
| ```strap_end_width(type = strap)``` | Width of the ends |
|
||||||
| ```strap_height(type)``` | Height of the ends |
|
| ```strap_height(type)``` | Height of the ends |
|
||||||
| ```strap_insert(type)``` | The insert type |
|
| ```strap_insert(type)``` | The insert type |
|
||||||
|
@ -23,7 +23,7 @@ use <../vitamins/insert.scad>
|
|||||||
|
|
||||||
use <../printed/box.scad>
|
use <../printed/box.scad>
|
||||||
|
|
||||||
box = [M3_dome_screw, 3, DiBond, PMMA3, DiBond6, true, 150, 100, 70];
|
box = box(screw = M3_dome_screw, wall = 3, sheets = DiBond, top_sheet = PMMA3, base_sheet = DiBond6, feet = true, size = [150, 100, 70]);
|
||||||
|
|
||||||
include <../printed/box_assembly.scad>
|
include <../printed/box_assembly.scad>
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ include <../printed/butt_box.scad>
|
|||||||
|
|
||||||
$explode = 0;
|
$explode = 0;
|
||||||
|
|
||||||
box = [M3_dome_screw, DiBond, DiBond6, PMMA3, 250, 400, 300, 120];
|
box = bbox(screw = M3_dome_screw, sheets = DiBond, base_sheet = DiBond6, top_sheet = PMMA3, span = 250, size = [400, 300, 120]);
|
||||||
|
|
||||||
module bbox_assembly() _bbox_assembly(box);
|
module bbox_assembly() _bbox_assembly(box);
|
||||||
|
|
||||||
|
@ -32,8 +32,8 @@ clearance = 0.2;
|
|||||||
|
|
||||||
angle = 0; // [-90 : 180]
|
angle = 0; // [-90 : 180]
|
||||||
|
|
||||||
big_hinge = ["big", width, depth, thickness, pin_diameter, knuckle_diameter, knuckles, M3_dome_screw, screws, clearance, margin];
|
big_hinge = flat_hinge(name = "big", size = [width, depth, thickness], pin_d = pin_diameter, knuckle_d = knuckle_diameter, knuckles = knuckles, screw = M3_dome_screw, screws = screws, clearance = clearance, margin = margin);
|
||||||
small_hinge = ["small", 20, 16, 2, 2.85, 7, 3, M3_dome_screw, 2, 0.2, 0];
|
small_hinge = flat_hinge(name = "small", size =[ 20, 16, 2], pin_d = 2.85, knuckle_d = 7, knuckles = 3, screw = M3_dome_screw, screws = 2, clearance = 0.2, margin = 0);
|
||||||
|
|
||||||
hinges = [small_hinge, big_hinge];
|
hinges = [small_hinge, big_hinge];
|
||||||
|
|
||||||
|
@ -21,25 +21,25 @@ include <../core.scad>
|
|||||||
use <../printed/foot.scad>
|
use <../printed/foot.scad>
|
||||||
use <../printed/printed_box.scad>
|
use <../printed/printed_box.scad>
|
||||||
|
|
||||||
foot = [13, 5, 2, 1, M3_pan_screw, 10];
|
foot = Foot(d = 13, h = 5, t = 2, r = 1, screw = M3_pan_screw);
|
||||||
module foot_stl() foot(foot);
|
module foot_stl() foot(foot);
|
||||||
|
|
||||||
wall = 2;
|
wall = 2;
|
||||||
top_thickness = 2;
|
top_thickness = 2;
|
||||||
base_thickness = 2;
|
base_thickness = 2;
|
||||||
case_inner_rad = 8;
|
inner_rad = 8;
|
||||||
|
|
||||||
width = 80;
|
width = 80;
|
||||||
depth = 45;
|
depth = 45;
|
||||||
height = 40;
|
height = 40;
|
||||||
|
|
||||||
box1 = ["box1", wall, top_thickness, base_thickness, false, M2_cap_screw, case_inner_rad, [8, 1], width, depth, height];
|
box1 = pbox(name = "box1", wall = wall, top_t = top_thickness, base_t = base_thickness, radius = inner_rad, size = [width, depth, height], screw = M2_cap_screw, ridges = [8, 1]);
|
||||||
box2 = ["smooth_box", wall, top_thickness, base_thickness, foot, false, case_inner_rad, [0, 0], width, depth, height];
|
box2 = pbox(name = "smooth_box", wall = wall, top_t = top_thickness, base_t = base_thickness, radius = inner_rad, size = [width, depth, height], foot = foot);
|
||||||
|
|
||||||
module box1_feet_positions() {
|
module box1_feet_positions() {
|
||||||
clearance = 2;
|
clearance = 2;
|
||||||
foot_r = foot_diameter(foot) / 2;
|
foot_r = foot_diameter(foot) / 2;
|
||||||
x_inset = case_inner_rad + foot_r - pbox_ridges(box1).y;
|
x_inset = inner_rad + foot_r - pbox_ridges(box1).y;
|
||||||
z_inset = foot_r + clearance;
|
z_inset = foot_r + clearance;
|
||||||
h = height + base_thickness;
|
h = height + base_thickness;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user