From bc4d606f3bf0b0fead25d11e51f7d1fca145037f Mon Sep 17 00:00:00 2001 From: Bobby Sun <46138297+iBobbyTS@users.noreply.github.com> Date: Wed, 24 Sep 2025 12:06:00 -0600 Subject: [PATCH] Add height calculation functions --- threadlib.scad | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/threadlib.scad b/threadlib.scad index e813570..fee6e81 100644 --- a/threadlib.scad +++ b/threadlib.scad @@ -78,3 +78,24 @@ module tap(designator, turns, higbee_arc=20, fn=120, table=THREAD_TABLE) { thread(str(designator, "-int"), turns=turns, higbee_arc=higbee_arc, fn=fn, table=table); }; } + +// Height calculation +function cal_thread_height(designator, turns, table=THREAD_TABLE) = + let(specs = thread_specs(designator, table=table)) + let(P = specs[0]) + (turns + 1) * P; + +function cal_bolt_height(designator, turns, table=THREAD_TABLE) = + let(specs = thread_specs(str(designator, "-ext"), table=table)) + let(P = specs[0]) + (turns + 1) * P; + +function cal_nut_height(designator, turns, table=THREAD_TABLE) = + let(specs = thread_specs(str(designator, "-int"), table=table)) + let(P = specs[0]) + (turns + 1) * P; + +function cal_tap_height(designator, turns, table=THREAD_TABLE) = + let(specs = thread_specs(str(designator, "-int"), table=table)) + let(P = specs[0]) + (turns + 1) * P;