Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module roundedSquareNotMinkowski(height=1, x=squareSide, y=squareSide, cornerRad=baseCornerRadius) {
- // forces render instead of preview on open, if using this instead of minkowsky one
- actualCornerRadius = min(x/2, y/2, cornerRad);
- xx=max(smidge, x/2-actualCornerRadius); yy=max(smidge, y/2-actualCornerRadius);
- if (cornerRad > 0.01) { ch=height+smidge;
- hull() {
- for(i=[-1:2:1]) { for(j=[-1:2:1]) {
- translate([i*xx,j*yy,0]) cylinder(h = ch, r=actualCornerRadius, center=true, $fn=circFnCalc(actualCornerRadius));
- } } }
- } else { sm3=smidge*3;
- hull() {
- for(i=[-1:2:1]) { for(j=[-1:2:1]) {
- translate([i*xx,j*yy,0]) cube([smidge,smidge,sm3], center=true);
- } } }
- }
- }
- module roundedSquare(height=1, x=squareSide, y=squareSide, cornerRad=baseCornerRadius) {
- actualCornerRadius = min(x/2, y/2, cornerRad);
- minkowski() {
- cube(size=[max(smidge, x-(2*actualCornerRadius)), max(smidge, y-(2*actualCornerRadius)), height], center=true);
- if (cornerRad > 0.01) { cylinder(r1=actualCornerRadius, r2=actualCornerRadius, h=smidge, center=true, $fn=circFnCalc(actualCornerRadius));
- } else { cube([smidge, smidge, smidge]); }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement