From ca1b34e9cad5d82bd878fa4ebf439c0fbdad7f77 Mon Sep 17 00:00:00 2001 From: Chris Palmer Date: Mon, 22 Mar 2021 16:11:51 +0000 Subject: [PATCH] Added `sink` parameter to `screw_polysink()` to recess the head. --- CHANGELOG.md | 3 +++ readme.md | 2 +- tests/screws.scad | 8 ++++++-- vitamins/screw.scad | 6 +++--- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 109ec19..86128e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ This changelog is generated by `changelog.py` using manually added semantic version tags to classify commits as breaking changes, additions or fixes. +#### [v15.1.1](https://github.com/nophead/NopSCADlib/releases/tag/v15.1.1 "show release") Fixes [...](https://github.com/nophead/NopSCADlib/compare/v15.1.0...v15.1.1 "diff with v15.1.0") +* 2021-03-22 [`cbab9ce`](https://github.com/nophead/NopSCADlib/commit/cbab9cea028a204032a91729597572a39ed893a2 "show commit") [C.P.](# "Chris Palmer") Fixed `M6_cs_cap_screw`. + ### [v15.1.0](https://github.com/nophead/NopSCADlib/releases/tag/v15.1.0 "show release") Additions [...](https://github.com/nophead/NopSCADlib/compare/v15.0.1...v15.1.0 "diff with v15.0.1") * 2021-03-21 [`4aa7dbb`](https://github.com/nophead/NopSCADlib/commit/4aa7dbb416773e42b2b5f77b345f18fcd4d2ae2c "show commit") [C.P.](# "Chris Palmer") Added `M6_cs_cap_screw`. diff --git a/readme.md b/readme.md index d19d6de..6a5c2b1 100644 --- a/readme.md +++ b/readme.md @@ -3005,7 +3005,7 @@ For an explanation of `screw_polysink()` see . // + +// Extra countersink depth +sink = 0; // [0 : 0.05: 1.0] + include <../core.scad> module polysink_stl() { @@ -32,9 +36,9 @@ module polysink_stl() { let(s = cs_screws[i]) translate([i * 20, 0]) { translate_z(size.z) - screw_polysink(s, 2 * size.z + 1); + screw_polysink(s, 2 * size.z + 1, sink = sink); - screw_polysink(s, 2 * size.z + 1, alt = true); + screw_polysink(s, 2 * size.z + 1, alt = true, sink = sink); } } } diff --git a/vitamins/screw.scad b/vitamins/screw.scad index 8cb9dba..5575453 100644 --- a/vitamins/screw.scad +++ b/vitamins/screw.scad @@ -284,10 +284,10 @@ function screw_polysink_r(type, z) = //! Countersink hole profile corrected for ) limit(head_rad + head_t - z + (sqrt(2) - 1) * layer_height / 2, screw_clearance_radius(type), head_rad); -module screw_polysink(type, h = 100, alt = false) { //! A countersink hole made from stacked polyholes for printed parts +module screw_polysink(type, h = 100, alt = false, sink = 0) { //! A countersink hole made from stacked polyholes for printed parts, default is flush, `sink` can be used to recess the head head_depth = screw_head_depth(type); assert(head_depth, "Not a countersunk screw"); - layers = ceil(head_depth / layer_height); + layers = ceil((head_depth + sink) / layer_height); rmin = screw_clearance_radius(type); sides = sides(rmin); lh = layer_height + eps; @@ -295,7 +295,7 @@ module screw_polysink(type, h = 100, alt = false) { //! A countersink hole made for(side = [0, 1]) mirror([0, 0, side]) { for(i = [0 : layers - 1]) translate_z(i * layer_height) { - r = screw_polysink_r(type, i * layer_height + layer_height / 2); + r = screw_polysink_r(type, i * layer_height + layer_height / 2 - sink); if(alt) rotate(i % 2 == layers % 2 ? 180 / sides : 0) poly_cylinder(r = r, h = lh, center = false, sides = sides);