mirror of
https://github.com/nophead/NopSCADlib.git
synced 2025-09-09 06:31:32 +02:00
Added short inserts and M5 inserts.
screw_insert() now takes a short flag. screw_length() can now be passed an insert object.
This commit is contained in:
@@ -68,7 +68,7 @@ function screw_shorter_than(x) = x >= 20 ? floor(x / 5) * 5 : //! Returns the le
|
||||
|
||||
function screw_length(screw, thickness, washers, insert = false, nyloc = false, nut = false, longer = false) = //! Returns the length of the longest or shortest screw that will got through `thickness` and `washers` and possibly an `insert`, `nut` or `nyloc`
|
||||
let(washer = washers ? washers * washer_thickness(screw_washer(screw)) : 0,
|
||||
insert = insert ? insert_length(screw_insert(screw)) : 0,
|
||||
insert = insert ? insert_length(is_list(insert) ? insert : screw_insert(screw)) : 0,
|
||||
nut = nut || nyloc ? nut_thickness(screw_nut(screw), nyloc) : 0,
|
||||
total = thickness + washer + insert + nut
|
||||
)
|
||||
@@ -76,10 +76,11 @@ function screw_length(screw, thickness, washers, insert = false, nyloc = false,
|
||||
|
||||
function screw_smaller_than(d) = d >= 2.5 && d < 3 ? 2.5 : floor(d); // Largest diameter screw less than or equal to specified diameter
|
||||
|
||||
function screw_insert(screw, i = 0) = let(d = screw_radius(screw) * 2)
|
||||
i >= len(inserts) ? undef
|
||||
: insert_screw_diameter(inserts[i]) == d ? inserts[i]
|
||||
: screw_insert(screw, i + 1);
|
||||
function screw_insert(screw, short = false, i = 0) = //! Find insert to fit specified screw, defaults to longest but can specify the shortest
|
||||
let(d = screw_radius(screw) * 2, list = short ? short_inserts : inserts)
|
||||
i >= len(list) ? undef
|
||||
: insert_screw_diameter(list[i]) == d ? list[i]
|
||||
: screw_insert(screw, short, i + 1);
|
||||
|
||||
module screw(type, length, hob_point = 0, nylon = false) { //! Draw specified screw, optionally hobbed or nylon
|
||||
description = str("Screw ", nylon ? "Nylon " : "", type[1], length < 10 ? " x " : " x ", length, "mm", hob_point ? str(", hobbed at ", hob_point) : "");
|
||||
|
Reference in New Issue
Block a user