/* Linear units are mm */

ext_dia = 30.0;
int_dia = 6.2;
h = 8;

mnth_dia = 3.2;
mnth_ins_dia = 5.0;
mnth_ins_h = 5.0;
mnth_center_r = 8.0;
mnth_num = 4;

seth_dia = 3.2;
//seth_ins_dia = mnth_ins_dia;
//seth_ins_h = mnth_ins_h;
seth_ins_dia = 6.2;
seth_ins_h = 2.0;
seth_num = 2;

nut_w = 5.35 + 0.2;
nut_h = 6.05 + 0.2;
nut_d = 2.5;
nut_offr = 8.0;

$fn = 64;

difference() {
    cylinder(d=ext_dia, h=h);
    cylinder(d=int_dia, h=h);
    
    for (alpha = [0 : 360/mnth_num : 359.9999]) {
        rotate(alpha, [0, 0, 1])
        translate([-mnth_center_r, 0, 0])
        union() {
            cylinder(d=mnth_dia, h=h);
            translate([0, 0, h-mnth_ins_h]) cylinder(d=mnth_ins_dia, h=mnth_ins_h);
        }
    }
    
    for (alpha = [ 0 : 360/max(seth_num, 4) : 359.9999 * seth_num/max(seth_num, 4)]) {
        translate([0, 0, h/2])
        rotate(alpha + 360/mnth_num/2, [0, 0, 1])
        union() {
            translate([-nut_offr, 0, 0]) {
                cube([nut_d, nut_w, nut_h], center=true);
                translate([0, 0, h/2])
                cube([nut_d, nut_w, h/2], center=true);
            }
            
            rotate(-90, [0, 1, 0])
            union() {
                cylinder(d=seth_dia, h=ext_dia/2);
                translate([0, 0, ext_dia/2-seth_ins_h]) cylinder(d=seth_ins_dia, h=seth_ins_h);
            }
        }
    }
}
