Fixed countersink shape.

This commit is contained in:
Chris Palmer 2020-12-10 23:27:27 +00:00
parent dd757a1461
commit 344e8d1583
5 changed files with 14 additions and 5 deletions

View File

@ -2940,7 +2940,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)``` | Countersink shape |
| ```screw_countersink(type, drilled = true)``` | Countersink shape |
![screws](tests/png/screws.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 62 KiB

View File

@ -116,7 +116,7 @@ module mains_socket(type) { //! Draw specified 13A socket
cylinder(r = screw_clearance_radius(screw), h = 100, center = true);
translate_z(height)
screw_countersink(screw);
screw_countersink(screw, drilled = false);
}
}
}

View File

@ -247,14 +247,23 @@ module screw(type, length, hob_point = 0, nylon = false) { //! Draw specified sc
}
}
module screw_countersink(type) { //! Countersink shape
module screw_countersink(type, drilled = true) { //! Countersink shape
head_type = screw_head_type(type);
head_rad = screw_head_radius(type);
head_height = head_rad;
rad = screw_radius(type);
head_t = rad / 5;
head_height = head_rad + head_t;
if(head_type == hs_cs || head_type == hs_cs_cap)
translate_z(-head_height)
cylinder(h = head_height, r1 = 0, r2 = head_rad);
if(drilled)
cylinder(h = head_height, r1 = 0, r2 = head_rad + head_t);
else
intersection() {
cylinder(h = head_height + eps, r1 = 0, r2 = head_rad + head_t);
cylinder(h = head_height + eps, r = head_rad + eps);
}
}
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