Skip to content

Commit d07d76b

Browse files
cyl bugfix
1 parent 414036c commit d07d76b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

shapes3d.scad

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2263,10 +2263,10 @@ function _cyl_path(
22632263
)
22642264
assert(is_finite(round1), "rounding1 must be a number if given.")
22652265
assert(is_finite(round2), "rounding2 must be a number if given.")
2266-
assert(chamf1r <= r1, "chamfer1 is larger than the r1 radius of the cylinder.")
2267-
assert(chamf2r <= r2, "chamfer2 is larger than the r2 radius of the cylinder.")
2268-
assert(roundlen1 <= r1, "size of rounding1 is larger than the r1 radius of the cylinder.")
2269-
assert(roundlen2 <= r2, "size of rounding2 is larger than the r2 radius of the cylinder.")
2266+
assert(chamf1r/scale <= r1, "chamfer1 is larger than the r1 radius of the cylinder.")
2267+
assert(chamf2r/scale <= r2, "chamfer2 is larger than the r2 radius of the cylinder.")
2268+
assert(roundlen1*unscale/scale <= r1, "size of rounding1 is larger than the r1 radius of the cylinder.")
2269+
assert(roundlen2*unscale/scale <= r2, "size of rounding2 is larger than the r2 radius of the cylinder.")
22702270
assert(dy1+dy2 <= facelen, "Chamfers/roundings don't fit on the cylinder/cone. They exceed the length of the cylinder/cone face.")
22712271
assert(td_ang==90 || clip_ang==90, "teardrop= and clip_angle= are mutually exclusive options.")
22722272
[
@@ -2276,11 +2276,11 @@ function _cyl_path(
22762276
[r1, -l/2] + xscale(1/scale,polar_to_xy(chamf1l,90+vang)),
22772277
]
22782278
else if (!approx(round1,0) && td_ang < 90)
2279-
each xscale(1/scale,_teardrop_corner(r=round1*unscale, corner=[[max(0,r1*scale-2*roundlen1),-l/2],[r1*scale,-l/2],[r2*scale,l/2]], ang=td_ang))
2279+
each xscale(1/scale,_teardrop_corner(r=round1*unscale, corner=[[r1*scale-2*roundlen1,-l/2],[r1*scale,-l/2],[r2*scale,l/2]], ang=td_ang))
22802280
else if (!approx(round1,0) && clip_ang < 90)
2281-
each xscale(1/scale,_clipped_corner(r=round1*unscale, corner=[[max(0,r1*scale-2*roundlen1),-l/2],[r1*scale,-l/2],[r2*scale,l/2]], ang=clip_ang))
2281+
each xscale(1/scale,_clipped_corner(r=round1*unscale, corner=[[r1*scale-2*roundlen1,-l/2],[r1*scale,-l/2],[r2*scale,l/2]], ang=clip_ang))
22822282
else if (!approx(round1,0) && td_ang >= 90)
2283-
each xscale(1/scale,arc(r=abs(round1*unscale), corner=[[max(0,r1*scale-2*roundlen1),-l/2],[r1*scale,-l/2],[r2*scale,l/2]]))
2283+
each xscale(1/scale,arc(r=abs(round1*unscale), corner=[[r1*scale-2*roundlen1,-l/2],[r1*scale,-l/2],[r2*scale,l/2]]))
22842284
else [r1,-l/2],
22852285

22862286
if (is_finite(chamf2r) && !approx(chamf2r,0))
@@ -2289,7 +2289,7 @@ function _cyl_path(
22892289
[r2-chamf2r/scale, l/2]
22902290
]
22912291
else if (is_finite(round2) && !approx(round2,0))
2292-
each xscale(1/scale,arc(r=abs(round2), corner=[[r1*scale,-l/2],[r2*scale,l/2],[max(0,r2*scale-2*roundlen2),l/2]]))
2292+
each xscale(1/scale,arc(r=abs(round2*unscale), corner=[[r1*scale,-l/2],[r2*scale,l/2],[r2*scale-2*roundlen2,l/2]]))
22932293
else [r2,l/2],
22942294
];
22952295

@@ -2455,7 +2455,7 @@ module cyl(
24552455
cylinder(h=l, r1=r1, r2=r2, center=true, $fn=sides);
24562456
} else {
24572457
vnf = cyl(
2458-
l=l, r1=r1, r2=r2, center=true,
2458+
l=l, r1=_r1, r2=_r2, center=true, circum=circum,
24592459
chamfer=chamfer, chamfer1=chamfer1, chamfer2=chamfer2,
24602460
chamfang=chamfang, chamfang1=chamfang1, chamfang2=chamfang2,
24612461
rounding=rounding, rounding1=rounding1, rounding2=rounding2,

0 commit comments

Comments
 (0)