handle undef properly in cuboid

This commit is contained in:
Adrian Mariano 2025-02-23 18:06:57 -05:00
parent 2df5a09438
commit cf5bfa0f3b
2 changed files with 2 additions and 2 deletions

View file

@ -461,7 +461,7 @@ function list(l) = is_list(l)? l : [for (x=l) x];
// Arguments:
// value = The value or list to coerce into a list.
// n = The number of items in the coerced list. Default: 1
// fill = The value to pad the coerced list with, after the firt value. Default: undef (pad with copies of `value`)
// fill = The value to pad the coerced list with, after the first value. Default: undef (pad with copies of `value`)
// Example:
// x = force_list([3,4,5]); // Returns: [3,4,5]
// y = force_list(5); // Returns: [5]

View file

@ -332,7 +332,7 @@ module cuboid(
}
sizecheck = assert(num_defined([size,p1,p2])!=3, "\nCannot give size if p2 is given (did you forget braces on the size argument?)")
assert(is_def(p1) || is_undef(p2), "If p2 is given you must also give p1");
size = default(force_list(size,3),[1,1,1]);
size = force_list(default(size,1),3);
edges = _edges(edges, except=first_defined([except_edges,except]));
teardrop = is_bool(teardrop)&&teardrop? 45 : teardrop;
chamfer = approx(chamfer,0) ? undef : chamfer;