This commit is contained in:
Garth Minette 2020-10-09 10:31:56 -07:00
parent 83c409120f
commit a53c77f83e
2 changed files with 16 additions and 15 deletions

View file

@ -77,29 +77,30 @@ module cuboid(
e = corner_edges(edges, corner);
cnt = sum(e);
r = first_defined([chamfer, rounding, 0]);
c = [min(r,size.x/2), min(r,size.y/2), min(r,size.z/2)];
$fn = is_finite(chamfer)? 4 : segs(r);
translate(vmul(corner,size/2-[r,r,r])) {
translate(vmul(corner,size/2-c)) {
if (cnt == 0) {
cube(r*2, center=true);
cube(c*2, center=true);
} else if (cnt == 1) {
if (e.x) xcyl(l=r*2, r=r);
if (e.y) ycyl(l=r*2, r=r);
if (e.z) zcyl(l=r*2, r=r);
if (e.x) xcyl(l=c.x*2, r=r);
if (e.y) ycyl(l=c.y*2, r=r);
if (e.z) zcyl(l=c.z*2, r=r);
} else if (cnt == 2) {
if (!e.x) {
intersection() {
ycyl(l=r*2, r=r);
zcyl(l=r*2, r=r);
ycyl(l=c.y*2, r=r);
zcyl(l=c.z*2, r=r);
}
} else if (!e.y) {
intersection() {
xcyl(l=r*2, r=r);
zcyl(l=r*2, r=r);
xcyl(l=c.x*2, r=r);
zcyl(l=c.z*2, r=r);
}
} else {
intersection() {
xcyl(l=r*2, r=r);
ycyl(l=r*2, r=r);
xcyl(l=c.x*2, r=r);
ycyl(l=c.y*2, r=r);
}
}
} else {
@ -107,9 +108,9 @@ module cuboid(
spheroid(r=r, style="octa");
} else {
intersection() {
xcyl(l=r*2, r=r);
ycyl(l=r*2, r=r);
zcyl(l=r*2, r=r);
xcyl(l=c.x*2, r=r);
ycyl(l=c.y*2, r=r);
zcyl(l=c.z*2, r=r);
}
}
}

View file

@ -8,7 +8,7 @@
//////////////////////////////////////////////////////////////////////
BOSL_VERSION = [2,0,446];
BOSL_VERSION = [2,0,447];
// Section: BOSL Library Version Functions