Skip to content

Instantly share code, notes, and snippets.

@mkatychev
Created October 17, 2024 14:23
Show Gist options
  • Save mkatychev/931c3c5c518023e068a1c65458e6edb9 to your computer and use it in GitHub Desktop.
Save mkatychev/931c3c5c518023e068a1c65458e6edb9 to your computer and use it in GitHub Desktop.
shoe_tray_leg
$fn = 48;
function line(point1, point2, width = 1) =
let(angle = 90 - atan((point2[1] - point1[1]) / (point2[0] - point1[0])))
let(offset_x = 0.5 * width * cos(angle), offset_y = 0.5 * width * sin(angle))
let(offset1 = [-offset_x, offset_y], offset2 = [offset_x, -offset_y])
// [P1a, P2a, P2b, P1b]
[point1 + offset1, point2 + offset1, point2 + offset2, point1 + offset2];
module polyline(points, width = 1) {
total = len(points) - 1;
for(index = [0:total - 1]) {
p1 = points[index];
p2 = points[index + 1];
sq = line(p1, p2, width);
polygon(points = sq);
if (index != total - 1) {
p3 = points[index + 2];
sq2 = line(p2, p3, width);
// infill
polygon(points = [sq[2], sq2[3], sq[1], sq2[0]]);
}
translate(p1)
circle(d = width);
translate(p2)
circle(d = width);
}
}
lip_height = 29.70;
line = [
[0, 21.95],
// [1.675, 28.35],
[1.95, lip_height],
[10.70, lip_height],
// [10.925, 28.35],
[12.60, 21.95],
[21.26, 1.25]
];
cutoff = [
[1.95, lip_height],
[10.70, lip_height],
[12.60, 21.95],
[21.26, -1]
];
base = [
[19.50, 0.1],
[27, 0.1]
];
leg = [
[0, 0],
[5, 0],
[7, 0],
[7, 0.5],
[0.5, 10],
[-2, 10]
];
module mink_leg() {
minkowski() {
difference() {
polygon(leg);
translate(v = [6.5, 8])
circle(7, $fn = 36);
}
circle(r = 0.2);
}
}
module stem() {
minkowski() {
union() {
difference() {
difference() {
minkowski() {
polyline(line, width = 4);
circle(r = 0.5);
}
minkowski() {
polyline(line, width = 2);
circle(r = 0.2);
}
}
translate([23, -2, 0])
circle(4);
translate([1, 2, 0])
polyline(cutoff, width = 4);
}
polyline(base, width = 1);
}
circle(r = 0.1);
}
}
module leg() {
}
// linear_extrude(height = 1.5, center = false, convexity = 10, twist = 0)
// rotate_extrude(angle = 75, convexity = 10, $fn = 24)
translate([40, 0, 0])
mirror([1, 0, 0])
union() {
stem();
translate([19.5, .25, 0])
mirror([0, 1])
mink_leg();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment