### Rounded corners in openScad

Someone on one of my youtube videos asked me "how to make rounded corners in openScad" and I thought my reply was helpful, so here it is!

If you want to make a square with rounded corners you'd have to make your own round_corner function. like this

module round_square(x,y,z,r){ hull(){ translate([r/2,r/2,0]) cylinder(h=z,d=r); translate([-(r/2)+x,r/2,0]) cylinder(h=z,d=r); translate([(r/2),-(r/2)+y,0]) cylinder(h=z,d=r); translate([(r/2)+x,(r/2)+y,0]) cylinder(h=z,d=r); } } round_square(20,20,20,5); If you wanted to make it in all of the directions for a cube you would do it like this module round_cube(x,y,z,r){ hull(){ translate([r/2,r/2,r/2]) sphere(d=r); translate([-(r/2)+x,r/2,r/2]) sphere(d=r); translate([(r/2),-(r/2)+y,r/2]) sphere(d=r); translate([(r/2)+(r/2)+y,r/2]) sphere(d=r); translate([r/2,r/2,-(r/2)+z]) sphere(d=r); translate([(r/2)+x,r/2,(r/2)+z]) sphere(d=r); translate([(r/2),(r/2)+y,(r/2)+z]) sphere(d=r); translate([(r/2)+x…

If you want to make a square with rounded corners you'd have to make your own round_corner function. like this

module round_square(x,y,z,r){ hull(){ translate([r/2,r/2,0]) cylinder(h=z,d=r); translate([-(r/2)+x,r/2,0]) cylinder(h=z,d=r); translate([(r/2),-(r/2)+y,0]) cylinder(h=z,d=r); translate([(r/2)+x,(r/2)+y,0]) cylinder(h=z,d=r); } } round_square(20,20,20,5); If you wanted to make it in all of the directions for a cube you would do it like this module round_cube(x,y,z,r){ hull(){ translate([r/2,r/2,r/2]) sphere(d=r); translate([-(r/2)+x,r/2,r/2]) sphere(d=r); translate([(r/2),-(r/2)+y,r/2]) sphere(d=r); translate([(r/2)+(r/2)+y,r/2]) sphere(d=r); translate([r/2,r/2,-(r/2)+z]) sphere(d=r); translate([(r/2)+x,r/2,(r/2)+z]) sphere(d=r); translate([(r/2),(r/2)+y,(r/2)+z]) sphere(d=r); translate([(r/2)+x…