mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2024-12-29 16:29:40 +00:00
Fix for #295
This commit is contained in:
parent
83c409120f
commit
a53c77f83e
2 changed files with 16 additions and 15 deletions
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
|
||||
|
|
Loading…
Reference in a new issue