Last active
June 16, 2023 08:55
-
-
Save groovenectar/292db1688b79efd6ce11 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// More information: https://danielupshaw.com/openscad-rounded-corners/ | |
module roundedcube_simple(size = [1, 1, 1], center = false, radius = 0.5) { | |
// If single value, convert to [x, y, z] vector | |
size = (size[0] == undef) ? [size, size, size] : size; | |
translate = (center == false) ? | |
[radius, radius, radius] : | |
[ | |
radius - (size[0] / 2), | |
radius - (size[1] / 2), | |
radius - (size[2] / 2) | |
]; | |
translate(v = translate) | |
minkowski() { | |
cube(size = [ | |
size[0] - (radius * 2), | |
size[1] - (radius * 2), | |
size[2] - (radius * 2) | |
]); | |
sphere(r = radius); | |
} | |
} |
daSpud46
commented
Aug 2, 2021
via email
I got what I needed by changing a few lines:
module roundedcylinder_simple(size = [1, 1, 1], center = false, radius = 0.5) {
// If single value, convert to [x, y, z] vector
size = (size[0] == undef) ? [size, size, size] : size;
translate = (center == false) ?
[radius, radius, radius] :
[
radius - (size[0] / 2),
radius - (size[1] / 2),
radius - (size[2] / 2)
];
translate(v = translate)
minkowski() {
cylinder(h =
size[0] - (radius * 2),
r1= size[1] - (radius * 2),
r2 = size[2] - (radius * 2)
);
sphere(r = radius);
}
}
roundedcylinder_simple(size=[8,15,15],center=true,radius=2);
Thank you for sharing!!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment