diff --git a/THREAD_TABLE.scad b/threadlib/THREAD_TABLE.scad similarity index 100% rename from THREAD_TABLE.scad rename to threadlib/THREAD_TABLE.scad diff --git a/BSPthread/autogenerate.awk b/threadlib/autogenerate.awk similarity index 100% rename from BSPthread/autogenerate.awk rename to threadlib/autogenerate.awk diff --git a/BSPthread/BSPthread.jpg b/threadlib/img/BSPthread.jpg similarity index 100% rename from BSPthread/BSPthread.jpg rename to threadlib/img/BSPthread.jpg diff --git a/threadlib/test.scad b/threadlib/test.scad new file mode 100644 index 0000000..bbd41a5 --- /dev/null +++ b/threadlib/test.scad @@ -0,0 +1,45 @@ +/* Test and demonstrate thread library */ + +use + +module bolt(designator, turns, fn=120) { + union() { + specs = thread_specs(str(designator, "-ext")); + P = specs[0]; Dsupport = specs[2]; + H = (turns + 1) * P; + thread(str(designator, "-ext"), turns=turns, higbee_arc=20, fn=fn); + translate([0, 0, -P / 2]) + cylinder(h=H, d=Dsupport, $fn=fn); + }; +}; + +module nut(designator, turns, fn=120) { + union() { + specs = thread_specs(str(designator, "-int")); + P = specs[0]; Dsupport = specs[2]; + H = (turns + 1) * P; + rotate(180) + thread(str(designator, "-int"), turns=turns, higbee_arc=20, fn=fn); + + translate([0, 0, -P / 2]) + difference() { + cylinder(h=H, d=Dsupport * 1.1, $fn=fn); + translate([0, 0, -0.1]) + cylinder(h=H+0.2, d=Dsupport, $fn=fn); + }; + }; +}; + + +type = "G1"; +turns = 5; + +intersection() { + color("Green") + translate([-100, 0, -100]) + cube(200, 200, 200); + union() { + bolt(type, turns); + nut(type, turns); + }; +}; diff --git a/BSPthread.scad b/threadlib/threadlib.scad similarity index 64% rename from BSPthread.scad rename to threadlib/threadlib.scad index cdb0ed7..050eef2 100644 --- a/BSPthread.scad +++ b/threadlib/threadlib.scad @@ -41,7 +41,6 @@ module thread(designator, turns, higbee_arc=45, fn=120) { specs = thread_specs(designator); P = specs[0]; Rrotation = specs[1]; section_profile = specs[3]; - echo(designator, "Rrotation", Rrotation); straight_thread( section_profile=section_profile, higbee_arc=higbee_arc, @@ -49,28 +48,3 @@ module thread(designator, turns, higbee_arc=45, fn=120) turns=turns, pitch=P); } - - -// testing: - -type = "G1"; -intersection() { - color("Green") - translate([-100, 0, -100]) - cube(200, 200, 200); - union() { - echo("Dsupport", thread_specs(str(type, "-ext"))[2]); - thread(str(type, "-ext"), turns=3, higbee_arc=20, fn=120); - translate([0, 0, -1.2]) - cylinder(h=9, d=thread_specs(str(type, "-ext"))[2], $fn=120); - - rotate(180) - thread(str(type, "-int"), turns=3, higbee_arc=20, fn=120); - translate([0, 0, -0.9]) - difference() { - cylinder(h=9, r=200, $fn=120); - translate([0, 0, -0.1]) - cylinder(h=10, d=thread_specs(str(type, "-int"))[2], $fn=120); - }; - }; -}; diff --git a/BSPthread/BSPthread.xlsx b/threadlib/threads.xlsx similarity index 100% rename from BSPthread/BSPthread.xlsx rename to threadlib/threads.xlsx