Skip to content

Commit

Permalink
Release 0.3
Browse files Browse the repository at this point in the history
Enhancements
===========

- Unified Inch Screw Threads

Fixes
===========

- PCO-1881 internal (minor diameter was too small)
- Dpitch problem with G-ext threads

Improvements
===========

- developer docs
- build system
- unit tests
- user does not need to rotate internal threads by 180 deg anymore
to fit external thread

!! Incompatibel changes !!
====================

We take the liberty to do this while the major version is still 0:

- internal thread is rotated by 180 deg (see improvements). nut() and bolt() are not affected by this
  • Loading branch information
adrianschlatter authored Nov 13, 2019
1 parent 49b5786 commit 315d3b9
Show file tree
Hide file tree
Showing 22 changed files with 3,520 additions and 1,056 deletions.
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.PHONY: design
design: clean
touch design/THREAD_TABLE.csv
cat design/BSPP_thread.csv | awk -f design/BSPP_thread.awk >> design/THREAD_TABLE.csv
cat design/metric_thread.csv | awk -f design/metric_thread.awk >> design/THREAD_TABLE.csv
cat design/PCO_thread.csv | awk -f design/PCO_thread.awk >> design/THREAD_TABLE.csv
cat design/UIS_thread.csv | awk -f design/UIS_thread.awk >> design/THREAD_TABLE.csv
cat design/THREAD_TABLE.csv | awk -f design/autogenerate.awk > THREAD_TABLE.scad

.PHONY: test
test:
@$(MAKE) -C tests

.PHONY: clean
clean:
rm -f THREAD_TABLE.scad
rm -f design/THREAD_TABLE.csv

14 changes: 11 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ Creating a thread is as simple as
to create a British Standard Pipe parallel external thread.


==================================
Why you may want to use threadlib
==================================

Expand All @@ -36,11 +35,13 @@ Why you may want to use threadlib
- configurable higbee arc
- creates working threads (clearances are left for production tolerances)
- flexible:

- choose the $fn you need to fit the rest of your design
- let threadlib tell you the thread specs so you can do with them what *you* want
- extensible: Add your own threads
- tried and tested in the real world: Um no, not yet. But with your help, it
will soon be.
- tried and tested in the real world: Well, partly. Given the sheer number of
threads, this is only possible with *your* help! Any feedback regarding working
(or not working) threadlib-threads is appreciated.


Installation
Expand All @@ -62,6 +63,10 @@ Clone threadlib into the folder 'threadlib' inside your OpenSCAD library folder
Usage
===========================

Before you start: threadlib is designed in millimeters (not meters, not inches).
Make sure that your units are set accordingly or scale the output of threadlib
to match the units you use in your project!

To create a bolt (without head) with 5 turns of M4 thread:

.. code-block:: OpenSCAD
Expand Down Expand Up @@ -147,6 +152,9 @@ for addition to threadlib!
Change Log
===========================

