Skip to content

Instantly share code, notes, and snippets.

@ridercz
Created March 6, 2019 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ridercz/9b41ecbf246343425ffb1513b00b65fb to your computer and use it in GitHub Desktop.
Save ridercz/9b41ecbf246343425ffb1513b00b65fb to your computer and use it in GitHub Desktop.
Limiting angles of rotate_extrude in OpenSCAD 2015.3
intersection() {
rotate_extrude() {
translate([20, 0]) circle(5, $fn = 16);
}
translate([0, 0, -5]) linear_extrude(10) rotate_splice(5, 20, 50);
}
module rotate_splice(count, angle_length, radius) {
for(i = [0:count - 1]) {
angle_begin = 360 / count * i;
angle_end = angle_begin + angle_length;
slice = [
[0, 0],
[radius * sin(angle_begin), radius * cos(angle_begin)],
[radius * sin(angle_end), radius * cos(angle_end)]
];
polygon(slice);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment