git.haldean.org h1a / master cap.scad
master

Tree @master (Download .tar.gz)

cap.scad @masterraw · history · blame

include <dims.scad>

module diag_outline() {
    d = sqrt(2 * itid * itid)/2 - 1;
    wt = 1.8;
    polygon([[-d, 0], [-d+wt, wt], [d-wt, wt],
             [d, 0], [d-wt, -wt], [-d+wt, -wt]]);
}

module diag() {
    linear_extrude(height=cross_depth, center=false)
        diag_outline();
    rotate([0, 180, 0])
        linear_extrude(height=stem_cross_support_height, center=false, scale=(stem_diam - 2)/itid)
          diag_outline();
}

module cap() {
    difference() {
        union() {
            translate([0, 0, cap_height-eps])
                cylinder(h=cap_depth + eps, r1=otid / 2, r2=(otid - 2) / 2);
            cylinder(h=cap_height, r=otod / 2);
        }
        translate([0, 0, cap_height])
            cylinder(h=cap_depth+eps, r=otid / 2 - wall_thickness);
    }
    translate([0, 0, stem_height]) {
        union() {
            rotate([0,0,45]) diag();
            rotate([0,0,-45]) diag();
        }
    }
    cylinder(h=stem_height, r=stem_diam/2);
    translate([0, 0, stem_height]) cylinder(h=cross_depth, r1=stem_diam/2, r2=0);
    translate([0, 0, cap_height]) cylinder(h=stem_cross_support_height, r1=itid/2 - 1, r2=stem_diam/2);
}

cap();