threadlib-0.1

This commit is contained in:
Adrian Schlatter
2019-04-08 10:52:24 +02:00
8 changed files with 266 additions and 9 deletions

26
LICENSE Normal file
View File

@@ -0,0 +1,26 @@
Copyright 2019 Adrian Schlatter
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -1,14 +1,101 @@
PET-Bottle Waterrocket Fins
threadlib
+++++++++++++++++++++++++++
This is a CAD-model of fins intended to be screwed onto a PET bottle to create a
water rocket. To create the rocket, you need:
threadlib is a library of standard threads for OpenSCAD. It is based on Helges
excellent `threadprofile.scad
<https://github.com/MisterHW/IoP-satellite/tree/master/OpenSCAD%20bottle%20threads>`__
to create nice threads with lead-in / lead-out tapers. Check out his `article on
generating nice threads
<https://hackaday.io/page/5252-generating-nice-threads-in-openscad>`__ on
Hackaday.
- bottle with PCO-1881 threading (e.g. a 1.5-l Coke bottle)
- this part
- Gardena tap connector G 1"
- launcher
In contrast to other thread libraries, threadlib does not make you look up
diameters and pitches and maybe even thread-profiles in tables and norms: It has
these tables built in.
(+ water + pressurized air).
Creating a thread is as simple as
.. code-block:: OpenSCAD
thread("G1/2-ext", turns=10, higbee_arc=20);
to create a British Standard Pipe parallel external thread. Furthermore,
threadlib allows for production tolerances by choosing thread dimensions well
inside the ranges allowed by the norms.
Usage
===========================
To create a bolt (without head) with 10 turns of G1-inch thread:
.. code-block:: OpenSCAD
bolt("G1", turns=10);
A nut:
.. code-block:: OpenSCAD
nut("G1", turns=10, Douter=40);
Note that for a nut you also have to specify an outer diameter. The inner
diameter is implicitly given by the thread designator ("G1" in this case).
If you only need the threads alone:
.. code-block:: OpenSCAD
thread("G2 1/2-ext", turns=5);
Then, add the support you want. In the simplest case, a cylinder (which is what
nut(...) uses):
.. code-block:: OpenSCAD
specs = thread_specs("G2 1/2-ext");
P = specs[0]; Rrot = specs[1]; Dsupport = specs[2];
section_profile = specs[3];
H = (5 + 1) * P;
translate([0, 0, -P / 2])
cylinder(h=H, d=Dsupport, $fn=120);
Here, we have used the function thread_specs(...) to look up the threads
specifications - including the recommended diameter of the support structure.
List of supported threads
===========================
Currently, threadlib knows these threads:
- British Standard Pipe Parallel Threadss G1/16 to G6
Extensibility
===========================
Don't find some of the threads you need for your project? Don't worry: You can
add your own:
.. code-block:: OpenSCAD
use <threadlib/threadlib.scad>
MY_THREAD_TABLE = [
["special", [pitch, Rrot, Dsupport,
[[r0, z0], [r1, z1], ..., [rn, zn]]]]
];
thread("special", turns=15, table=MY_THREAD_TABLE);
Care to share? Safe others from repeating the valuable work you have already
accomplished and get the fame you deserve: Send in your tried and tested threads
for addition to threadlib!
Change Log
===========================
- 0.1: Initial release supporting BSP parallel thread
Use at your own risk.

52
THREAD_TABLE.scad Normal file
View File

