Partial Rotate Extrude (OpenSCAD)
Description
In the process of designing a printable frame for a mini quad copter, I realized I needed a feature of OpenSCAD that I don't think was implemented yet. While I know this is not a perfect solution, it was a good enough hack for my needs.
Included is the example use case.
Included is the example use case.
Instructions
Use (same as rotate_extrude):
| partial_rotate_extrude(angle, radius, convexity) circle(5);
This will extrude the circle for `angle` degrees about the origin at a distance of `radius`. The convexity parameter is the same as in rotate_extrude, see en.wikibooks.org/wiki/OpenSCAD_User_Manual/2D_to_3D_Extrusion
Copy/Paste access:
partial_rotate_extrude(235, 20, 10) circle(5);
module pie_slice(radius, angle, step) {
for(theta = [0:step:angle-step]) {
rotate([0,0,0]) linear_extrude(height = radius*2, center=true)
polygon( points = [[0,0],[radius * cos(theta+step) ,radius * sin(theta+step)],[radius*cos(theta),radius*sin(theta)]]);
}}
module partial_rotate_extrude(angle, radius, convex) {
intersection () {
rotate_extrude(convexity=convex) translate([radius,0,0]) child(0);
pie_slice(radius*2, angle, angle/5);
}}
| partial_rotate_extrude(angle, radius, convexity) circle(5);
This will extrude the circle for `angle` degrees about the origin at a distance of `radius`. The convexity parameter is the same as in rotate_extrude, see en.wikibooks.org/wiki/OpenSCAD_User_Manual/2D_to_3D_Extrusion
Copy/Paste access:
partial_rotate_extrude(235, 20, 10) circle(5);
module pie_slice(radius, angle, step) {
for(theta = [0:step:angle-step]) {
rotate([0,0,0]) linear_extrude(height = radius*2, center=true)
polygon( points = [[0,0],[radius * cos(theta+step) ,radius * sin(theta+step)],[radius*cos(theta),radius*sin(theta)]]);
}}
module partial_rotate_extrude(angle, radius, convex) {
intersection () {
rotate_extrude(convexity=convex) translate([radius,0,0]) child(0);
pie_slice(radius*2, angle, angle/5);
}}
License
Partial Rotate Extrude (OpenSCAD) by CarryTheWhat is licensed under the Creative Commons - LGPL license.

You must be logged in to post a comment.