How to Make an Arc or Wedge in OpenSCAD

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.

Encoder Wheel, OpenSCAD Arc

Creating an Arc with OpenSCAD

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
 * 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])
			// Cut half off
				cube ([radius+1,(radius+1)*2,depth+1]);
			// Cover the other half as necessary
				cube ([radius+1,(radius+1)*2,depth+1]);

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

Tags: , , , , , , ,

  1. David Allan’s avatar

    I’m new to openscad and 3d printing. Your arc code snippet saved me quite a bit of time thanks


  2. Rich Gibson’s avatar

    It is amazing how the long tail works…your code helped me as well, thank you!


  3. Cláudio Sampaio (Patola)’s avatar

    I don’t understand why it has to be non-commercial? That makes it not open-source.


  4. Michael Cheverie’s avatar

    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!


  5. Mike Jeffers’s avatar

    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?


  6. Mike Jeffers’s avatar

    I figured it out. If radius is =17 it will. I’m going to have fun with this now! Thanks for sharing this!


  7. Mike Jeffers’s avatar

    Seems my reply was chopped.

    If radius is less than 17, the module will not render. 17 and above it will.


  8. Mike Jeffers’s avatar

    New rule, radius must be greater than height.



Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.