@@ -0,0 +1,52 @@
/* This script is auto-generated - do not edit
:License: 3-clause BSD. See LICENSE. */
THREAD_TABLE = [["G1/16-int", [0.907, 3.98, 7.92, [[0, 0.42515625], [0, -0.42515625], [-0.560841406, -0.12426807], [-0.560841406, 0.12426807
]]]],
["G1/8-int", [0.907, 4.98138486, 9.93, [[0, 0.42515625], [0, -0.42515625], [-0.560841406, -0.12426807], [-0.560841406, 0.12426807
]]]],
["G1/4-int", [1.337, 6.743577241, 13.43, [[0, 0.62671875], [0, -0.62671875], [-0.826730937, -0.18318237], [-0.826730937, 0.18318237
]]]],
["G3/8-int", [1.337, 8.496077241, 16.94, [[0, 0.62671875], [0, -0.62671875], [-0.826730937, -0.18318237], [-0.826730937, 0.18318237
]]]],
["G1/2-int", [1.814, 10.69426972, 21.32, [[0, 0.8503125], [0, -0.8503125], [-1.121682812, -0.24853614], [-1.121682812, 0.24853614
]]]],
["G5/8-int", [1.814, 11.67226972, 23.27, [[0, 0.8503125], [0, -0.8503125], [-1.121682812, -0.24853614], [-1.121682812, 0.24853614
]]]],
["G3/4-int", [1.814, 13.43726972, 26.80, [[0, 0.8503125], [0, -0.8503125], [-1.121682812, -0.24853614], [-1.121682812, 0.24853614
]]]],
["G7/8-int", [1.814, 15.31726972, 30.56, [[0, 0.8503125], [0, -0.8503125], [-1.121682812, -0.24853614], [-1.121682812, 0.24853614
]]]],
["G1-int", [2.309, 16.90027607, 33.71, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609
]]]],
["G1 1/8-int", [2.309, 19.22427607, 38.36, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609
]]]],
["G1 1/4-int", [2.309, 21.23077607, 42.37, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609
]]]],
["G1 1/2-int", [2.309, 24.17727607, 48.26, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609
]]]],
["G1 3/4-int", [2.309, 27.14877607, 54.21, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609
]]]],
["G2-int", [2.309, 30.08277607, 60.07, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609
]]]],
["G2 1/4-int", [2.309, 33.14002607, 66.19, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609
]]]],
["G2 1/2-int", [2.309, 37.87702607, 75.66, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609
]]]],
["G2 3/4-int", [2.309, 41.05202607, 82.01, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609
]]]],
["G3-int", [2.309, 44.22702607, 88.36, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609
]]]],
["G3 1/2-int", [2.309, 50.45002607, 100.81, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609
]]]],
["G4-int", [2.309, 56.80002607, 113.51, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609
]]]],
["G4 1/2-int", [2.309, 63.15002607, 126.21, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609
]]]],
["G5-int", [2.309, 69.50002607, 138.91, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609
]]]],
["G5 1/2-int", [2.309, 75.85002607, 151.61, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609
]]]],
["G6-int", [2.309, 82.20002607, 164.31, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609
]]]],
["G1/16-ext", [0.907, 3.21661514, 6.47, [[0, -0.42515625], [0, 0.42515625], [0.578008291, 0.12426807], [0.578008291, -0.12426807

5
autogenerate.awk Normal file
View File

@@ -0,0 +1,5 @@
BEGIN { print "/* This script is auto-generated - do not edit"
print " :License: 3-clause BSD. See LICENSE. */"
printf "\nTHREAD_TABLE = [" }
/^G/ { print "[\"" $1 "\", [" $2 ", " $3 ", " $4 ", [[" $5 ", " $6 "], [" $7 ", " $8 "], [" $9 ", " $10 "], [" $11 ", " $12 "]]]],"}
END { print "];" }

BIN
img/BSPthread.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

25
test.scad Normal file
View File

@@ -0,0 +1,25 @@
/*
Test and demonstrate thread library
:Author: Adrian Schlatter
:Date: 2019-04-07
:License: 3-Clause BSD. See LICENSE.
*/
use <threadlib/threadlib.scad>
echo ("threadlib version: ", __THREADLIB_VERSION());
type = "G1";
turns = 5;
Douter = thread_specs(str(type, "-int"))[2] * 1.2;
intersection() {
color("Green")
translate([-100, 0, -100])
cube(200, 200, 200);
union() {
bolt(type, turns);
nut(type, turns, Douter);
};
};

62
threadlib.scad Normal file
View File

@@ -0,0 +1,62 @@
/*
threadlib
+++++++++
Create threads easily.
:Author: Adrian Schlatter
:Date: 2019-04-07
:License: 3-Clause BSD. See LICENSE.
*/
function __THREADLIB_VERSION() = 0.1;
use <thread_profile.scad>
include <THREAD_TABLE.scad>
function thread_specs(designator, table=THREAD_TABLE) =
/* Returns thread specs of thread-type 'designator' as a vector of
[pitch, Rrotation, Dsupport, section_profile] */
table[search([designator], table, num_returns_per_match=1,
index_col_num=0)[0]][1];
module thread(designator, turns, higbee_arc=20, fn=120, table=THREAD_TABLE)
{
specs = thread_specs(designator, table=table);
P = specs[0]; Rrotation = specs[1]; section_profile = specs[3];
straight_thread(
section_profile=section_profile,
higbee_arc=higbee_arc,
r=Rrotation,
turns=turns,
pitch=P);
}
module bolt(designator, turns, higbee_arc=20, fn=120, table=THREAD_TABLE) {
union() {
specs = thread_specs(str(designator, "-ext"), table=table);
P = specs[0]; Dsupport = specs[2];
H = (turns + 1) * P;
thread(str(designator, "-ext"), turns=turns, higbee_arc=higbee_arc, fn=fn, table=table);
translate([0, 0, -P / 2])
cylinder(h=H, d=Dsupport, $fn=fn);
};
};
module nut(designator, turns, Douter, higbee_arc=20, fn=120, table=THREAD_TABLE) {
union() {
specs = thread_specs(str(designator, "-int"), table=table);
P = specs[0]; Dsupport = specs[2];
H = (turns + 1) * P;
rotate(180)
thread(str(designator, "-int"), turns=turns, higbee_arc=higbee_arc, fn=fn, table=table);
translate([0, 0, -P / 2])
difference() {
cylinder(h=H, d=Douter, $fn=fn);
translate([0, 0, -0.1])
cylinder(h=H+0.2, d=Dsupport, $fn=fn);
};
};
};

BIN
threads.xlsx Normal file

Binary file not shown.