Last active
February 4, 2023 22:58
-
-
Save jstanley0/d6e398f3ccf94c168e56ef1a96fa7a5f to your computer and use it in GitHub Desktop.
nalbinding needle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
length = 100; | |
width = 12; | |
thickness = 5; | |
flat_ratio = 0.5; | |
build_plate = true; | |
hole_width = 8; | |
hole_stretch = 0.9; | |
hole_chamfer = 1.25; | |
pointiness = 25; | |
$fn = 25; | |
z_asymmetry = build_plate ? 0.5 : 0; | |
function sin_scale(pos, lb, ub) = sin(lb + pos * (ub - lb)); | |
function v_scale(pos) = thickness * sin_scale(pos, 30, 125); | |
function h_scale(pos) = width * sin_scale(pos, 14, 100); | |
module body(sections=$fn) { | |
section_length = length / sections; | |
for(pos = [0 : section_length : length-1]) { | |
p0 = pos / length; | |
p1 = (pos + section_length) / length; | |
dx = flat_ratio / 2; | |
hs = 1 - flat_ratio; | |
translate([0, 0, pos]) | |
linear_extrude(height = section_length, | |
scale = [h_scale(p1) / h_scale(p0), | |
v_scale(p1) / v_scale(p0)]) | |
{ | |
scale([h_scale(p0), v_scale(p0)]) | |
hull() { | |
translate([-dx, z_asymmetry]) scale([hs, 1]) circle(d=1); | |
translate([dx, z_asymmetry]) scale([hs, 1]) circle(d=1); | |
} | |
} | |
} | |
} | |
module hole_section(p0, r0, p1, r1, dx) { | |
translate([0, 0, p0]) | |
linear_extrude(height=p1-p0, scale=r1/r0, center=false) { | |
hull() { | |
translate([-r0 * dx, 0, 0]) | |
circle(r0); | |
translate([r0 * dx, 0, 0]) | |
circle(r0); | |
} | |
} | |
} | |
module hole(th, r, pos, chamfer = hole_chamfer, stretch = hole_stretch) { | |
translate([0, th * (1/2 + z_asymmetry), pos]) | |
rotate([90, 90, 0]) { | |
hole_section(0, r * chamfer, th / 4, r, stretch); | |
hole_section(th / 4, r, th * 3 / 4, r, stretch); | |
hole_section(th * 3 / 4, r, th, r * chamfer, stretch); | |
} | |
} | |
module end_rounder() { | |
difference() { | |
translate([-1, -1, -1.5]) cube([2, 2, 2]); | |
translate([0, 0, 0.5]) sphere(d=1); | |
} | |
} | |
module needle() { | |
rotate([90, 0, 180]) { | |
difference() { | |
body(); | |
hole(thickness, hole_width/2, length - hole_width*2); | |
translate([0, thickness*z_asymmetry, length]) | |
rotate([180, 0, 0]) | |
scale([width, width, width]) | |
end_rounder(); | |
translate([0, v_scale(0) * z_asymmetry, 0]) | |
scale([h_scale(0) * 2, h_scale(0) * 2, pointiness]) | |
end_rounder(); | |
} | |
} | |
} | |
needle(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment