Last active
June 6, 2017 00:46
-
-
Save JustinSDK/ea4211f8a6129f89534a00e2f80af061 to your computer and use it in GitHub Desktop.
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
$fn = 48; // 圓的邊數 | |
r1 = 15; // 半徑 1.5 cm | |
r2 = 15; // 也就是直徑 3 cm | |
thickness = 5; // 厚度 0.5 cm | |
length = 50; // 長度 5 cm | |
function __frags(radius) = $fn > 0 ? | |
($fn >= 3 ? $fn : 3) : | |
max(min(360 / $fa, radius * 6.28318 / $fs), 5); | |
function shape_ellipse(axes) = | |
let( | |
frags = __frags(axes[0]), | |
step_a = 360 / frags, | |
shape_pts = [ | |
for(a = [0:step_a:360 - step_a]) | |
[axes[0] * cos(a), axes[1] * sin(a)] | |
] | |
) shape_pts; | |
linear_extrude() difference() { | |
polygon( | |
shape_ellipse([r1, r2]) | |
); | |
offset(r = -1) polygon( | |
shape_ellipse([r1, r2]) | |
); | |
translate([0, -r2/2]) square([r1 * 2, r2], center = true); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment