diff --git a/Makefile b/Makefile index 8c389d1..240c039 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ design: clean 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/microscope_thread.csv | awk -f design/microscope_thread.awk >> design/THREAD_TABLE.csv + cat design/PG_electrical_thread.csv | awk -f design/PG_electrical_thread.awk >> design/THREAD_TABLE.csv cat design/THREAD_TABLE.csv | awk -f design/autogenerate.awk > THREAD_TABLE.scad .PHONY: test diff --git a/THREAD_TABLE.scad b/THREAD_TABLE.scad index 7629b9f..49c8651 100644 --- a/THREAD_TABLE.scad +++ b/THREAD_TABLE.scad @@ -1,7 +1,8 @@ /* This script is auto-generated - do not edit :License: 3-clause BSD. See LICENSE. */ -THREAD_TABLE = [["G1/16-ext", [0.907, 3.1631, 6.3625, [[0, -0.4252], [0, 0.4252], [0.5710, 0.1279], [0.5710, -0.1279]]]], +THREAD_TABLE = [ +["G1/16-ext", [0.907, 3.1631, 6.3625, [[0, -0.4252], [0, 0.4252], [0.5710, 0.1279], [0.5710, -0.1279]]]], ["G1/16-int", [0.907, -3.9789, 7.9215, [[0, 0.4252], [0, -0.4252], [0.5540, -0.1368], [0.5540, 0.1368]]]], ["G1/8-ext", [0.907, 4.1656, 8.3675, [[0, -0.4252], [0, 0.4252], [0.5710, 0.1279], [0.5710, -0.1279]]]], ["G1/8-int", [0.907, -4.9814, 9.9265, [[0, 0.4252], [0, -0.4252], [0.5540, -0.1368], [0.5540, 0.1368]]]], @@ -1901,4 +1902,24 @@ THREAD_TABLE = [["G1/16-ext", [0.907, 3.1631, 6.3625, [[0, -0.4252], [0, 0.4252] ["32-UN-13/16-int", [0.79375, -10.3492, 20.6914, [[0, 0.3473], [0, -0.3473], [0.4296, -0.0992], [0.4296, 0.0992]]]], ["RMS-ext", [0.7056, 9.5829, 19.1859, [[0.0, -0.3274], [0.0, 0.3273], [0.4932, 0.0706], [0.4932, -0.0706]]]], ["RMS-int", [0.7055, -10.3042, 20.5085, [[0.0, 0.2630], [0.0, -0.2630], [0.4808, -0.0127], [0.4808, 0.0127]]]], +["PG7-ext", [1.27, 5.640000, 11.280000, [[0, -0.5797], [0, 0.5797], [0.7568, 0.0757], [0.7568, -0.0757]]]], +["PG7-int", [1.27, -6.250000, 12.500000, [[0, 0.5797], [0, -0.5797], [0.7568, -0.0757], [0.7568, 0.0757]]]], +["PG9-ext", [1.4112, 6.930000, 13.860000, [[0, -0.6441], [0, 0.6441], [0.8408, 0.0841], [0.8408, -0.0841]]]], +["PG9-int", [1.4112, -7.600000, 15.200000, [[0, 0.6441], [0, -0.6441], [0.8408, -0.0841], [0.8408, 0.0841]]]], +["PG11-ext", [1.4112, 8.630000, 17.260000, [[0, -0.6441], [0, 0.6441], [0.8408, 0.0841], [0.8408, -0.0841]]]], +["PG11-int", [1.4112, -9.300000, 18.600000, [[0, 0.6441], [0, -0.6441], [0.8408, -0.0841], [0.8408, 0.0841]]]], +["PG13.5-ext", [1.4112, 9.530000, 19.060000, [[0, -0.6441], [0, 0.6441], [0.8408, 0.0841], [0.8408, -0.0841]]]], +["PG13.5-int", [1.4112, -10.200000, 20.400000, [[0, 0.6441], [0, -0.6441], [0.8408, -0.0841], [0.8408, 0.0841]]]], +["PG16-ext", [1.4112, 10.580000, 21.160000, [[0, -0.6441], [0, 0.6441], [0.8408, 0.0841], [0.8408, -0.0841]]]], +["PG16-int", [1.4112, -11.250000, 22.500000, [[0, 0.6441], [0, -0.6441], [0.8408, -0.0841], [0.8408, 0.0841]]]], +["PG21-ext", [1.5875, 13.390000, 26.780000, [[0, -0.7246], [0, 0.7246], [0.9460, 0.0946], [0.9460, -0.0946]]]], +["PG21-int", [1.5875, -14.150000, 28.300000, [[0, 0.7246], [0, -0.7246], [0.9460, -0.0946], [0.9460, 0.0946]]]], +["PG29-ext", [1.5875, 17.740000, 35.480000, [[0, -0.7246], [0, 0.7246], [0.9460, 0.0946], [0.9460, -0.0946]]]], +["PG29-int", [1.5875, -18.500000, 37.000000, [[0, 0.7246], [0, -0.7246], [0.9460, -0.0946], [0.9460, 0.0946]]]], +["PG36-ext", [1.5875, 22.740000, 45.480000, [[0, -0.7246], [0, 0.7246], [0.9460, 0.0946], [0.9460, -0.0946]]]], +["PG36-int", [1.5875, -23.500000, 47.000000, [[0, 0.7246], [0, -0.7246], [0.9460, -0.0946], [0.9460, 0.0946]]]], +["PG42-ext", [1.5875, 26.240000, 52.480000, [[0, -0.7246], [0, 0.7246], [0.9460, 0.0946], [0.9460, -0.0946]]]], +["PG42-int", [1.5875, -27.000000, 54.000000, [[0, 0.7246], [0, -0.7246], [0.9460, -0.0946], [0.9460, 0.0946]]]], +["PG48-ext", [1.5875, 28.890000, 57.780000, [[0, -0.7246], [0, 0.7246], [0.9460, 0.0946], [0.9460, -0.0946]]]], +["PG48-int", [1.5875, -29.650000, 59.300000, [[0, 0.7246], [0, -0.7246], [0.9460, -0.0946], [0.9460, 0.0946]]]], ]; diff --git a/design/PG_electrical_thread.awk b/design/PG_electrical_thread.awk new file mode 100644 index 0000000..01773be --- /dev/null +++ b/design/PG_electrical_thread.awk @@ -0,0 +1,64 @@ +function calculateThreadlibSpecs() { + # Calculates threadlib specs for PG electrical threads. + + Designator = $1; + TPI = $2; + Pitch = $3; + InnerDiam = $4; + OuterDiam = $5; + + Pi = 3.141592; + + P = 25.4 / TPI; + H = 0.595875 * P; + + RrotExt = InnerDiam / 2; + DSupportExt = InnerDiam; + drRootExt = 0; + dzRootExt = cos(40*Pi/180)*H; + drCrestExt = H; + dzCrestExt = H*.1; + + RrotInt = -OuterDiam / 2; + DSupportInt = OuterDiam; + drRootInt = 0; + dzRootInt = cos(40*Pi/180)*H; + drCrestInt = H; + dzCrestInt = H*.1; +} + +BEGIN { + FS = "\t"; +} + +/^[^#]/ { + calculateThreadlibSpecs(); + + # External thread: + printf Designator "-ext," # designator + printf Pitch "," # pitch + printf "%f,", RrotExt # Rrot + printf "%f,", 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 Pitch "," # pitch + printf "%f,", RrotInt # Rrot + printf "%f,", 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 +} diff --git a/design/PG_electrical_thread.csv b/design/PG_electrical_thread.csv new file mode 100644 index 0000000..dc184b0 --- /dev/null +++ b/design/PG_electrical_thread.csv @@ -0,0 +1,11 @@ +# designator tpi pitch inner_diam major_diam +PG7 20 1.27 11.28 12.5 +PG9 18 1.4112 13.86 15.2 +PG11 18 1.4112 17.26 18.6 +PG13.5 18 1.4112 19.06 20.4 +PG16 18 1.4112 21.16 22.5 +PG21 16 1.5875 26.78 28.3 +PG29 16 1.5875 35.48 37.0 +PG36 16 1.5875 45.48 47.0 +PG42 16 1.5875 52.48 54.0 +PG48 16 1.5875 57.78 59.3 diff --git a/design/autogenerate.awk b/design/autogenerate.awk index 7388d5a..b8d9c8d 100644 --- a/design/autogenerate.awk +++ b/design/autogenerate.awk @@ -2,7 +2,7 @@ BEGIN { FS = ","; print "/* This script is auto-generated - do not edit" print " :License: 3-clause BSD. See LICENSE. */" - printf "\nTHREAD_TABLE = [" + printf "\nTHREAD_TABLE = [\n" } // {