Eliminate threads.xlsx

Replaces threads.xlsx by one .csv file and one awk script per thread
type. The script calculates threadlib specs from the data in the .csv
file. Finally and as before, autogenerate.awk generates the OpenSCAD
code (i.e. THREAD_TABLE.scad).

A new Makefile automates this process: make does what is needed. It
also provides a target 'test' to run the (existing) tests.

To add a new thread type:

- provide newthread.csv
- provide newthread.awk
- modify Makefile to generate your new threads
- add appropriate tests

Additionally:

- fixed bug in Rrot when DRmax is too large.
- reduced number of significant figures to a resolution of 0.1 um
  (while not extremely generous for the very finest threads, it
  should be enough by far for any 3D-prints).
- increased test limit for thread angle deviations (necessary due to
  reduced number of significant figures)
- added test counter: 'make test' now prints number of tests run +
  number of threads tested.
- For unknown reasons (MacOS awk?) final match-all rule in
  test_table.awk does not match with double-quotes. Work-around: Match
  without double-quotes.
This commit is contained in:
Adrian Schlatter
2019-05-02 13:44:50 +02:00
parent 26b7e66184
commit 827723d1b1
11 changed files with 1749 additions and 1046 deletions

View File

@@ -1,4 +1,4 @@
.PHONY: test
test:
cat ../THREAD_TABLE.scad | awk -f test_table.awk
@cat ../THREAD_TABLE.scad | awk -f test_table.awk

View File

@@ -36,10 +36,12 @@ BEGIN {
FS = ",";
pi = atan2(0, -1);
deg = pi / 180;
dphi = 0.001;
dphi = 0.1;
PASS = 1;
}
NR_OF_TESTS = 0;
NR_OF_THREADS = 0;
}
{ # first match-all rule: set state to untested
tested = 0;
@@ -57,6 +59,7 @@ BEGIN {
print designator " FAIL: Rsupport < Rrot";
PASS = 0;
}
NR_OF_TESTS += 2;
}
/"[^,]+-int/ {
@@ -71,6 +74,7 @@ BEGIN {
print designator " FAIL: Rsupport > Rrot";
PASS = 0;
}
NR_OF_TESTS += 2;
}
/M[0-9.x-]+-ext/ {
@@ -85,6 +89,7 @@ BEGIN {
};
test_horizontal();
tested = 1;
NR_OF_TESTS += 2;
}
/M[0-9.x-]+-int/ {
@@ -99,6 +104,7 @@ BEGIN {
}
test_horizontal();
tested = 1;
NR_OF_TESTS += 2;
}
/G.+-ext/ {
@@ -113,6 +119,7 @@ BEGIN {
}
test_horizontal();
tested = 1;
NR_OF_TESTS += 2;
}
/G.+-int/ {
@@ -127,6 +134,7 @@ BEGIN {
}
test_horizontal();
tested = 1;
NR_OF_TESTS += 2;
}
/PCO.+-ext/ {
@@ -142,6 +150,7 @@ BEGIN {
}
test_horizontal();
tested = 1;
NR_OF_TESTS += 2;
}
/PCO.+-int/ {
@@ -157,9 +166,10 @@ BEGIN {
}
test_horizontal();
tested = 1;
NR_OF_TESTS += 2;
}
/"[^,]+-(int|ext)"/ {
/[^,]+-(int|ext)/ {
# final match-all (designators) rule: test wether all lines have been
# tested
if (tested == 0) {
@@ -167,9 +177,11 @@ BEGIN {
print designator " FAIL: not tested";
PASS = 0;
};
NR_OF_THREADS += 1;
}
END {
print "Ran " NR_OF_TESTS " tests on " NR_OF_THREADS " threads";
if (PASS == 1) print "TESTS SUCCESSFUL"
else print "TESTS FAIL";
}