Fully rounded-corner cube module in OpenSCAD

For some projects involving metal plates for ropes I needed to create this module to create a smooth surface without sharp edges.

/*
 * Author: Hector Perez
 * Date: May/1/2023
 * Description: Fully rounded-corner cube
 */


$fn = 60;

allRoundedCube(1,12,20,0.2);

module allRoundedCube(height, width, depth, roundness_diameter){

    hull(){
        
        sphere(roundness_diameter);
        
        translate([0,0,height]) sphere(roundness_diameter);
        translate([0,width,0]) sphere(roundness_diameter);
        translate([depth,0,0]) sphere(roundness_diameter);
        translate([depth,width,0]) sphere(roundness_diameter);
        translate([0,width,height]) sphere(roundness_diameter);
        translate([depth,0,height]) sphere(roundness_diameter);
        translate([depth,width,height]) sphere(roundness_diameter);
        
        translate([0,0,0]) cylinder(h=height, d=roundness_diameter);
        translate([0,width,0]) cylinder(h=height, d=roundness_diameter);
        translate([depth,0,0]) cylinder(h=height, d=roundness_diameter);
        translate([depth,width,0]) cylinder(h=height, d=roundness_diameter);
    
        translate([0,0,0]) rotate(a=90,v=[0,1,0]) cylinder(h=height, d=roundness_diameter);
        translate([0,width,0]) rotate(a=90,v=[0,1,0]) cylinder(h=height, d=roundness_diameter);
        translate([0,0,height]) rotate(a=90,v=[0,1,0]) cylinder(h=height, d=roundness_diameter);
        translate([0,5,height]) rotate(a=90,v=[0,1,0]) cylinder(h=height, d=roundness_diameter);
    
        translate([0,width,0]) rotate(a=90,v=[1,0,0]) cylinder(h=height, d=roundness_diameter);
        translate([depth,width,0]) rotate(a=90,v=[1,0,0]) cylinder(h=height, d=roundness_diameter);
        translate([0,width,height]) rotate(a=90,v=[1,0,0]) cylinder(h=height, d=roundness_diameter);
        translate([depth,width,height]) rotate(a=90,v=[1,0,0]) cylinder(h=height, d=roundness_diameter);
    }
}
0:00
/