There are a few ways to create boxes with rounded corners. You could use the MCAD/boxes.scad library or you could do it one of two ways as described by Thingiverse contributor,
William A Adams:
First Way:
module roundedRect(size, radius){
x = size[0];
y = size[1];
z = size[2];
linear_extrude(height=z)
hull(){
// place 4 circles in the corners, with the given radius
translate([(-x/2)+(radius/2), (-y/2)+(radius/2), 0])
circle(r=radius);
translate([(x/2)-(radius/2), (-y/2)+(radius/2), 0])
circle(r=radius);
translate([(-x/2)+(radius/2), (y/2)-(radius/2), 0])
circle(r=radius);
translate([(x/2)-(radius/2), (y/2)-(radius/2), 0])
circle(r=radius);
}
}
roundedRect([10,10,5],2,$fn=64);
Second Way:
Minkowski or vector sum of a cube and sphere can be thought of this way:
The center of the sphere is the reference point. Move the reference point everywhere in the cube and then take the union of all the resulting infinite number of spheres. The solid form that results from the union is the cube that is slightly bigger than the original cube by the radius of the sphere and with rounded corners.
The Minkowski sum of any two solid shapes is a well defined set and the reference point for the shape that moves does not have to be a sphere.
The only caveat about this way is that rendering takes longer.
module miniround(size, radius){
$fn=50;
x = size[0]-radius/2;
y = size[1]-radius/2;
minkowski(){
cube(size=[x,y,size[2]]);
cylinder(r=radius);
}
}
Minkowski sums of set-theoretic models by S.J.Parry-Barwick and A. Bowyer