mirror of
https://github.com/adrianschlatter/threadlib.git
synced 2025-08-08 14:26:39 +02:00
Docs and License
++++++++++++++++ - README.rst - LICENSE - License in code files - nut and bolt to threadlib.scad (from test.scad) - added feature to be able to use custom threads (table argument)
This commit is contained in:
26
threadlib/LICENSE
Normal file
26
threadlib/LICENSE
Normal 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.
|
81
threadlib/README.rst
Normal file
81
threadlib/README.rst
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
threadlib
|
||||||
|
+++++++++++++++++++++++++++
|
||||||
|
|
||||||
|
threadlib is a library of standard threads for OpenSCAD.
|
||||||
|
|
||||||
|
In contrast to other thread libraries, it does not make you look up diameters
|
||||||
|
and pitches and maybe even thread-profiles in tables and norms: It has these
|
||||||
|
tables built in.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
|
||||||
|
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.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!
|
||||||
|
|
@@ -1,51 +1,52 @@
|
|||||||
/* This script is auto-generated - do not edit */
|
/* This script is auto-generated - do not edit
|
||||||
|
:License: 3-clause BSD. See LICENSE. */
|
||||||
|
|
||||||
THREAD_TABLE = [["G1/16-int", [0.907, 3.97888486, 7.921471162, [[0, 0.42515625], [0, -0.42515625], [-0.560841406, -0.12426807], [-0.560841406, 0.12426807]]]],
|
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.926471162, [[0, 0.42515625], [0, -0.42515625], [-0.560841406, -0.12426807], [-0.560841406, 0.12426807]]]],
|
]]]],
|
||||||
["G1/4-int", [1.337, 6.743577241, 13.43364713, [[0, 0.62671875], [0, -0.62671875], [-0.826730937, -0.18318237], [-0.826730937, 0.18318237]]]],
|
["G1/8-int", [0.907, 4.98138486, 9.93, [[0, 0.42515625], [0, -0.42515625], [-0.560841406, -0.12426807], [-0.560841406, 0.12426807
|
||||||
["G3/8-int", [1.337, 8.496077241, 16.93864713, [[0, 0.62671875], [0, -0.62671875], [-0.826730937, -0.18318237], [-0.826730937, 0.18318237]]]],
|
]]]],
|
||||||
["G1/2-int", [1.814, 10.69426972, 21.31594232, [[0, 0.8503125], [0, -0.8503125], [-1.121682812, -0.24853614], [-1.121682812, 0.24853614]]]],
|
["G1/4-int", [1.337, 6.743577241, 13.43, [[0, 0.62671875], [0, -0.62671875], [-0.826730937, -0.18318237], [-0.826730937, 0.18318237
|
||||||
["G5/8-int", [1.814, 11.67226972, 23.27194232, [[0, 0.8503125], [0, -0.8503125], [-1.121682812, -0.24853614], [-1.121682812, 0.24853614]]]],
|
]]]],
|
||||||
["G3/4-int", [1.814, 13.43726972, 26.80194232, [[0, 0.8503125], [0, -0.8503125], [-1.121682812, -0.24853614], [-1.121682812, 0.24853614]]]],
|
["G3/8-int", [1.337, 8.496077241, 16.94, [[0, 0.62671875], [0, -0.62671875], [-0.826730937, -0.18318237], [-0.826730937, 0.18318237
|
||||||
["G7/8-int", [1.814, 15.31726972, 30.56194232, [[0, 0.8503125], [0, -0.8503125], [-1.121682812, -0.24853614], [-1.121682812, 0.24853614]]]],
|
]]]],
|
||||||
["G1-int", [2.309, 16.90027607, 33.70814489, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609]]]],
|
["G1/2-int", [1.814, 10.69426972, 21.32, [[0, 0.8503125], [0, -0.8503125], [-1.121682812, -0.24853614], [-1.121682812, 0.24853614
|
||||||
["G1 1/8-int", [2.309, 19.22427607, 38.35614489, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609]]]],
|
]]]],
|
||||||
["G1 1/4-int", [2.309, 21.23077607, 42.36914489, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609]]]],
|
["G5/8-int", [1.814, 11.67226972, 23.27, [[0, 0.8503125], [0, -0.8503125], [-1.121682812, -0.24853614], [-1.121682812, 0.24853614
|
||||||
["G1 1/2-int", [2.309, 24.17727607, 48.26214489, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609]]]],
|
]]]],
|
||||||
["G1 3/4-int", [2.309, 27.14877607, 54.20514489, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609]]]],
|
["G3/4-int", [1.814, 13.43726972, 26.80, [[0, 0.8503125], [0, -0.8503125], [-1.121682812, -0.24853614], [-1.121682812, 0.24853614
|
||||||
["G2-int", [2.309, 30.08277607, 60.07314489, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609]]]],
|
]]]],
|
||||||
["G2 1/4-int", [2.309, 33.14002607, 66.18764489, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609]]]],
|
["G7/8-int", [1.814, 15.31726972, 30.56, [[0, 0.8503125], [0, -0.8503125], [-1.121682812, -0.24853614], [-1.121682812, 0.24853614
|
||||||
["G2 1/2-int", [2.309, 37.87702607, 75.66164489, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609]]]],
|
]]]],
|
||||||
["G2 3/4-int", [2.309, 41.05202607, 82.01164489, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609]]]],
|
["G1-int", [2.309, 16.90027607, 33.71, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609
|
||||||
["G3-int", [2.309, 44.22702607, 88.36164489, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609]]]],
|
]]]],
|
||||||
["G3 1/2-int", [2.309, 50.45002607, 100.8076449, [[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
|
||||||
["G4-int", [2.309, 56.80002607, 113.5076449, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609]]]],
|
]]]],
|
||||||
["G4 1/2-int", [2.309, 63.15002607, 126.2076449, [[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
|
||||||
["G5-int", [2.309, 69.50002607, 138.9076449, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609]]]],
|
]]]],
|
||||||
["G5 1/2-int", [2.309, 75.85002607, 151.6076449, [[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
|
||||||
["G6-int", [2.309, 82.20002607, 164.3076449, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609]]]],
|
]]]],
|
||||||
["G1/16-ext", [0.907, 3.21661514, 6.469528838, [[0, -0.42515625], [0, 0.42515625], [0.578008291, 0.12426807], [0.578008291, -0.12426807]]]],
|
["G1 3/4-int", [2.309, 27.14877607, 54.21, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609
|
||||||
["G1/8-ext", [0.907, 4.21911514, 8.474528838, [[0, -0.42515625], [0, 0.42515625], [0.578008291, 0.12426807], [0.578008291, -0.12426807]]]],
|
]]]],
|
||||||
["G1/4-ext", [1.337, 5.619922759, 11.29335287, [[0, -0.62671875], [0, 0.62671875], [0.852036477, 0.18318237], [0.852036477, -0.18318237]]]],
|
["G2-int", [2.309, 30.08277607, 60.07, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609
|
||||||
["G3/8-ext", [1.337, 7.372422759, 14.79835287, [[0, -0.62671875], [0, 0.62671875], [0.852036477, 0.18318237], [0.852036477, -0.18318237]]]],
|
]]]],
|
||||||
["G1/2-ext", [1.814, 9.16973028, 18.41205768, [[0, -0.8503125], [0, 0.8503125], [1.156016582, 0.24853614], [1.156016582, -0.24853614]]]],
|
["G2 1/4-int", [2.309, 33.14002607, 66.19, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609
|
||||||
["G5/8-ext", [1.814, 10.14773028, 20.36805768, [[0, -0.8503125], [0, 0.8503125], [1.156016582, 0.24853614], [1.156016582, -0.24853614]]]],
|
]]]],
|
||||||
["G3/4-ext", [1.814, 11.91273028, 23.89805768, [[0, -0.8503125], [0, 0.8503125], [1.156016582, 0.24853614], [1.156016582, -0.24853614]]]],
|
["G2 1/2-int", [2.309, 37.87702607, 75.66, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609
|
||||||
["G7/8-ext", [1.814, 13.79273028, 27.65805768, [[0, -0.8503125], [0, 0.8503125], [1.156016582, 0.24853614], [1.156016582, -0.24853614]]]],
|
]]]],
|
||||||
["G1-ext", [2.309, 14.95972393, 30.01185511, [[0, -1.08234375], [0, 1.08234375], [1.471467634, 0.31635609], [1.471467634, -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
|
||||||
["G1 1/8-ext", [2.309, 17.28372393, 34.65985511, [[0, -1.08234375], [0, 1.08234375], [1.471467634, 0.31635609], [1.471467634, -0.31635609]]]],
|
]]]],
|
||||||
["G1 1/4-ext", [2.309, 19.29022393, 38.67285511, [[0, -1.08234375], [0, 1.08234375], [1.471467634, 0.31635609], [1.471467634, -0.31635609]]]],
|
["G3-int", [2.309, 44.22702607, 88.36, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609
|
||||||
["G1 1/2-ext", [2.309, 22.23672393, 44.56585511, [[0, -1.08234375], [0, 1.08234375], [1.471467634, 0.31635609], [1.471467634, -0.31635609]]]],
|
]]]],
|
||||||
["G1 3/4-ext", [2.309, 25.20822393, 50.50885511, [[0, -1.08234375], [0, 1.08234375], [1.471467634, 0.31635609], [1.471467634, -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
|
||||||
["G2-ext", [2.309, 28.14222393, 56.37685511, [[0, -1.08234375], [0, 1.08234375], [1.471467634, 0.31635609], [1.471467634, -0.31635609]]]],
|
]]]],
|
||||||
["G2 1/4-ext", [2.309, 31.19947393, 62.49135511, [[0, -1.08234375], [0, 1.08234375], [1.471467634, 0.31635609], [1.471467634, -0.31635609]]]],
|
["G4-int", [2.309, 56.80002607, 113.51, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609
|
||||||
["G2 1/2-ext", [2.309, 35.93647393, 71.96535511, [[0, -1.08234375], [0, 1.08234375], [1.471467634, 0.31635609], [1.471467634, -0.31635609]]]],
|
]]]],
|
||||||
["G2 3/4-ext", [2.309, 39.11147393, 78.31535511, [[0, -1.08234375], [0, 1.08234375], [1.471467634, 0.31635609], [1.471467634, -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
|
||||||
["G3-ext", [2.309, 42.28647393, 84.66535511, [[0, -1.08234375], [0, 1.08234375], [1.471467634, 0.31635609], [1.471467634, -0.31635609]]]],
|
]]]],
|
||||||
["G3 1/2-ext", [2.309, 48.50947393, 97.11135511, [[0, -1.08234375], [0, 1.08234375], [1.471467634, 0.31635609], [1.471467634, -0.31635609]]]],
|
["G5-int", [2.309, 69.50002607, 138.91, [[0, 1.08234375], [0, -1.08234375], [-1.427764947, -0.31635609], [-1.427764947, 0.31635609
|
||||||
["G4-ext", [2.309, 54.85947393, 109.8113551, [[0, -1.08234375], [0, 1.08234375], [1.471467634, 0.31635609], [1.471467634, -0.31635609]]]],
|
]]]],
|
||||||
["G4 1/2-ext", [2.309, 61.20947393, 122.5113551, [[0, -1.08234375], [0, 1.08234375], [1.471467634, 0.31635609], [1.471467634, -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
|
||||||
["G5-ext", [2.309, 67.55947393, 135.2113551, [[0, -1.08234375], [0, 1.08234375], [1.471467634, 0.31635609], [1.471467634, -0.31635609]]]],
|
]]]],
|
||||||
["G5 1/2-ext", [2.309, 73.90947393, 147.9113551, [[0, -1.08234375], [0, 1.08234375], [1.471467634, 0.31635609], [1.471467634, -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
|
["G1/16-ext", [0.907, 3.21661514, 6.47, [[0, -0.42515625], [0, 0.42515625], [0.578008291, 0.12426807], [0.578008291, -0.12426807
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
BEGIN { print "/* This script is auto-generated - do not edit */"
|
BEGIN { print "/* This script is auto-generated - do not edit"
|
||||||
|
print " :License: 3-clause BSD. See LICENSE. */"
|
||||||
printf "\nTHREAD_TABLE = [" }
|
printf "\nTHREAD_TABLE = [" }
|
||||||
/^G/ { print "[\"" $1 "\", [" $2 ", " $3 ", " $4 ", [[" $5 ", " $6 "], [" $7 ", " $8 "], [" $9 ", " $10 "], [" $11 ", " $12 "]]]],"}
|
/^G/ { print "[\"" $1 "\", [" $2 ", " $3 ", " $4 ", [[" $5 ", " $6 "], [" $7 ", " $8 "], [" $9 ", " $10 "], [" $11 ", " $12 "]]]],"}
|
||||||
END { print "];" }
|
END { print "];" }
|
||||||
|
@@ -1,38 +1,16 @@
|
|||||||
/* Test and demonstrate thread library */
|
/*
|
||||||
|
Test and demonstrate thread library
|
||||||
|
|
||||||
|
:Author: Adrian Schlatter
|
||||||
|
:Date: 2019-04-07
|
||||||
|
:License: 3-Clause BSD. See LICENSE.
|
||||||
|
*/
|
||||||
|
|
||||||
use <threadlib.scad>
|
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";
|
type = "G1";
|
||||||
turns = 5;
|
turns = 5;
|
||||||
|
Douter = thread_specs(str(type, "-int"))[2] * 1.2;
|
||||||
|
|
||||||
intersection() {
|
intersection() {
|
||||||
color("Green")
|
color("Green")
|
||||||
@@ -40,6 +18,6 @@ intersection() {
|
|||||||
cube(200, 200, 200);
|
cube(200, 200, 200);
|
||||||
union() {
|
union() {
|
||||||
bolt(type, turns);
|
bolt(type, turns);
|
||||||
nut(type, turns);
|
nut(type, turns, Douter);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@@ -1,45 +1,27 @@
|
|||||||
/*
|
/*
|
||||||
Britisch Standard Pipe Thread
|
threadlib
|
||||||
++++++++++++++++++++++++++++++
|
+++++++++
|
||||||
|
|
||||||
British Standard Pipe Thread is based on a triangular profile. The angle between flanks
|
Create threads easily.
|
||||||
is 55 deg (symmetrical). We use the following nomenclature:
|
|
||||||
|
|
||||||
- crest: The "summit" of a thread
|
:Author: Adrian Schlatter
|
||||||
- valley: The lowest point in the valley of a thread
|
:Date: 2019-04-07
|
||||||
- rcrest, rvalley: Radii of crest and groove, respectively
|
:License: 3-Clause BSD. See LICENSE.
|
||||||
- rpitch = the mean radius of the original triangular profile
|
|
||||||
|
|
||||||
The crest and groove are both truncated by t/6. The radii at these flats are called
|
|
||||||
rmajor and rminor.
|
|
||||||
|
|
||||||
Note 1:
|
|
||||||
|
|
||||||
The specification requires that the flats are smoothed by circles that tangentially
|
|
||||||
match the flanks. We use a simpler version here: We create a triangular profile
|
|
||||||
and truncate the crests but not the grooves.
|
|
||||||
|
|
||||||
Note 2:
|
|
||||||
|
|
||||||
The specification requires allowances. This module creates threads with the ideal
|
|
||||||
rpitch for both external and internal threads (i.e., they just touch each other).
|
|
||||||
This is exactly at the edges of the given allowances and will not reliably work
|
|
||||||
in practice!
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use <thread_profile.scad>
|
use <thread_profile.scad>
|
||||||
include <THREAD_TABLE.scad>
|
include <THREAD_TABLE.scad>
|
||||||
|
|
||||||
function thread_specs(designator) =
|
function thread_specs(designator, table=THREAD_TABLE) =
|
||||||
/* Returns thread specs of thread-type 'designator' as a vector of
|
/* Returns thread specs of thread-type 'designator' as a vector of
|
||||||
[pitch, Rrotation, Dsupport, section_profile] */
|
[pitch, Rrotation, Dsupport, section_profile] */
|
||||||
|
|
||||||
THREAD_TABLE[search([designator], THREAD_TABLE, num_returns_per_match=1,
|
table[search([designator], table, num_returns_per_match=1,
|
||||||
index_col_num=0)[0]][1];
|
index_col_num=0)[0]][1];
|
||||||
|
|
||||||
module thread(designator, turns, higbee_arc=45, fn=120)
|
module thread(designator, turns, higbee_arc=20, fn=120, table=THREAD_TABLE)
|
||||||
{
|
{
|
||||||
specs = thread_specs(designator);
|
specs = thread_specs(designator, table=table);
|
||||||
P = specs[0]; Rrotation = specs[1]; section_profile = specs[3];
|
P = specs[0]; Rrotation = specs[1]; section_profile = specs[3];
|
||||||
straight_thread(
|
straight_thread(
|
||||||
section_profile=section_profile,
|
section_profile=section_profile,
|
||||||
@@ -48,3 +30,31 @@ module thread(designator, turns, higbee_arc=45, fn=120)
|
|||||||
turns=turns,
|
turns=turns,
|
||||||
pitch=P);
|
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);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
Reference in New Issue
Block a user