Added screw_polysink().

This commit is contained in:
Chris Palmer 2020-12-12 09:46:46 +00:00
parent f4857f6862
commit 53c3cdb598
2 changed files with 21 additions and 1 deletions

View File

@ -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_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_longer_than(x)``` | Returns shortest screw length longer or equal to x |
| ```screw_nut_radius(type)``` | Radius of matching nut | | ```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 | | ```screw_shorter_than(x)``` | Returns longest screw length shorter than or equal to x |
### Modules ### 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(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)``` | A countersink hole made from stacked polyholes for printed parts |
![screws](tests/png/screws.png) ![screws](tests/png/screws.png)

View File

@ -258,7 +258,7 @@ module screw_countersink(type, drilled = true) { //! Countersink shape
if(head_type == hs_cs || head_type == hs_cs_cap) if(head_type == hs_cs || head_type == hs_cs_cap)
translate_z(-head_height) translate_z(-head_height)
if(drilled) 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 else
intersection() { intersection() {
cylinder(h = head_height + eps, r1 = 0, r2 = head_rad + head_t); 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 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); washer = screw_washer(type);
head_type = screw_head_type(type); head_type = screw_head_type(type);