module gcube(pos,rv=0,resv=1,rh=0) { s = [ [1,1], [-1,1], [-1,-1], [1,-1] ]; //----- Vertical bevel (z axis)----------------------------------// //-- First stage: remove the corners difference() { cube(pos,center=true); //-- z-axis for (i=[0:3]) { translate( [s[i][0]*pos[0]/2, s[i][1]*pos[1]/2, 0] ) cylinder(r=rv, h=pos[2]+10,center=true,$fn=4); } //-- x-axis for(i=[0:3]) { translate( [0,s[i][0]*pos[1]/2, s[i][1]*pos[2]/2] ) rotate([0,90,0]) cylinder(r=rh, h=pos[0]+10, center=true, $fn=4); } //-- y-axis *for(i=[0:3]) { translate( [s[i][1]*pos[0]/2,0,s[i][0]*pos[2]/2] ) rotate([90,0,0]) cylinder(r=rh, h=pos[0]+10, center=true, $fn=4); } } //-- Second stage: Add the cylinders in the corners for (i=[0:3]) { translate([s[i][0]*(pos[0]/2-rv),s[i][1]*(pos[1]/2-rv), 0]) cylinder(r=rv, h=pos[2], center=true, $fn=4*resv); } //-- Horizontal Bevel --------------------------------- // } gcube([30,20,10],rv=1,rh=1,resv=5);