From 3830919a9937d2f662f7205f1dfd28c5bb948aba Mon Sep 17 00:00:00 2001 From: Adrian Schlatter <10478149+adrianschlatter@users.noreply.github.com> Date: Sat, 27 Jan 2024 12:32:39 +0100 Subject: [PATCH] Fix backwards compatibility nut_sides arg * nut_sides must be last argument * default value = 0. With 120 as default, we cannot set nut_sides to 120 while simultaneously setting fn to something different from 120. --- docs/img_prep/nut_sides.scad | 15 +++++++++++++++ threadlib.scad | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 docs/img_prep/nut_sides.scad diff --git a/docs/img_prep/nut_sides.scad b/docs/img_prep/nut_sides.scad new file mode 100644 index 0000000..acebdcb --- /dev/null +++ b/docs/img_prep/nut_sides.scad @@ -0,0 +1,15 @@ +/* +Demo nut_sides argument of nut() module. +*/ + +use +include <../../THREAD_TABLE.scad> + +type = "M12x0.5"; +turns = 7; +Douter = 16; +higbee_arc = 45; +fn = 16; +nut_sides = 6; + +nut(type, turns, Douter, higbee_arc, fn, THREAD_TABLE, nut_sides); diff --git a/threadlib.scad b/threadlib.scad index d3ed2cf..e813570 100644 --- a/threadlib.scad +++ b/threadlib.scad @@ -48,8 +48,8 @@ module bolt(designator, turns, higbee_arc=20, fn=120, table=THREAD_TABLE) { }; }; -module nut(designator, turns, Douter, higbee_arc=20, fn=120, nut_sides=120, table=THREAD_TABLE) { - nut_sides = nut_sides == 120 ? fn : nut_sides; +module nut(designator, turns, Douter, higbee_arc=20, fn=120, table=THREAD_TABLE, nut_sides=0) { + nut_sides = nut_sides == 0 ? fn : nut_sides; union() { specs = thread_specs(str(designator, "-int"), table=table); P = specs[0]; Dsupport = specs[2];