- 0.3: Unified Inch Screw Threads (UNC, UNF, UNEF, 4-UN, 6-UN, 8-UN, 12-UN,
16-UN, 20-UN, 28-UN, and 32-UN. Fixed problem with PCO-1881-int. Fixed problem
with G-ext threads . New build system.
- 0.2: `Metric threads <http://mdmetric.com/tech/M-thead%20600.htm>`__, `PCO-1881 <https://www.bevtech.org/assets/Committees/Packaging-Technology/20/3784253-20.pdf>`__
- 0.1: Initial release supporting `BSP parallel thread <https://www.amesweb.info/Screws/British-Standard-Pipe-Parallel-Thread-BSPP.aspx>`__

2,870 changes: 1,826 additions & 1,044 deletions THREAD_TABLE.scad

Large diffs are not rendered by default.

66 changes: 66 additions & 0 deletions design/BSPP_thread.awk
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
function tan(x) {
return(sin(x) / cos(x))
}

function calculateThreadlibSpecs() {
Designator = $1;
P = $3;
H = P / 2 / tan(phi / 2);
DMax = $5;
DPitch = $6;
DMin = $7;
DPitchInt = DPitch + $9 / 2;
DPitchExt = DPitch + $10 / 2;
DMinInt = DMin + $14 / 2;
DMaxExt = DMax + $15 / 2;
DSupportExt = DPitchExt - 2 * 5 / 12 * H;
DSupportInt = DPitchInt + 2 * 5 / 12 * H;
DValleyExt = DPitchExt - 2 * 5 / 12 * H * qOverlap;
DValleyInt = DPitchInt + 2 * 5 / 12 * H * qOverlap;
DCrestExt = DMaxExt - tan((pi + phi) / 4) / 6 * (1 - sin(phi / 2));
DCrestInt = DMinInt + tan((pi + phi) / 4) / 6 * (1 - sin(phi / 2));
ZValley = 0.03125 * P;
ZCrestExt = (DPitchExt + H - DCrestExt) / 2 * tan(phi / 2);
ZCrestInt = (DCrestInt - DPitchInt + H) / 2 * tan(phi / 2);
}

BEGIN {
FS = "\t";
pi = atan2(0, -1);
deg = pi / 180;
phi = 55 * deg;
qOverlap = 1.05;
}

/^[^#]/ {
calculateThreadlibSpecs();

# External thread:
printf "G" Designator "-ext," # designator
printf P "," # pitch
printf "%.4f,", DValleyExt / 2 # Rrot
printf "%.4f,", DSupportExt # Dsupport
printf 0 "," # r0
printf "%.4f,", -P / 2 + ZValley # z0
printf 0 "," # r1
printf "%.4f,", +P / 2 - ZValley # z1
printf "%.4f,", (DCrestExt - DValleyExt) / 2 # r2
printf "%.4f,", +ZCrestExt # z2
printf "%.4f,", (DCrestExt - DValleyExt) / 2 # r3
printf "%.4f\n", -ZCrestExt; # z3

# Internal thread:
printf "G" Designator "-int," # designator
printf P "," # pitch
printf "%.4f,", -DValleyInt / 2 # Rrot
printf "%.4f,", DSupportInt # Dsupport
printf 0 "," # r0
printf "%.4f,", +P / 2 - ZValley # z0
printf 0 "," # r1
printf "%.4f,", -P / 2 + ZValley # z1
printf "%.4f,", -(DCrestInt - DValleyInt) / 2 # r2
printf "%.4f,", -ZCrestInt # z2
printf "%.4f,", -(DCrestInt - DValleyInt) / 2 # r3
printf "%.4f\n", +ZCrestInt; # z3
}

29 changes: 29 additions & 0 deletions design/BSPP_thread.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Tolerances on pitch diametera Tolerance on minor diameter Tolerance on major diameter
# Tolerances Pitch Diameters Tol. min. Dia. Tol. maj. Dia
# Diameters Int thread TD2 Ext thread Td2 Int thread TD1 Ext thread Td
#Desig TPI Pitch h d=D d2=D2 d1=D1 -Delta +Delta -Delta -Delta +Delta -Delta +Delta -Delta +Delta
#http://mdmetric.com/tech/thddat7.htm
1/16 28 0.907 0.581 7.723 7.142 6.561 0 0.107 -0.107 -0.214 0 0 0.282 -0.214 0
1/8 28 0.907 0.581 9.728 9.147 8.566 0 0.107 -0.107 -0.214 0 0 0.282 -0.214 0
1/4 19 1.337 0.856 13.157 12.301 11.445 0 0.125 -0.125 -0.25 0 0 0.445 -0.25 0
3/8 19 1.337 0.856 16.662 15.806 14.95 0 0.125 -0.125 -0.25 0 0 0.445 -0.25 0
1/2 14 1.814 1.162 20.955 19.793 18.631 0 0.142 -0.142 -0.284 0 0 0.541 -0.284 0
5/8 14 1.814 1.162 22.911 21.749 20.587 0 0.142 -0.142 -0.284 0 0 0.541 -0.284 0
3/4 14 1.814 1.162 26.441 25.279 24.117 0 0.142 -0.142 -0.284 0 0 0.541 -0.284 0
7/8 14 1.814 1.162 30.201 29.039 27.877 0 0.142 -0.142 -0.284 0 0 0.541 -0.284 0
1 11 2.309 1.479 33.249 31.77 30.291 0 0.18 -0.18 -0.36 0 0 0.64 -0.36 0
1 1/8 11 2.309 1.479 37.897 36.418 34.939 0 0.18 -0.18 -0.36 0 0 0.64 -0.36 0
1 1/4 11 2.309 1.479 41.91 40.431 38.952 0 0.18 -0.18 -0.36 0 0 0.64 -0.36 0
1 1/2 11 2.309 1.479 47.803 46.324 44.845 0 0.18 -0.18 -0.36 0 0 0.64 -0.36 0
1 3/4 11 2.309 1.479 53.746 52.267 50.788 0 0.18 -0.18 -0.36 0 0 0.64 -0.36 0
2 11 2.309 1.479 59.614 58.135 56.656 0 0.18 -0.18 -0.36 0 0 0.64 -0.36 0
2 1/4 11 2.309 1.479 65.71 64.231 62.752 0 0.217 -0.217 -0.434 0 0 0.64 -0.434 0
2 1/2 11 2.309 1.479 75.184 73.705 72.226 0 0.217 -0.217 -0.434 0 0 0.64 -0.434 0
2 3/4 11 2.309 1.479 81.534 80.055 78.576 0 0.217 -0.217 -0.434 0 0 0.64 -0.434 0
3 11 2.309 1.479 87.884 86.405 84.926 0 0.217 -0.217 -0.434 0 0 0.64 -0.434 0
3 1/2 11 2.309 1.479 100.33 98.851 97.372 0 0.217 -0.217 -0.434 0 0 0.64 -0.434 0
4 11 2.309 1.479 113.03 111.551 110.072 0 0.217 -0.217 -0.434 0 0 0.64 -0.434 0
4 1/2 11 2.309 1.479 125.73 124.251 122.772 0 0.217 -0.217 -0.434 0 0 0.64 -0.434 0
5 11 2.309 1.479 138.43 136.951 135.472 0 0.217 -0.217 -0.434 0 0 0.64 -0.434 0
5 1/2 11 2.309 1.479 151.13 149.651 148.172 0 0.217 -0.217 -0.434 0 0 0.64 -0.434 0
6 11 2.309 1.479 163.83 162.351 160.872 0 0.217 -0.217 -0.434 0 0 0.64 -0.434 0
4 changes: 4 additions & 0 deletions design/PCO_thread.awk
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/^[^#]/ {
print $0;
}

3 changes: 3 additions & 0 deletions design/PCO_thread.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Designator,Pitch,Rrot,Dsupport,r0,z0,r1,z1,r2,z2,r3,z3
PCO-1881-ext,2.7,11.52381,24.2,0,-0.987894698,0,0.987894698,2.17619,0.604173686,2.17619,-0.195826314
PCO-1881-int,2.7,-14.406,27.66,0,1.212894698,0,-0.762894698,1.656,-0.470897218,1.656,0.610159990
100 changes: 100 additions & 0 deletions design/UIS_thread.awk
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
function tan(x) {
return(sin(x) / cos(x))
}

function min(x, y) {
if (x < y) return(x)
else return(y)
}

function calculateThreadlibSpecs() {
Designator = $1;
TPI = $2;
D = $3;
P = 1 / TPI;
H = P / 2 / tan(phi / 2);
basicPitchD = D - 3 / 4 * H;

nfields = split(Designator, fields, "_");
tp = fields[1];
if (nfields > 2)
tp = tp "-" fields[2]

if (tp=="UNC" || tp=="UNF" || tp=="4-UN" || tp=="6-UN" || tp=="8-UN")
LE = D;
else
LE = 9 * P;

# external thread:
tolPitchD = 0.0015 * D**(1/3) + 0.0015 * sqrt(LE) + 0.015 * P**(2/3);
maxPitchD = basicPitchD - 0.300 * tolPitchD;
minPitchD = maxPitchD - tolPitchD;
centerPitchD = 0.5 * (minPitchD + maxPitchD);
RrotExt = centerPitchD / 2 - H / 4;
DSupportExt = 2 * RrotExt + 0.01 * H ;
RrotExt = RrotExt * inch;
DSupportExt = DSupportExt * inch;

dzCrestExt = P / 16 * inch;
dzRootExt = 3 / 8 * P * inch;
drRootExt = 0.;
drCrestExt = 5 / 8 * H * inch;

# internal thread:
tolPitchD = 1.300 * tolPitchD;
minPitchD = basicPitchD;
maxPitchD = minPitchD + tolPitchD;
centerPitchD = 0.5 * (minPitchD + maxPitchD);
RrotInt = -((centerPitchD + H) / 2 - H / 8);
DSupportInt = -2 * RrotInt - 0.01 * H;
RrotInt = RrotInt * inch;
DSupportInt = DSupportInt * inch;

dzCrestInt = P / 8 * inch;
dzRootInt = 7 / 16 * P * inch;
drRootInt = 0.;
drCrestInt = 5 / 8 * H * inch;

P = P * inch;
}

BEGIN {
FS = "\t";
pi = atan2(0, -1);
deg = pi / 180;
phi = 60 * deg;
inch = 25.4;
}

/^[^#]/ {
calculateThreadlibSpecs();

# External thread:
printf Designator "-ext," # designator
printf P "," # pitch
printf "%.4f,", RrotExt # Rrot
printf "%.4f,", DSupportExt # Dsupport
printf drRootExt "," # r0
printf "%.4f,", -dzRootExt # z0
printf drRootExt "," # r1
printf "%.4f,", +dzRootExt # z1
printf "%.4f,", drCrestExt # r2
printf "%.4f,", +dzCrestExt # z2
printf "%.4f,", drCrestExt # r3
printf "%.4f\n", -dzCrestExt; # z3

# Internal thread:
printf Designator "-int," # designator
printf P "," # pitch
printf "%.4f,", RrotInt # Rrot
printf "%.4f,", DSupportInt # Dsupport
printf drRootInt "," # r0
printf "%.4f,", +dzRootInt # z0
printf drRootInt "," # r1
printf "%.4f,", -dzRootInt # z1
printf "%.4f,", drCrestInt # r2
printf "%.4f,", -dzCrestInt # z2
printf "%.4f,", drCrestInt # r3
printf "%.4f\n", +dzCrestInt; # z3
}

Loading

0 comments on commit 315d3b9

Please sign in to comment.