// Plant pot saucer
// date: 19-3-2025
// author: Floris van den Bosch

// parameters
top_diameter = 110;
wall_thickness = 2;
spoke_spacing = 100.0;

// derived parameters
height = 0.15 * top_diameter;
bottom_diameter = top_diameter - height;
number_of_spokes = max(floor(PI * top_diameter / spoke_spacing), 3);
spoke_center_offset = 0.15 * top_diameter;

$fa = 0.5;
$fs = 0.5;

difference(){
    // outer shell
    cylinder(h = height, d1 = bottom_diameter, d2 = top_diameter);
    
    // interior cutout
    difference(){
        w =  2 * wall_thickness;
        d_bottom = bottom_diameter - w;
        d_top = top_diameter - w;
        translate([0,0,wall_thickness])
        cylinder(h = height, d1 = d_bottom, d2 = d_top);
        
        r = w;
        translate([0, 0, wall_thickness / 2])
        linear_extrude(3/2 * wall_thickness)
        offset(r=-r)
        offset(r=r)
        union(){
            for(angle = [0:360/number_of_spokes:360]){
                rotate([0 ,0, angle])
                    // main spokes
                    hull(){
                        translate([spoke_center_offset, 0])
                        circle(r = w);
                        translate([top_diameter, 0])
                        circle(r = w);
                    }
             
                }
            //rounded corners
            t = 1.001 * wall_thickness / height;
            c = t * d_top + (1 - t) * d_bottom;
            difference(){
                circle(d=c + r);
                circle(d=c);
            }
        }
    }
}

