Full and short designators

List metric threads not only with their short
designator but also with full designator as
proposed by @uDude.
This commit is contained in:
Adrian Schlatter
2021-10-08 22:51:52 +02:00
parent dfe2266f44
commit 91eb1b0121
3 changed files with 1035 additions and 25 deletions

View File

@@ -9,6 +9,7 @@ function min(x, y) {
function calculateThreadlibSpecs() {
Designator = $3;
DesignatorLong = $2;
P = $4;
H = P / 2 / tan(phi / 2);
DPitchExt = ($8 + $9) / 2;
@@ -30,6 +31,34 @@ function calculateThreadlibSpecs() {
ZCrestInt = (DCrestInt - DPitchInt + H) / 2 * tan(phi / 2);
}
function printExternalThreadSpecs() {
printf P "," # pitch
printf "%.4f,", DValleyExt / 2 # Rrot
printf "%.4f,", DSupportExt # Dsupport
printf 0 "," # r0
printf "%.4f,", -ZValleyExt # z0
printf 0 "," # r1
printf "%.4f,", +ZValleyExt # z1
printf "%.4f,", (DCrestExt - DValleyExt) / 2 # r2
printf "%.4f,", +ZCrestExt # z2
printf "%.4f,", (DCrestExt - DValleyExt) / 2 # r3
printf "%.4f\n", -ZCrestExt; # z3
}
function printInternalThreadSpecs() {
printf P "," # pitch
printf "%.4f,", -DValleyInt / 2 # Rrot
printf "%.4f,", DSupportInt # Dsupport
printf 0 "," # r0
printf "%.4f,", +ZValleyInt # z0
printf 0 "," # r1
printf "%.4f,", -ZValleyInt # z1
printf "%.4f,", -(DCrestInt - DValleyInt) / 2 # r2
printf "%.4f,", -ZCrestInt # z2
printf "%.4f,", -(DCrestInt - DValleyInt) / 2 # r3
printf "%.4f\n", +ZCrestInt; # z3
}
BEGIN {
FS = "\t";
pi = atan2(0, -1);
@@ -41,31 +70,17 @@ BEGIN {
calculateThreadlibSpecs();
# External thread:
printf Designator "-ext," # designator
printf P "," # pitch
printf "%.4f,", DValleyExt / 2 # Rrot
printf "%.4f,", DSupportExt # Dsupport
printf 0 "," # r0
printf "%.4f,", -ZValleyExt # z0
printf 0 "," # r1
printf "%.4f,", +ZValleyExt # z1
printf "%.4f,", (DCrestExt - DValleyExt) / 2 # r2
printf "%.4f,", +ZCrestExt # z2
printf "%.4f,", (DCrestExt - DValleyExt) / 2 # r3
printf "%.4f\n", -ZCrestExt; # z3
printf Designator "-ext," # designator such as "M4-ext"
printExternalThreadSpecs();
printf DesignatorLong "-ext," # designator such as "M4x0.7-ext"
printExternalThreadSpecs();
# Internal thread:
printf Designator "-int," # designator
printf P "," # pitch
printf "%.4f,", -DValleyInt / 2 # Rrot
printf "%.4f,", DSupportInt # Dsupport
printf 0 "," # r0
printf "%.4f,", +ZValleyInt # z0
printf 0 "," # r1
printf "%.4f,", -ZValleyInt # z1
printf "%.4f,", -(DCrestInt - DValleyInt) / 2 # r2
printf "%.4f,", -ZCrestInt # z2
printf "%.4f,", -(DCrestInt - DValleyInt) / 2 # r3
printf "%.4f\n", +ZCrestInt; # z3
}
printf Designator "-int," # designator such as "M4-int"
printInternalThreadSpecs();
printf DesignatorLong "-int," # designator such as "M4x0.7-int"
printInternalThreadSpecs();
}