Sugar Container Lid

Pasted image 20260126213724.png

This was a very niche model I made, but adding the code here incase anyone can benefit from it

Code

rad = 2;
mx=50;
my=34.4;
mz=10;

difference(){
    r2 = rad*2;
    translate([0,(-my+r2)/2,0])
    minkowski() {
        cube([mx-r2,my-r2,mz-r2]);
        sphere(r=rad);
    }

supcyl(20,5);

t=2;
translate([0,0,mz-t])
supcyl(3,10);
translate([0,0,-t])
supcyl(3,10);
}

module supcyl(h = 20, r = 5){
color("blue")
    translate([0,0,0])
        hull(){
            translate([0,0,0])
            cyl(h = h, r = r);

            translate([22,0,0])
            cyl(h = h, r = r);
    }
}


module cyl(h=1,r=1) {
    // Example only — replace with your geometry:
        cylinder(h = h, r = r, center = true, $fn = 64);
}

module peg(){
    rotate([90,0,0]){
        cyl(7,2);
    }
}

zc = 9.85/2-2;
sy= 5;
translate([1,sy,zc])
color("red")
peg();


translate([1,-sy,zc])
color("red")
peg();

// hull()
// cyl(2,18/2);