Create pipe tables from PCB's drill files
John PeckPublished , updated
I use PCB to design PCBs, and I recently needed to embed a list of drills and their uses in a plain text file. PCB's drill file looks like this:
M48
INCH
T72C0.010
T71C0.015
T70C0.067
T69C0.039
T68C0.030
T67C0.046
T66C0.138
%
T72
X010249Y009035
X010249Y005886
X010268Y008256
X010268Y007075
X010268Y005107
...and I wrote drilltable.tcl to generate tables like this:
|------------+----------------------+------------|
| Tool | Hole size (inch) | Count |
|------------+----------------------+------------|
| T72 | 0.010 | 218 |
| T71 | 0.015 | 95 |
| T68 | 0.030 | 3 |
| T69 | 0.039 | 10 |
| T67 | 0.046 | 15 |
| T70 | 0.067 | 1 |
| T66 | 0.138 | 4 |
|------------+----------------------+------------|
This borrows from an excellent usage example of Tcl's format command at the Tclers Wiki.