mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-08-20 14:21:51 +02:00
29
shapes.scad
29
shapes.scad
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
BOSL_VERSION = [2,0,446];
|
||||
BOSL_VERSION = [2,0,447];
|
||||
|
||||
|
||||
// Section: BOSL Library Version Functions
|
||||
|
Reference in New Issue
Block a user