Fix for ycyl error when using d1/d2.

This commit is contained in:
Garth Minette 2020-12-12 20:28:33 -08:00
parent 7dfda7cd96
commit 44fcd46b47
3 changed files with 4 additions and 4 deletions

View file

@ -282,7 +282,7 @@ function get_anchor(anchor,center,uncentered=BOT,dflt=CENTER) =
// r = Most general radius.
// d = Most general diameter.
// dflt = Value to return if all other values given are `undef`.
function get_radius(r1=undef, r2=undef, r=undef, d1=undef, d2=undef, d=undef, dflt=undef) =
function get_radius(r1, r2, r, d1, d2, d, dflt) =
assert(num_defined([r1,d1,r2,d2])<2, "Conflicting or redundant radius/diameter arguments given.")
!is_undef(r1) ? assert(is_finite(r1), "Invalid radius r1." ) r1
: !is_undef(r2) ? assert(is_finite(r2), "Invalid radius r2." ) r2

View file

@ -795,13 +795,13 @@ module xcyl(l=undef, r=undef, d=undef, r1=undef, r2=undef, d1=undef, d2=undef, h
// ycyl(l=35, d=20);
// ycyl(l=35, d1=30, d2=10);
// }
module ycyl(l=undef, r=undef, d=undef, r1=undef, r2=undef, d1=undef, d2=undef, h=undef, anchor=CENTER)
module ycyl(l, r, d, r1, r2, d1, d2, h, anchor=CENTER)
{
r1 = get_radius(r1=r1, r=r, d1=d1, d=d, dflt=1);
r2 = get_radius(r1=r2, r=r, d1=d2, d=d, dflt=1);
l = first_defined([l, h, 1]);
attachable(anchor,0,UP, r1=r1, r2=r2, l=l, axis=BACK) {
cyl(l=l, h=h, r=r, r1=r1, r2=r2, d=d, d1=d1, d2=d2, orient=BACK, anchor=CENTER);
cyl(l=l, h=h, r1=r1, r2=r2, orient=BACK, anchor=CENTER);
children();
}
}

View file

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