Quantize up to a multiple of 4 for rounded edges.

This commit is contained in:
Garth Minette 2022-01-12 23:13:36 -08:00
parent 45c6e7bbbd
commit 79a148cd29

View File

@ -102,9 +102,9 @@ function cube(size=1, center, anchor, spin=0, orient=UP) =
// Creates a cube or cuboid object, with optional chamfering or rounding of edges and corners.
// You cannot mix chamfering and rounding: just one edge treatment with the same size applies to all selected edges.
// Negative chamfers and roundings can be applied to create external fillets, but they
// but only apply to edges around the top or bottom faces. If you specify an edge set other than "ALL"
// with such roundings or chamfers then you will get an error. See
// [Specifying Edges](attachments.scad#section-specifying-edges) for information on how to specify edge sets.
// only apply to edges around the top or bottom faces. If you specify an edge set other than "ALL"
// with negative roundings or chamfers then you will get an error. See [Specifying Edges](attachments.scad#section-specifying-edges)
// for information on how to specify edge sets.
// Arguments:
// size = The size of the cube, a number or length 3 vector.
// ---
@ -192,7 +192,7 @@ module cuboid(
dummy=assert(is_finite(r) && !approx(r,0));
c = [min(r,size.x/2), min(r,size.y/2), min(r,size.z/2)];
c2 = v_mul(corner,c/2);
$fn = is_finite(chamfer)? 4 : segs(r);
$fn = is_finite(chamfer)? 4 : quantup(segs(r),4);
translate(v_mul(corner, size/2-c)) {
if (cnt == 0 || approx(r,0)) {
translate(c2) cube(c, center=true);