OpenSCAD apparently doesn’t have an easy way to make an arc or wedge, or any way to do a partial rotate_extrude. This presented a problem when I started to design my Parametric Encoder Wheel, because in order for it to look nice, it would need to have lots of extruded arcs or partial rotate extrudes in order to make the holes.
Here’s how I solved the problem. Currently this will render slots up to 180 degrees around, but extending it should be pretty easy. If you’re doing a lot of these in your model, be sure to use render(), or badness will occur.
/* * Excerpt from... * * Parametric Encoder Wheel * * by Alex Franke (codecreations), March 2012 * http://www.theFrankes.com * * Licenced under Creative Commons Attribution - Non-Commercial - Share Alike 3.0 */ module arc( height, depth, radius, degrees ) { // This dies a horible death if it's not rendered here // -- sucks up all memory and spins out of control render() { difference() { // Outer ring rotate_extrude($fn = 100) translate([radius - height, 0, 0]) square([height,depth]); // Cut half off translate([0,-(radius+1),-.5]) cube ([radius+1,(radius+1)*2,depth+1]); // Cover the other half as necessary rotate([0,0,180-degrees]) translate([0,-(radius+1),-.5]) cube ([radius+1,(radius+1)*2,depth+1]); } } }
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
Hi
I’m new to openscad and 3d printing. Your arc code snippet saved me quite a bit of time thanks
Dave
It is amazing how the long tail works…your code helped me as well, thank you!
I don’t understand why it has to be non-commercial? That makes it not open-source.
I am a teacher of blind and low-vision students. This OpenSCAD module will help me very much in helping them to understand concepts regarding volumes of revolution in calculus. This is far superior to just offering a description. Thanks!
For some reason, it renders as 1x1x1 cylinder -1/4. No matter what values I assign to the variables, it always returns the same shape. Any feedback?
I figured it out. If radius is =17 it will. I’m going to have fun with this now! Thanks for sharing this!
Seems my reply was chopped.
If radius is less than 17, the module will not render. 17 and above it will.
New rule, radius must be greater than height.