[OpenSCAD] Creating pie (pizza slice) shape (need a dynamic length array)

DarioPellegrini pellegrini.dario at gmail.com
Sat Sep 15 13:18:21 EDT 2018

I wrote this code a while ago. It works with any angle by dynamically adding
the necessary (small) number of subtracting triangles.

module circular_sector(r, theta) {
    overlap = 10;
    dtheta = 360 - theta;
    n = ceil(dtheta/90);
    a = (dtheta+overlap*(n-1))/n;
    difference() {
        for (i=[0:1:n-1]) rotate([0,0,theta+i*(a-overlap)])

Sent from: http://forum.openscad.org/

More information about the Discuss mailing list