BSPthread renamed to threadlib

+++++++++++++++++++++++++++++++

As it is now extensible to many types of threads => renamed to
threadlib.
Separated test code from production code.
This commit is contained in:
Adrian Schlatter
2019-04-06 19:08:44 +02:00
parent 0233c75e89
commit 369e81f8ae
6 changed files with 45 additions and 26 deletions

View File

Before

Width:  |  Height:  |  Size: 131 KiB

After

Width:  |  Height:  |  Size: 131 KiB

45
threadlib/test.scad Normal file
View File

@@ -0,0 +1,45 @@
/* Test and demonstrate thread library */
use <threadlib.scad>
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);
};
};

View File

@@ -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);
};
};
};