mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-07-31 09:10:27 +02:00
improve cuboid error handling
This commit is contained in:
@@ -192,7 +192,7 @@ function cube(size=1, center, anchor, spin=0, orient=UP) =
|
|||||||
// cuboid(40) show_anchors();
|
// cuboid(40) show_anchors();
|
||||||
|
|
||||||
module cuboid(
|
module cuboid(
|
||||||
size=[1,1,1],
|
size,
|
||||||
p1, p2,
|
p1, p2,
|
||||||
chamfer,
|
chamfer,
|
||||||
rounding,
|
rounding,
|
||||||
@@ -331,8 +331,9 @@ 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?)")
|
||||||
size = scalar_vec3(size);
|
assert(is_def(p1) || is_undef(p2), "If p2 is given you must also give p1");
|
||||||
|
size = scalar_vec3(default(size,[1,1,1]));
|
||||||
edges = _edges(edges, except=first_defined([except_edges,except]));
|
edges = _edges(edges, except=first_defined([except_edges,except]));
|
||||||
teardrop = is_bool(teardrop)&&teardrop? 45 : teardrop;
|
teardrop = is_bool(teardrop)&&teardrop? 45 : teardrop;
|
||||||
chamfer = approx(chamfer,0) ? undef : chamfer;
|
chamfer = approx(chamfer,0) ? undef : chamfer;
|
||||||
@@ -344,8 +345,8 @@ module cuboid(
|
|||||||
assert(is_undef(rounding) || is_finite(rounding),"rounding must be a finite value")
|
assert(is_undef(rounding) || is_finite(rounding),"rounding must be a finite value")
|
||||||
assert(is_undef(rounding) || is_undef(chamfer), "Cannot specify nonzero value for both chamfer and rounding")
|
assert(is_undef(rounding) || is_undef(chamfer), "Cannot specify nonzero value for both chamfer and rounding")
|
||||||
assert(teardrop==false || (is_finite(teardrop) && teardrop>0 && teardrop<=90), "teardrop must be either false or an angle number between 0 and 90")
|
assert(teardrop==false || (is_finite(teardrop) && teardrop>0 && teardrop<=90), "teardrop must be either false or an angle number between 0 and 90")
|
||||||
assert(is_undef(p1) || is_vector(p1))
|
assert(is_undef(p1) || is_vector(p1,3), "p1 must be a 3-vector")
|
||||||
assert(is_undef(p2) || is_vector(p2))
|
assert(is_undef(p2) || is_vector(p2,3), "p2 must be a 3-vector")
|
||||||
assert(is_bool(trimcorners));
|
assert(is_bool(trimcorners));
|
||||||
if (!is_undef(p1)) {
|
if (!is_undef(p1)) {
|
||||||
if (!is_undef(p2)) {
|
if (!is_undef(p2)) {
|
||||||
|
Reference in New Issue
Block a user