Created
November 26, 2024 16:13
-
-
Save logiclrd/cce0fe2e9edd7fc6c6292120b0e13832 to your computer and use it in GitHub Desktop.
Useful OpenSCAD Primitives
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
module sector(radius, angle) | |
{ | |
fn = ($fn <= 0) ? 20 : $fn; | |
polygon( | |
[ | |
[0, 0], | |
for (i = [0 : fn]) | |
let (a = i * angle / fn) | |
[radius * cos(a), radius * sin(a)] | |
]); | |
} | |
module arc(radius1, radius2, angle) | |
{ | |
fn = ($fn <= 0) ? 20 : $fn; | |
polygon( | |
[ | |
for (i = [0 : fn]) | |
let (a = i * angle / fn) | |
[radius1 * cos(a), radius1 * sin(a)], | |
for (i = [0 : fn]) | |
let (a = (fn - i) * angle / fn) | |
[radius2 * cos(a), radius2 * sin(a)] | |
]); | |
} | |
module cone(inclination, sweep, slice = [0, 200]) | |
{ | |
rotate_extrude(angle = sweep) | |
polygon( | |
[ | |
[0, slice[0]], | |
[slice[0] * sin(inclination), slice[0]], | |
[slice[1] * sin(inclination), slice[1]], | |
[0, slice[1]] | |
]); | |
} |
Author
logiclrd
commented
Nov 26, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment