screws update, including critical bugfix

This commit is contained in:
Adrian Mariano
2022-09-08 21:37:54 -04:00
parent b675dfdd6b
commit 62733fb0d7
5 changed files with 620 additions and 188 deletions

View File

@@ -697,7 +697,8 @@ function get_radius(r1, r2, r, d1, d2, d, dflt) =
// same way that OpenSCAD expands short vectors in some contexts, e.g. cube(10) or rotate([45,90]).
// If `v` is a scalar, and `dflt==undef`, returns `[v, v, v]`.
// If `v` is a scalar, and `dflt!=undef`, returns `[v, dflt, dflt]`.
// If `v` is a vector, returns the first 3 items, with any missing values replaced by `dflt`.
// If `v` is a vector and dflt is defined, returns the first 3 items, with any missing values replaced by `dflt`.
// If `v` is a vector and dflt is undef, returns the first 3 items, with any missing values replaced by 0.
// If `v` is `undef`, returns `undef`.
// Arguments:
// v = Value to return vector from.
@@ -707,6 +708,8 @@ function get_radius(r1, r2, r, d1, d2, d, dflt) =
// vec = scalar_vec3(10); // Returns: [10,10,10]
// vec = scalar_vec3(10,1); // Returns: [10,1,1]
// vec = scalar_vec3([10,10],1); // Returns: [10,10,1]
// vec = scalar_vec3([10,10]); // Returns: [10,10,0]
// vec = scalar_vec3([10]); // Returns: [10,0,0]
function scalar_vec3(v, dflt) =
is_undef(v)? undef :
is_list(v)? [for (i=[0:2]) default(v[i], default(dflt, 0))] :