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..ccbf6c6 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.532647, 11.065294, [[-0.0001, -0.6377], [-0.0001, 0.6377], [0.6811, 0.0580], [0.6811, -0.0580]]]], +["PG7-int", [1.27, -6.355058, 12.710115, [[0, 0.6377], [0, -0.6377], [0.6811, -0.0757], [0.6811, 0.0757]]]], +["PG9-ext", [1.411, 6.806830, 13.613660, [[-0.0001, -0.7085], [-0.0001, 0.7085], [0.7568, 0.0644], [0.7568, -0.0644]]]], +["PG9-int", [1.411, -7.724508, 15.449017, [[0, 0.7085], [0, -0.7085], [0.7568, -0.0841], [0.7568, 0.0841]]]], +["PG11-ext", [1.411, 8.506830, 17.013660, [[-0.0001, -0.7085], [-0.0001, 0.7085], [0.7568, 0.0644], [0.7568, -0.0644]]]], +["PG11-int", [1.411, -9.424508, 18.849017, [[0, 0.7085], [0, -0.7085], [0.7568, -0.0841], [0.7568, 0.0841]]]], +["PG13.5-ext", [1.411, 9.406830, 18.813660, [[-0.0001, -0.7085], [-0.0001, 0.7085], [0.7568, 0.0644], [0.7568, -0.0644]]]], +["PG13.5-int", [1.411, -10.324508, 20.649017, [[0, 0.7085], [0, -0.7085], [0.7568, -0.0841], [0.7568, 0.0841]]]], +["PG16-ext", [1.411, 10.456830, 20.913660, [[-0.0001, -0.7085], [-0.0001, 0.7085], [0.7568, 0.0644], [0.7568, -0.0644]]]], +["PG16-int", [1.411, -11.374508, 22.749017, [[0, 0.7085], [0, -0.7085], [0.7568, -0.0841], [0.7568, 0.0841]]]], +["PG21-ext", [1.588, 13.254559, 26.509117, [[-0.0001, -0.7971], [-0.0001, 0.7971], [0.8514, 0.0725], [0.8514, -0.0725]]]], +["PG21-int", [1.588, -14.283822, 28.567644, [[0, 0.7971], [0, -0.7971], [0.8514, -0.0946], [0.8514, 0.0946]]]], +["PG29-ext", [1.588, 17.604559, 35.209117, [[-0.0001, -0.7971], [-0.0001, 0.7971], [0.8514, 0.0725], [0.8514, -0.0725]]]], +["PG29-int", [1.588, -18.633822, 37.267644, [[0, 0.7971], [0, -0.7971], [0.8514, -0.0946], [0.8514, 0.0946]]]], +["PG36-ext", [1.588, 22.604559, 45.209117, [[-0.0001, -0.7971], [-0.0001, 0.7971], [0.8514, 0.0725], [0.8514, -0.0725]]]], +["PG36-int", [1.588, -23.633822, 47.267644, [[0, 0.7971], [0, -0.7971], [0.8514, -0.0946], [0.8514, 0.0946]]]], +["PG42-ext", [1.588, 26.104559, 52.209117, [[-0.0001, -0.7971], [-0.0001, 0.7971], [0.8514, 0.0725], [0.8514, -0.0725]]]], +["PG42-int", [1.588, -27.133822, 54.267644, [[0, 0.7971], [0, -0.7971], [0.8514, -0.0946], [0.8514, 0.0946]]]], +["PG48-ext", [1.588, 28.754559, 57.509117, [[-0.0001, -0.7971], [-0.0001, 0.7971], [0.8514, 0.0725], [0.8514, -0.0725]]]], +["PG48-int", [1.588, -29.783822, 59.567644, [[0, 0.7971], [0, -0.7971], [0.8514, -0.0946], [0.8514, 0.0946]]]], ]; diff --git a/design/PG_electrical_thread.awk b/design/PG_electrical_thread.awk new file mode 100644 index 0000000..4eb672e --- /dev/null +++ b/design/PG_electrical_thread.awk @@ -0,0 +1,66 @@ +function calculateThreadlibSpecs() { + # Calculates threadlib specs for PG electrical threads. + + Designator = $1; + TPI = $2; + Pitch = $3; + MinorDiam = $4; + MajorDiam = $5; + PitchDiam = $6; + + Pi = 3.141592; + + P = 25.4 / TPI; + H = 0.595875 * P; + R = 0.107 * P; + + DSupportExt = PitchDiam - H - R/2; + RrotExt = DSupportExt / 2; + drRootExt = -0.0001; + dzRootExt = cos(40*Pi/180) * H*1.1; + drCrestExt = H*.9; + dzCrestExt = cos(40*Pi/180) * H*.1; + + DSupportInt = MinorDiam + H*.9*2 + R/2; + RrotInt = -DSupportInt / 2; + drRootInt = 0; + dzRootInt = cos(40*Pi/180)*H*1.1; + drCrestInt = H*.9; + 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..6b08bac --- /dev/null +++ b/design/PG_electrical_thread.csv @@ -0,0 +1,11 @@ +# designator tpi pitch minor_diam major_diam pitch_diam +PG7 20 1.27 11.28 12.5 11.89 +PG9 18 1.411 13.86 15.2 14.53 +PG11 18 1.411 17.26 18.6 17.93 +PG13.5 18 1.411 19.06 20.4 19.73 +PG16 18 1.411 21.16 22.5 21.83 +PG21 16 1.588 26.78 28.3 27.54 +PG29 16 1.588 35.48 37.0 36.24 +PG36 16 1.588 45.48 47.0 46.24 +PG42 16 1.588 52.48 54.0 53.24 +PG48 16 1.588 57.78 59.3 58.54 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" } // {