From dd757a14617cb0c0f2bb4340cddd398a90b216da Mon Sep 17 00:00:00 2001 From: Chris Palmer Date: Thu, 10 Dec 2020 17:29:48 +0000 Subject: [PATCH] screw_head_depth() now defaults to all of a cs head if no diameter specified. --- readme.md | 2 +- vitamins/screw.scad | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 3d1a323..669c9c7 100644 --- a/readme.md +++ b/readme.md @@ -2930,7 +2930,7 @@ Machine screws and wood screws with various head styles. | Function | Description | |:--- |:--- | | ```screw_boss_diameter(type)``` | Boss big enough for nut trap and washer | -| ```screw_head_depth(type, d)``` | How far a counter sink head will go into a straight hole diameter d | +| ```screw_head_depth(type, d = 0)``` | How far a counter sink head will go into a straight hole diameter d | | ```screw_longer_than(x)``` | Returns shortest screw length longer or equal to x | | ```screw_nut_radius(type)``` | Radius of matching nut | | ```screw_shorter_than(x)``` | Returns longest screw length shorter than or equal to x | diff --git a/vitamins/screw.scad b/vitamins/screw.scad index 1658fcc..007b0df 100644 --- a/vitamins/screw.scad +++ b/vitamins/screw.scad @@ -41,7 +41,10 @@ function screw_pilot_hole(type) = type[11]; //! Pilot hole radius for w function screw_clearance_radius(type) = type[12]; //! Clearance hole radius function screw_nut_radius(type) = screw_nut(type) ? nut_radius(screw_nut(type)) : 0; //! Radius of matching nut function screw_boss_diameter(type) = max(washer_diameter(screw_washer(type)) + 1, 2 * (screw_nut_radius(type) + 3 * extrusion_width)); //! Boss big enough for nut trap and washer -function screw_head_depth(type, d) = screw_head_height(type) ? 0 : screw_head_radius(type) - d / 2 + screw_radius(type) / 5; //! How far a counter sink head will go into a straight hole diameter d +function screw_head_depth(type, d = 0) = //! How far a counter sink head will go into a straight hole diameter d + screw_head_height(type) + ? 0 + : let(r = screw_radius(type)) screw_head_radius(type) - max(r, d / 2) + r / 5; function screw_longer_than(x) = x <= 5 ? 5 : //! Returns shortest screw length longer or equal to x x <= 8 ? 8 :