From 53c3cdb598c9866290c4cb7423ebb761322f3e52 Mon Sep 17 00:00:00 2001 From: Chris Palmer Date: Sat, 12 Dec 2020 09:46:46 +0000 Subject: [PATCH] Added screw_polysink(). --- readme.md | 2 ++ vitamins/screw.scad | 20 +++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 74ede50..00a59ba 100644 --- a/readme.md +++ b/readme.md @@ -2933,6 +2933,7 @@ Machine screws and wood screws with various head styles. | ```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_polysink_r(type, z)``` | Countersink hole profile corrected for rounded staircase extrusions. | | ```screw_shorter_than(x)``` | Returns longest screw length shorter than or equal to x | ### Modules @@ -2941,6 +2942,7 @@ Machine screws and wood screws with various head styles. | ```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_countersink(type, drilled = true)``` | Countersink shape | +| ```screw_polysink(type)``` | A countersink hole made from stacked polyholes for printed parts | ![screws](tests/png/screws.png) diff --git a/vitamins/screw.scad b/vitamins/screw.scad index df8e007..3cbb3ed 100644 --- a/vitamins/screw.scad +++ b/vitamins/screw.scad @@ -258,7 +258,7 @@ module screw_countersink(type, drilled = true) { //! Countersink shape if(head_type == hs_cs || head_type == hs_cs_cap) translate_z(-head_height) if(drilled) - cylinder(h = head_height, r1 = 0, r2 = head_rad + head_t); + cylinder(h = head_height + eps, r1 = 0, r2 = head_rad + head_t); else intersection() { cylinder(h = head_height + eps, r1 = 0, r2 = head_rad + head_t); @@ -267,6 +267,24 @@ module screw_countersink(type, drilled = true) { //! Countersink shape } } +function screw_polysink_r(type, z) = //! Countersink hole profile corrected for rounded staircase extrusions. + let(rad = screw_radius(type), + head_t = rad / 5, + head_rad = screw_head_radius(type) + ) + limit(head_rad + head_t - z + (sqrt(2) - 1) * layer_height / 2, screw_clearance_radius(type), head_rad); + +module screw_polysink(type) { //! A countersink hole made from stacked polyholes for printed parts + head_depth = screw_head_depth(type); + assert(head_depth, "Not a countersunk screw"); + layers = ceil(head_depth / layer_height); + for(i = [0 : layers - 1], side = [-1, 1]) + translate_z(side * (i + 0.5) * layer_height) + poly_cylinder(r = screw_polysink_r(type, i * layer_height + layer_height / 2), h = layer_height + 2 * eps, center = true); + + poly_cylinder(r = screw_clearance_radius(type), h = 100, center = true); +} + module 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 washer = screw_washer(type); head_type = screw_head_type(type);