1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-08-11 09:53:58 +02:00

Added sink parameter to screw_polysink() to recess the head.

This commit is contained in:
Chris Palmer
2021-03-22 16:11:51 +00:00
parent cbab9cea02
commit ca1b34e9ca
4 changed files with 13 additions and 6 deletions

View File

@@ -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. 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") ### [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`. * 2021-03-21 [`4aa7dbb`](https://github.com/nophead/NopSCADlib/commit/4aa7dbb416773e42b2b5f77b345f18fcd4d2ae2c "show commit") [C.P.](# "Chris Palmer") Added `M6_cs_cap_screw`.

View File

@@ -3005,7 +3005,7 @@ For an explanation of `screw_polysink()` see <https://hydraraptor.blogspot.com/2
| `screw(type, length, hob_point = 0, nylon = false)` | Draw specified screw, optionally hobbed or nylon | | `screw(type, length, hob_point = 0, nylon = false)` | Draw specified screw, optionally hobbed or nylon |
| `screw_and_washer(type, length, star = false, penny = false)` | Screw with a washer which can be standard or penny and an optional star washer on top | | `screw_and_washer(type, length, star = false, penny = false)` | Screw with a washer which can be standard or penny and an optional star washer on top |
| `screw_countersink(type, drilled = true)` | Countersink shape | | `screw_countersink(type, drilled = true)` | Countersink shape |
| `screw_polysink(type, h = 100, alt = false)` | A countersink hole made from stacked polyholes for printed parts | | `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 |
![screws](tests/png/screws.png) ![screws](tests/png/screws.png)

View File

@@ -16,6 +16,10 @@
// You should have received a copy of the GNU General Public License along with NopSCADlib. // You should have received a copy of the GNU General Public License along with NopSCADlib.
// If not, see <https://www.gnu.org/licenses/>. // If not, see <https://www.gnu.org/licenses/>.
// //
// Extra countersink depth
sink = 0; // [0 : 0.05: 1.0]
include <../core.scad> include <../core.scad>
module polysink_stl() { module polysink_stl() {
@@ -32,9 +36,9 @@ module polysink_stl() {
let(s = cs_screws[i]) let(s = cs_screws[i])
translate([i * 20, 0]) { translate([i * 20, 0]) {
translate_z(size.z) 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);
} }
} }
} }

View File

@@ -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); 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); head_depth = screw_head_depth(type);
assert(head_depth, "Not a countersunk screw"); 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); rmin = screw_clearance_radius(type);
sides = sides(rmin); sides = sides(rmin);
lh = layer_height + eps; 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(side = [0, 1]) mirror([0, 0, side]) {
for(i = [0 : layers - 1]) for(i = [0 : layers - 1])
translate_z(i * layer_height) { 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) if(alt)
rotate(i % 2 == layers % 2 ? 180 / sides : 0) rotate(i % 2 == layers % 2 ? 180 / sides : 0)
poly_cylinder(r = r, h = lh, center = false, sides = sides); poly_cylinder(r = r, h = lh, center = false, sides = sides);