Improved error message for skin()

This commit is contained in:
Adrian Mariano 2020-12-31 08:58:22 -05:00
parent a495528398
commit 5269b26703

View File

@ -399,8 +399,10 @@ function skin(profiles, slices, refine=1, method="direct", sampling, caps, close
assert(!closed || !caps, "Cannot make closed shape with caps")
let(
profile_dim=array_dim(profiles,2),
profiles_zcheck = (profile_dim != 2) || (profile_dim==2 && is_list(z) && len(z)==len(profiles)),
profiles_ok = (profile_dim==2 && is_list(z) && len(z)==len(profiles)) || profile_dim==3
)
assert(profiles_zcheck, "z parameter is invalid or has the wrong length.")
assert(profiles_ok,"Profiles must all be 3d or must all be 2d, with matching length z parameter.")
assert(is_undef(z) || profile_dim==2, "Do not specify z with 3d profiles")
assert(profile_dim==3 || len(z)==len(profiles),"Length of z does not match length of profiles.")