// make a round, or multisided container indi = 30; // inner circle diameter outdi = 80; // outer circle diameter height = 15; // height of wall wall = 3; // wall thickness infil = 4; // internal fillet radius for pockets segs = 5; // number of segments rad = 1.3; // fillet radius for edges sides = 10; // number of sides (set to >100 for circle, say) //////////////////////// // checks if (segs<3) translate([outdi+100,0,0])text("need three or more segments"); if (rad>=wall/2) {translate([outdi+100,20,0])text("fillet radius too large for wall thickness");} ang= 360/segs; $fn=sides; module plug(){ // calculate plug // calculate triangle points=([[0,0],[outdi,0],[outdi*cos(ang),outdi*sin(ang)]]); minkowski(){ linear_extrude(height*2) offset(r=-infil) // to get for internal radius offset (r=-wall/2) // to get thickness for wall { //make rounded ends difference(){ intersection(){polygon(points);circle(d=outdi-wall);} circle(d=indi+wall); } } sphere(r=infil,$fn=80); } } module allplugs(){ // arrange plugs for(j=[0:ang:360]){ rotate([0,0,j]) plug(); } } module slim(){ //subtract plugs from cylinder difference(){ cylinder (h=height,d=outdi); translate([0,0,wall+infil]){ allplugs(); minkowski(){ cylinder(h=height,d=indi-infil-infil); sphere(r=infil,$fn=80); } } } } //slim(); does it without rounded top edges translate([outdi+10,0,0])slim(); // following code to give rounded top edge. module top(){ //get the top outline difference(){ translate([0,0,-height +rad]) slim(); translate([-1000,-1000,-2000]) cube(2000);} } module rounded(){ // code to round off top edge minkowski(){ linear_extrude(0.001){ offset(r=-rad){ projection(cut=false)top(); } } sphere(r=rad,$fn=20); } } module all(){ intersection(){ slim(); translate([-1000,-1000,-2000+height-rad]) cube(2000); } translate([0,0,height-rad])rounded(); } all(); // rounded edges