Created
November 16, 2019 21:07
-
-
Save RavuAlHemio/fb100076c6d5752cbeaffd14297e59ec to your computer and use it in GitHub Desktop.
the bow and stop of a standard EVVA 4KS key (SL)
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
// unit: 1mm | |
key_thickness = 2.26; | |
bow_width = 25.5; | |
bow_corner_radius = 6.0; | |
bow_corner_advance = 12.25; | |
bow_curve_advance = 10.0; | |
bow_curve_radius = 3.0; | |
bow_curve_outer_offset = 3.25; | |
stop_width = 13.0; | |
stop_advance = 5.517; | |
stop_tip_radius = 0.5; | |
ring_hole_radius = 3.25; | |
ring_hole_offset = 2.75; | |
$fn = $preview ? 8 : 32; | |
// code borrowed from nophead | |
// http://forum.openscad.org/Script-to-replicate-hull-and-minkoswki-for-CSG-export-import-into-FreeCAD-td16537.html#a16556 | |
module rounded_polygon(points) | |
difference() { | |
len = len(points); | |
union() { | |
for (i = [0:len-1]) | |
if (points[i][2] > 0) | |
translate([points[i].x, points[i].y]) | |
circle(points[i][2]); | |
polygon([ | |
for (i = [0:len-1]) | |
let (ends = tangent(points[i], points[(i + 1) % len])) | |
for (end = [0, 1]) | |
ends[end] | |
]); | |
}; | |
for (i = [0:len-1]) | |
if (points[i][2] < 0) | |
translate([points[i].x, points[i].y]) | |
circle(-points[i][2]); | |
} | |
; | |
function tangent(p1, p2) = | |
let ( | |
r1 = p1[2], | |
r2 = p2[2], | |
dx = p2.x - p1.x, | |
dy = p2.y - p1.y, | |
d = sqrt(dx*dx + dy*dy), | |
theta = atan2(dy, dx) + acos((r1 - r2) / d), | |
xa = p1.x + (cos(theta) * r1), | |
ya = p1.y + (sin(theta) * r1), | |
xb = p2.x + (cos(theta) * r2), | |
yb = p2.y + (sin(theta) * r2) | |
) | |
[[xa, ya], [xb, yb]]; | |
// end borrowed code | |
key_points = [ | |
[ | |
// bottom left corner | |
0, | |
0, | |
bow_corner_radius | |
], | |
[ | |
// left "midpoint" | |
0, | |
bow_corner_advance, | |
bow_corner_radius | |
], | |
[ | |
// middle of left curve circle | |
bow_curve_outer_offset - bow_corner_radius, | |
bow_corner_advance + bow_curve_advance, | |
-bow_curve_radius | |
], | |
[ | |
// left stop tip | |
-bow_corner_radius + bow_width/2 - stop_width/2 + stop_tip_radius, | |
bow_corner_advance + bow_curve_advance + stop_advance, | |
stop_tip_radius | |
], | |
[ | |
// right stop tip | |
-bow_corner_radius + bow_width/2 + stop_width/2 - stop_tip_radius, | |
bow_corner_advance + bow_curve_advance + stop_advance, | |
stop_tip_radius | |
], | |
[ | |
// middle of right curve circle | |
bow_width - bow_corner_radius - bow_curve_outer_offset, | |
bow_corner_advance + bow_curve_advance, | |
-bow_curve_radius | |
], | |
[ | |
// right "midpoint" | |
bow_width - 2*bow_corner_radius, | |
bow_corner_advance, | |
bow_corner_radius | |
], | |
[ | |
// bottom right corner | |
bow_width - 2*bow_corner_radius, | |
0, | |
bow_corner_radius | |
], | |
]; | |
difference() | |
{ | |
// bore keyhole | |
linear_extrude(height=key_thickness) | |
rounded_polygon(key_points); | |
translate([ | |
-bow_corner_radius + bow_width/2, | |
-bow_corner_radius + ring_hole_offset + ring_hole_radius, | |
-5 | |
]) | |
cylinder( | |
r=ring_hole_radius, | |
h=10 | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment