diff --git a/arrays.scad b/arrays.scad index eea3ffe..aa3f9a2 100644 --- a/arrays.scad +++ b/arrays.scad @@ -848,7 +848,7 @@ function zip(vecs, v2, v3, fit=false, fill=undef) = (v3!=undef)? zip([vecs,v2,v3], fit=fit, fill=fill) : (v2!=undef)? zip([vecs,v2], fit=fit, fill=fill) : let( - dummy1 = assert_in_list("fit", fit, [false, "short", "long"]), + dummy1 = assert(in_list(fit, [false, "short", "long"])), minlen = list_shortest(vecs), maxlen = list_longest(vecs), dummy2 = (fit==false)? assert(minlen==maxlen, "Input vectors must have the same length") : 0 diff --git a/beziers.scad b/beziers.scad index 7ec9fe9..a105e3a 100644 --- a/beziers.scad +++ b/beziers.scad @@ -379,7 +379,7 @@ function bezier_close_to_axis(bezier, N=3, axis="X") = [for (i=[1:1:N]) lerp(ep, [0,ep.y], i/N)], [for (i=[1:1:N]) lerp([0,ep.y], [0,sp.y], i/N)] ) : ( - assert_in_list("axis", axis, ["X","Y"]) + assert(in_list(axis, ["X","Y"])) ); diff --git a/errors.scad b/errors.scad index 0836271..4a3e009 100644 --- a/errors.scad +++ b/errors.scad @@ -12,34 +12,6 @@ // Section: Warnings and Errors -// Function&Module: assert_in_list() -// Usage: -// assert_in_list(argname, val, l, [idx]); -// Description: -// Emulates the newer OpenSCAD `assert()` with an `in_list()` test. -// You can also use this as a function call from a function. -// Arguments: -// argname = The name of the argument value being tested. -// val = The value to test if it exists in the list. -// l = The list to look for `val` in. -// idx = If given, and `l` is a list of lists, look for `val` in the given index of each sublist. -module assert_in_list(argname, val, l, idx=undef) { - dummy = assert_in_list(argname, val, l, idx); -} - -function assert_in_list(argname, val, l, idx=undef) = - let(succ = search([val], l, num_returns_per_match=1, index_col_num=idx) != [[]]) - succ? 0 : let( - msg = str( - "In argument '", argname, "', ", - (is_string(val)? str("\"", val, "\"") : val), - " must be one of ", - (!is_undef(idx)? [for (v=l) v[idx]] : l) - ), - FAILED=succ - ) assert(FAILED, msg); - - // Module: no_children() // Usage: // no_children($children); diff --git a/partitions.scad b/partitions.scad index 65552a5..ef3c4fd 100644 --- a/partitions.scad +++ b/partitions.scad @@ -35,7 +35,7 @@ function _partition_cutpath(l, h, cutsize, cutpath, gap) = cutpath = is_path(cutpath)? cutpath : ( assert(is_string(cutpath), "cutpath must be a 2D path or a string.") let(idx = search([cutpath], _partition_cutpaths)) - idx==[[]]? assert_in_list("cutpath",cutpath,_partition_cutpaths,idx=0) : + idx==[[]]? assert(in_list(cutpath,_partition_cutpaths,idx=0)) : _partition_cutpaths[idx.x][1] ), reps = ceil(l/(cutsize.x+gap)), diff --git a/transforms.scad b/transforms.scad index 9023339..e81cdf6 100644 --- a/transforms.scad +++ b/transforms.scad @@ -1209,7 +1209,7 @@ module zdistribute(spacing=10, sizes=undef, l=undef) // } module grid2d(size=undef, spacing=undef, cols=undef, rows=undef, stagger=false, scale=[1,1,1], in_poly=undef, anchor=CENTER, spin=0, orient=UP) { - assert_in_list("stagger", stagger, [false, true, "alt"]); + assert(in_list(stagger, [false, true, "alt"])); scl = vmul(scalar_vec3(scale, 1), (stagger!=false? [0.5, sin(60), 1] : [1,1,1])); if (!is_undef(size)) { siz = scalar_vec3(size);