Created
December 30, 2023 01:17
-
-
Save apexskier/a676e723c1386723677b633cfa137e61 to your computer and use it in GitHub Desktop.
This file contains 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
$fn=60; | |
outerD = 90; | |
innerD = 57.5; | |
base = 3; | |
h = 35+base; | |
segments = 3; | |
de = 3; | |
linear_extrude(base) { | |
difference() { | |
circle(d=outerD); | |
circle(d=innerD); | |
} | |
for (i = [0:2]) { | |
rotate([0, 0, i*360/segments]) { | |
translate([-12/2, 0]) { | |
square([12, innerD/2]); | |
} | |
} | |
} | |
} | |
linear_extrude(10) { | |
for (i = [0:2]) { | |
rotate([0, 0, i*360/segments]) { | |
offset(3) offset(-3) | |
translate([-12/2, 0]) { | |
square([12, 20]); | |
} | |
} | |
} | |
} | |
w = (outerD/2)*tan(360/segments/2/2); | |
for (i = [0:segments-1]) { | |
rotate([0, 0, i*360/segments]) { | |
union() { | |
linear_extrude(height=h) { | |
difference() { | |
intersection() { | |
polygon(points=[[0, 0], [outerD, 0], [outerD, (outerD) * tan(360/segments/2)]]); | |
difference() { | |
circle(d=outerD); | |
circle(d=innerD); | |
} | |
} | |
intersection() { | |
polygon(points=[[0, 0], [outerD, (outerD) * tan(de)], [outerD, (outerD) * tan(30)]]); | |
difference() { | |
circle(d=outerD-3); | |
circle(d=innerD+6); | |
} | |
} | |
} | |
} | |
// rotate([-360/segments/2/2, 90, 0]) { | |
// // intersection() { | |
// resize([h*2,w*2]) { | |
// flat_end_cylinder(height=outerD/2, r=1, $fn=40); | |
// } | |
// // cube([h*2, w*2, outerD/2]); | |
// // } | |
// } | |
} | |
} | |
} | |
module flat_end_cylinder(height, r, $fn) { | |
points = [ | |
for (a = 0; a < 360; a = a + 360/$fn) [r*cos(a), r*sin(a), height], // open end | |
// for (a = 0; a < 360; a = a + 360/$fn) [r*cos(a), r*sin(a), 0], // test | |
for (a = 0; a < 360; a = a + 360/$fn) [r*cos(a), 0, 0], // closed end. This could be optimized to use half the points, not worth it | |
]; | |
faces = [ | |
for (i = [0:$fn-2]) [i, i+1, i+$fn+1, i+$fn], | |
[$fn-1, 0, $fn, $fn*2-1], // last one overflows, so it's easier to just do it manually | |
[for (i = [0:$fn-1]) i], // face | |
// [for (i = [0:$fn-1]) i+$fn], | |
]; | |
polyhedron( | |
points=points, | |
faces=faces, | |
convexity=1 | |
); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment