///////////////////////////////// // rounded corners modules ///////////////////////////////// module createMeniscus(h,radius) // This module creates the shape that needs to be substracted from a cube to make its corners rounded. difference(){ //This shape is basicly the difference between a quarter of cylinder and a cube translate([radius/2+0.1,radius/2+0.1,0]){ cube([radius+0.2,radius+0.1,h+0.2],center=true); // All that 0.x numbers are to avoid "ghost boundaries" when substracting } cylinder(h=h+0.2,r=radius,$fn = 25,center=true); } module roundCornersCube(x,y,z,r) // Now we just substract the shape we have created in the four corners difference(){ cube([x,y,z], center=true); translate([x/2-r,y/2-r]){ // We move to the first corner (x,y) rotate(0){ createMeniscus(z,r); // And substract the meniscus } } translate([-x/2+r,y/2-r]){ // To the second corner (-x,y) rotate(90){ createMeniscus(z,r); // But this time we have to rotate the meniscus 90 deg } } translate([-x/2+r,-y/2+r]){ // ... rotate(180){ createMeniscus(z,r); } } translate([x/2-r,-y/2+r]){ rotate(270){ createMeniscus(z,r); } } } //////////////////////////// //// actual part ////////////////////////////// difference(){ union(){ //base translate([0,0,0]) color("purple") roundCornersCube(28,26,15, 2); } //cutouts translate([0,0,-2]) #cube([24,22,15], center=true); //servo screw holes translate([8.5,0,0]) rotate([90,0,0]) #cylinder(r=1.2,h=20,$fn=20); translate([-8.5,0,0]) rotate([90,0,0]) #cylinder(r=1.2,h=20,$fn=20); translate([8.5,-11,0]) rotate([90,0,0]) #cylinder(r=3,h=.9,$fn=20); translate([-8.5,-11,0]) rotate([90,0,0]) #cylinder(r=3,h=.9,$fn=20); //sonar cutout translate([0,0,0]) #cylinder(r=8.5,h=10,$fn=20); }