1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-09-02 20:02:46 +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

@@ -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);