mirror of
https://github.com/DJSundog/NopSCADlib.git
synced 2024-11-23 07:13:51 -05:00
screw_polysink now has an alternating layer option to be more printable inverted.
The screws test now tests polysinks and has printable sample.
This commit is contained in:
parent
bf618bb482
commit
157ff60e19
BIN
libtest.png
BIN
libtest.png
Binary file not shown.
Before Width: | Height: | Size: 852 KiB After Width: | Height: | Size: 854 KiB |
@ -2944,7 +2944,7 @@ For an explanation of ```screw_polysink()``` see <https://hydraraptor.blogspot.c
|
||||
| ```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 |
|
||||
| ```screw_polysink(type, h = 100, alt = false)``` | A countersink hole made from stacked polyholes for printed parts |
|
||||
|
||||
![screws](tests/png/screws.png)
|
||||
|
||||
@ -2983,6 +2983,11 @@ For an explanation of ```screw_polysink()``` see <https://hydraraptor.blogspot.c
|
||||
| 1 | ```screw(No6_cs_screw, 30)``` | Screw No6 cs wood x 30mm |
|
||||
| 1 | ```screw(No6_screw, 30)``` | Screw No6 pan wood x 30mm |
|
||||
|
||||
### Printed
|
||||
| Qty | Filename |
|
||||
| ---:|:--- |
|
||||
| 1 | polysink.stl |
|
||||
|
||||
|
||||
<a href="#top">Top</a>
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 146 KiB |
@ -18,20 +18,46 @@
|
||||
//
|
||||
include <../core.scad>
|
||||
|
||||
module screws()
|
||||
for(y = [0 : len(screw_lists) -1])
|
||||
for(x = [0 : len(screw_lists[y]) -1]) {
|
||||
screw = screw_lists[y][x];
|
||||
if(screw) {
|
||||
length = screw_head_type(screw) == hs_grub ? 6
|
||||
: screw_radius(screw) <= 1.5 ? 10
|
||||
: screw_max_thread(screw) ? screw_longer_than(screw_max_thread(screw) + 5)
|
||||
: 30;
|
||||
translate([x * 20, y * 20])
|
||||
screw(screw, length);
|
||||
}
|
||||
module polysink_stl() {
|
||||
stl("polysink");
|
||||
|
||||
cs_screws = [for(list = screw_lists, screw = list) if(screw_head_type(screw) == hs_cs_cap) screw];
|
||||
n = len(cs_screws);
|
||||
size = [n * 20, 20, 10];
|
||||
difference() {
|
||||
translate([-size.x / n / 2, $preview ? 0 : -size.y / 2, -size.z])
|
||||
cube($preview ? [size.x, size.y / 2, size.z] : size);
|
||||
|
||||
for(i = [0 : n - 1])
|
||||
let(s = cs_screws[i])
|
||||
translate([i * 20, 0]) {
|
||||
screw_polysink(s, 2 * size.z + 1);
|
||||
|
||||
translate_z(-size.z)
|
||||
screw_polysink(s, 2 * size.z + 1, alt = true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module screws() {
|
||||
for(y = [0 : len(screw_lists) -1])
|
||||
for(x = [0 : len(screw_lists[y]) -1]) {
|
||||
screw = screw_lists[y][x];
|
||||
if(screw) {
|
||||
length = screw_head_type(screw) == hs_grub ? 6
|
||||
: screw_radius(screw) <= 1.5 ? 10
|
||||
: screw_max_thread(screw) ? screw_longer_than(screw_max_thread(screw) + 5)
|
||||
: 30;
|
||||
translate([x * 20, y * 20])
|
||||
screw(screw, length);
|
||||
}
|
||||
}
|
||||
translate([80, 140])
|
||||
polysink_stl();
|
||||
}
|
||||
|
||||
if($preview)
|
||||
let($show_threads = true)
|
||||
screws();
|
||||
else
|
||||
polysink_stl();
|
||||
|
@ -276,15 +276,28 @@ 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) { //! A countersink hole made from stacked polyholes for printed parts
|
||||
module screw_polysink(type, h = 100, alt = false) { //! 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);
|
||||
rmin = screw_clearance_radius(type);
|
||||
sides = sides(rmin);
|
||||
lh = layer_height + eps;
|
||||
render(convexity = 5)
|
||||
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);
|
||||
if(alt)
|
||||
rotate(i % 2 == layers % 2 ? 180 / sides : 0)
|
||||
poly_cylinder(r = r, h = lh, center = false, sides = sides);
|
||||
else
|
||||
poly_cylinder(r = r, h = lh, center = false);
|
||||
}
|
||||
|
||||
poly_cylinder(r = screw_clearance_radius(type), h = 100, center = true);
|
||||
translate_z(layers * layer_height)
|
||||
poly_cylinder(r = rmin, h = h / 2 - layers * layer_height, center = false);
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -107,14 +107,14 @@ No6_screw = ["No6", "No6 pan wood", hs_pan, 3.5, 6.7, 2.2, 0, 0
|
||||
No6_cs_screw = ["No6_cs", "No6 cs wood", hs_cs, 3.5, 7.0, 0, 0, 0, 0, M4_washer, false, No6_pilot_radius, No6_clearance_radius];
|
||||
|
||||
screw_lists = [
|
||||
[ M2_cap_screw, M2p5_cap_screw, M3_cap_screw, M4_cap_screw, M5_cap_screw, M6_cap_screw, M8_cap_screw],
|
||||
[ 0, 0, M3_low_cap_screw],
|
||||
[ 0, 0, M3_hex_screw, M4_hex_screw, M5_hex_screw, M6_hex_screw, M8_hex_screw],
|
||||
[ 0, M2p5_pan_screw, M3_pan_screw, M4_pan_screw, M5_pan_screw, M6_pan_screw, No632_pan_screw],
|
||||
[ 0, No2_screw, No4_screw, No6_screw, No6_cs_screw],
|
||||
[ 0, M2_cs_cap_screw,M3_cs_cap_screw, M4_cs_cap_screw],
|
||||
[ 0, M2_dome_screw, M3_dome_screw, M4_dome_screw],
|
||||
[ 0, 0, M3_grub_screw, M4_grub_screw]
|
||||
[ M2_cap_screw, M2p5_cap_screw, M3_cap_screw, M4_cap_screw, M5_cap_screw, M6_cap_screw, M8_cap_screw],
|
||||
[ 0, 0, M3_low_cap_screw],
|
||||
[ M2_cs_cap_screw, 0, M3_cs_cap_screw, M4_cs_cap_screw],
|
||||
[ M2_dome_screw, 0, M3_dome_screw, M4_dome_screw],
|
||||
[ 0, 0, M3_hex_screw, M4_hex_screw, M5_hex_screw, M6_hex_screw, M8_hex_screw],
|
||||
[ 0, M2p5_pan_screw, M3_pan_screw, M4_pan_screw, M5_pan_screw, M6_pan_screw, No632_pan_screw],
|
||||
[ No2_screw, 0, No4_screw, No6_screw, No6_cs_screw],
|
||||
[ 0, 0, M3_grub_screw, M4_grub_screw]
|
||||
];
|
||||
|
||||
use <screw.scad>
|
||||
|
Loading…
Reference in New Issue
Block a user