This website requires JavaScript.

Manually Adding Tool List for a Drill File

Manually Adding Tool List for a Drill File

PCB NC drill file



Figure 1. A sample NC drill file with some explanations


Drill files do not contain the tool list


Not every PCB design software generates drill file in a proper format. Some older software separates the drill information into two files. One contains holes' XY coordinates, and the other (Generally it’s a free format human-readable file) contains the tool size and other information. At JLCPCB, we expect the NC drill file to be completely self-contained, so the CAM operators don’t need to re-enter these information manually (This process may introduce errors).


Common drill file issues:


  • The header is incomplete (Sometimes there is no header at all)


  • The tool list is missing


  • The unit is unspecified


  • Zero suppression information (LZ/TZ) is unspecified


Let’s see some examples.


Below is a drill file generated by PCB Wizard, tool list is missing in the header:


M48
%
T01
X04450Y03150
X04450Y03050
X00350Y01950
...
M30
				
				


Below is a drill file generated by Wintek’s HiWire, it has the wrong header format:


/*****************************************/
/* NC Drill Data from Wintek's DT.D      */
/* Format: Inches; 2 integer, 3 fraction */
/*   digits (leading zeros included)     */
/* HiWIRE reference datum:  2784, 1700   */
/*   (derived from board extents)        */
/* Date: Sun Sep 05 14:21:52 2021        */
/*                                       */
/* Tool Usage Summary:                   */
/*   Tool No.    Diameter   Count        */
/*   --------    --------   -----        */
/*       1        0.020"      686        */
/*       2        0.030"        4        */
/*       3        0.032"       33        */
/*****************************************/
%
G90
T1
X05230Y03557
X05179Y03422
...
M30
				
				


A drill file by some version of Protel, no tool size:


M48
T01F00S00
T02F00S00
T03F00S00
T04F00S00
T05F00S00
%
T01
X01474Y02177
X01483Y02398
...
M30
				
				

Add the tool list


To correct the drill file, first we need to find the Drill Tool file which contains the tool size information, such as this one:


DRILLING PROTOCOL OF 'XXX.CNC'  10.09.2021  17:18:50

THIS IS FREE TEXT

    TOOL   COUNT DRILL TYPE     DIAMETER PATH LENGTH

       1      87          1      0.45MM         58.31 cm\n
       2     111          3      0.79MM         66.37 cm\n
       3      64          4      0.90MM         50.44 cm\n
       4       4         14      4.00MM         25.40 cm\n
...
				
				


Suppose the following is the corresponding Drill Location file:


T01
X04450Y03150
X04450Y03050
X00350Y01950
...
M30
				
				


Now, open both of them in a text editor.


To create a tool definition entry, just simply add letter T before the Tool Number and letter C before the diameter. Other text can be deleted directly.


For example, TOOL 1 to 4 will be converted to this form:


T1C0.45
T2C0.79
T3C0.90
T4C4.00
				
				


Copy and paste this list into the header of the Drill Location file. If M48 and the % sign do not exist, just add them. Ta-da, a decent drill file is born!


M48
T1C0.45
T2C0.79
T3C0.90
T4C4.00
%
T01
X04450Y03150
X04450Y03050
X00350Y01950
...
M30
				
				

Additional notes


Unit and zero suppression


Some softwares will provide the drill sizes in different units, if the Drill Location file is in metric (mm), the drill sizes should also be in mm. If the drill Location file is in Inch, the drill sizes should also be in Inch. Just do the conversion accordingly.


In the following Drill Tool file, the unit of drill diameters are in th (i.e. mil):


NC Drill Setup

Format: ASCII, 2.4, imperial, absolute, eob=<CR><LF>, no zero suppression.
Notes:  Tool sizes are diameters. Layer sets are in brackets - 0=TOP, 15=BOTTOM, 1-14=INNER.

T01     157.4th (0-15)
T02     60th (0-15)
T03     30th (0-15)
T04     45th (0-15)
T05     40th (0-15)
T06     50th (0-15)
					
					


When we do the conversion, we need to convert mil to inches, (simply divide by 1000), so the above list will be converted to the following list:


T01C0.1574
T02C0.060
T03C0.030
T04C0.045
T05C0.040
T06C0.050
					
					


If the unit and zero suppression information is provided in the free text Drill Tool file, just add them after M48, for example:


M48
INCH
T01C0.1574
...
					
					



     Note      If you don't know these info,  just don't add them. Our CAM operators will try to figure them out.


Excellon 1 VS Excellon 2


There are actually two Excellon formats, the older Excellon 1 and Excellon 2. By default, we assume the file is in Excellon 2 format. If you know your file is in Excellon 1, you need to tell us this explicitly (Write a special instruction when you place the order).


If an Excellon 1 file is recognized as an Excellon 2 file, errors will occur, for example, extra holes may occur on the PCB, etc.


References


1. "PCB NC formats". Wikipedia.


2. "XNC format specification". Ucamco.


3. "EXCELLON FORMAT SPECIFICATION". GithubGist.


Last updated on July 24, 2023