GuitarModels/AluTCommon.scad

75 lines
2.0 KiB
OpenSCAD
Raw Normal View History

2023-06-13 21:21:33 +09:30
include <common.scad>
use <skin.scad>
L_minor = 1/2 * 25.4;
L_major = 3/4 * 25.4;
L_thick = 1.8; //9/128 * 25.4; //1/16 * 25.4;
T_flat_top = L_minor * 2; // 1"
T_spine = L_major; // 3/4"
T_tolerance = 0.285;
// Cap_Length = 150;
Cap_Thick = 3;
Cap_Spine = T_spine + Cap_Thick;
points = [[-T_spine, 0], [0, -L_minor], [0, L_minor]];
function tri_circumcenter(pts) =
let(
v0 = pts[1] - pts[0],
v1 = pts[2] - pts[1],
d0 = (pts[1] + pts[0])/2 * v0,
d1 = (pts[2] + pts[1])/2 * v1,
det = -cross(v0, v1)
)
[cross([d1, d0], [v1.y, v0.y]), cross([d0, d1], [v0.x, v1.x])] / det;
T_circumcenter = tri_circumcenter(points);
tube_radius = Cap_Spine + T_circumcenter[0];
module cap_outline(radius = 1.5, fingerboard_min_thick = 2.5, fingerboard_max_thick = 5) {
minkowski($fn = mink_fn_2d) {
circle(r = radius);
difference() {
translate(T_circumcenter) circle(r = tube_radius - radius);
translate([fingerboard_max_thick - radius, -50]) square([100,100]);
}
}
}
function T_hole_points(r = 4, a_step = 5, offset = 0) =
let(
x0 = T_tolerance + offset,
x1 = x0 - L_thick - (T_tolerance*2) - (offset*2),
x2 = -T_spine - T_tolerance - offset,
y_out = L_minor + T_tolerance + offset,
y_in = L_thick + T_tolerance + offset,
top_points = [
[x1, -y_out],
[x0, -y_out],
[x0, y_out],
[x1, y_out]
],
bottom_points = [
[x2, y_in],
[x2, -y_in],
],
joint_corner_left = [x1, -y_in],
joint_corner_right = [x1, y_in],
join_points_left = [for (a = [0:a_step:90]) joint_corner_left + [-r * (1-sin(a)), -r * (1-cos(a))]],
join_points_right = [for (a = [0:a_step:90]) joint_corner_right + [-r * (1-cos(a)), r * (1-sin(a))]]
)
concat(top_points, join_points_right, bottom_points, join_points_left);
module T_hole(r = 4, a_step = 5, offset = 0)
polygon(T_hole_points(r=r, a_step=a_step, offset=offset));
module tapered_T_hole(z0 = 0, z1 = 4, o0 = 1, o1 = 0) {
// z1 must > z0 for faces to work
pts0 = [for (pt = T_hole_points(offset = o0)) concat(pt, z0)];
pts1 = [for (pt = T_hole_points(offset = o1)) concat(pt, z1)];
skin([pts0, pts1]);
}