{{ message }}

Instantly share code, notes, and snippets.

Last active Apr 28, 2021
roundedcube.scad - Fork me and make me better!

### groovenectar commented Jul 23, 2015

 Usage: // A single integer creates a cube with the specified wall distance. Default [1, 1, 1] size = 5; // An [x, y, z] vector specifies distance on each axis. Default [1, 1, 1] size = [2, 3, 5]; // Whether or not to place the object centered on the origin. Default false center = true|false; // Specify a rounding radius. Default 0.5 radius = 0.5 // Specify where to apply the rounded corners. Default "all" apply_to = "all"|"x"|"y"|"z"|"zmax"|"zmin"|"xmax"|"xmin"|"ymax"|"ymin" roundedcube(size, center, radius, apply_to); Examples: color("Yellow") roundedcube(3, true, 0.7, "xmin"); translate(v = [1, 0, 2]) color("Pink") roundedcube([4, 2, 2], false, 0.6, "zmax"); translate(v = [-4, -1, 2]) color("Lightblue") roundedcube(2, false); translate(v = [0, 0, 6]) color("Orange") roundedcube([3, 2, 2], true, 0.2); translate(v = [2.5, -0.5, 5]) color("Green") roundedcube([3, 2, 2], false, 0.4, "z"); Output:

### thunfischbrot commented Dec 20, 2015

 Hi Daniel, thank you for your work! If I am not mistaken there is a bug which doesn't let you create a shape with rounded corners which extends into any direction for less than twice the radius of the rounded corners. The bug is that the x|y|z >= radius*2 should only apply to the dimensions which you apply the rounded corners to. Or am I mistaken? Demo: use translate([0,-30,0]) color("Green") roundedcube([40,10,1], true, .1, "z"); translate([0,-15,0]) color("Orange") roundedcube([40,10,1], true, .5, "z"); color("Blue") roundedcube([40,10,1], true, 1, "z"); translate([0,15,0]) color("Red") roundedcube([40,10,1], true, 4, "z");

### rbuckland commented Jan 8, 2017 • edited

 Brilliant !thank you. I have been meaning to write an uber version (optional rounded faces etc). You nailed it :-)

### Diaoul commented Feb 3, 2018

 Forked to add scaling for when you don't want the radius to be the same for x and y for example. roundedcube([41, 22, 23], radius=6, scale_y=1/2, apply_to="z");

### rfinz commented Jan 18, 2019

 excellent little script! consider this a +1! 👍

### JonasZ95 commented Jan 15, 2020

 @groovenectar use wall = 2; frame = 3; plate = 10; module straight(depth, height) { difference() { cube([2*wall+frame, depth, height+wall]); translate([wall, 0, wall]) roundedcube([frame, depth, height], false, 0.7, "ymin"); } straight(50, 5); Do you have any idea why this is smaller than depth and height? Also there are some small dots which are not subtracted from the cube.

### drohhyn commented Nov 21, 2020

 Is there any reason for https://gist.github.com/groovenectar/92174cb1c98c1089347e/revisions#diff-47107763919164d8ef5b55b93722917acfe23e5e030f22954e057a03dc2c316c? In the description you still as for forks and improvements. I really like your script und will still like to use it.

### groovenectar commented Nov 21, 2020

 I really like your script and will still like to use it. I am consulting with Dan Fandrich, and we will be addressing this as soon as possible. Thank you in advance for your patience

### groovenectar commented Nov 21, 2020

 @drohhyn After consulting with Dan Fandrich, we have determined that you are now among the people in this world who are allowed to use roundedcube.scad. It has come to my attention that Dan is of the opinion that everyone should be able to use roundedcube.scad -- we are having a political disagreement. As our newest member of the Board of Directors, do you have a weigh-in on this subject?

### drohhyn commented Nov 24, 2020

 As I did not provide any code or other contribution to it, who am I to have an opinion? But I for myself would prefer an open source licence free to use for everybody, e.g. MIT or, if you want users to re-share the same way, CC BY-SA.

### RussNelson commented Jan 6, 2021

 If someone has legally obtained a copyrighted work, they are free to use it in any way they want. The statement about use in the .scad file has no effect. /Russ, 12 years as the VP in charge of License Approval for the Open Source Initiative.

### ggs67 commented Apr 27, 2021 • edited

 I have forked and mostly rewritten the module in order to remove some limitations, one being the one reported above by thunfischbrot back in 2015: // Changed to remove some limitations: // // 1. Allow radius>length for rounded corners in one axis only (problem reported on original page in 2015) // 2. Remove limitation where for apply_to=(x|y|z)max or (x|y|z)min the dimension of the corresponding perpendicular // axis had to be at least 3 times the radius because of fixed cylinder height. Now cylinder height is always computed not // to interfere with opposite corner