Understanding Drill Data

Drill data comes in many forms. This document helps us understand what drill data is and how to properly import it into GC-Prevue

Reference Material

Excellon Manual (PDF Backup just in case the website ever goes down)

Header

The header begins with the code "M48". This basically just tells the gerber viewer that it's looking at an Excellon drill file. Excellon is the defacto industry standard for drill file formats.

There will be comment lines. These comment lines are not interpreted by the software. They begin with a semicolon ;

Whenever a semicolon is seen, the software ignores the information after that. It's only intended for humans to read so that they can understand the data. Sometimes information about colors, formats, units of measure, leading or trailing zeroes, and whether or not the data is for plated or non-plated thru-holes.

Format

Drill data comes in many different formats. Sometimes, especially with Altium data, the format will be mentioned at the top of the drill file. It will be something like ";FILE_FORMAT=4:4". The 4:4 represents the Whole Digits and Precision, respectively. You can adjust these when importing the drill data by double-clicking on the Format column for that specific file.

Units of Measure

Sometimes (not always) the units of measure will be defined in the Header. It will say "METRIC" or "IMPERIAL" or "INCHES". Something along those lines.

T-Code

This is what tells the gerber viewer what size each drill is. There will be a list of T-Codes at the beginning of each file.

They begin with a capital "T" and are followed by an integer, starting from 01 up to however many different drill sizes are required. 

T01C0.0200
T02C0.0236
T03C0.0295
T04C0.0320
T05C0.0354
T06C0.0394
T07C0.0400
T08C0.0413
T09C0.0787
T10C0.1250

The "C" is followed by the tool diameter. The units of measure can vary. In the above example the UOM is Inches.

T1F00S00C0.2540
T2F00S00C0.3000
T3F00S00C0.3048
T4F00S00C0.3300
T5F00S00C0.4064
T6F00S00C1.8000

In the above example, the units of measure are mm. Most of the time GC-Prevue does a pretty good job of identifying the units of measure. But not always.

F-Code

These are for feed rates. This is only really important for the PCB fabricators so that they can tell their machines how fast to run. We mostly don't care about this. But you'll see these sometimes in the T-Code lines.

T1F00S00C0.2540
T2F00S00C0.3000
T3F00S00C0.3048
T4F00S00C0.3300
T5F00S00C0.4064
T6F00S00C1.8000

End of Header

The end of the header will be identified by either a % sign or M95.

X and Y Coordinates

After the Header, the X and Y Coordinates will follow. These will likely make up the bulk of the file. These tell the gerber viewer where the holes are positioned. You will see a T-Code referenced, followed by all of the locations where that specific drill size (or T-Code) is used.

T01
X6500Y4500
X11350Y3900
X12750Y2500
X15000Y2500
X16500Y2500
X17250Y4500
X19500Y4000
X21550Y3450
X23500Y3000
X23500Y4500

The X tells the software that the data to follow is the X-Dimension of the center of the hole. The Y tells the software that the data to follow is the Y-Dimension of the center of the hole.  Once all of the holes for that specific drill size or done, you'll see the next T-Code reference and a new set of X and Y Coordinates listed.

T02
X10000Y10000
T03
X13529Y7529
T04
X18000Y13000
X17000Y15000
X19000Y15000
T05
X25000Y9881
X25000Y8503
X25000Y7125

There are two ways that drill files can define their X and Y Coordinates. Either Absolute or Incremental. Absolute means that every coordinate is measured to the same location on the board. This location is called Work Zero. Incremental means that every coordinate is measured to the previous coordinate. Unless otherwise specified absolute mode will be used. It is the most common.

Whole Digits and Precision

The X and Y Coordinate data will not have any decimal places. So it's necessary for the software to understand what digits represent whole numbers, and what digits represent decimals. In a 4:4 method (4 Whole Digits and 4 Precision digits) your number will look like this

X00152654Y00031242

In the X Coordinate (00152654) the first four digits are whole numbers and the last four digits are the decimal places, so the coordinate is 15.2654mm. The Y Coordinate would be 3.1242mm.

You will notice that there are zeros that get ignored in this case. That is where Leading and Trailing Zeros come into the picture.

Leading and Trailing Zeros

Since decimals are not used in the X and Y Coordinates, it's necessary for the software to interpret where those decimals should be. This is where the need for defining Leading and Trailing Zeros becomes important. There will be zeros in the X and Y Coordinates. These zeros can either be leading the data or trailing the data. Leading Zeros is the most common. Sometimes the Header will have a Comment that defines whether or not Leading Zeros or Trailing Zeros are used. Look for "LZ" or "TZ" in a Comment line in the header. It's fairly common for "LZ" or "TZ" to follow a Comment about the Units of Measure. 

But if it's not defined in the header, you will need to figure out what is being used. In order to understand Leading and Trailing Zeros you must understand how many digits are used to specify the units of measure. So if you're using the 4:4 method and your coordinates look like this 

X00152654Y00031242

then you will need to tell the software that the Zeros are Leading the data. But if your data looks like this

X15265400Y31242000

then you will need to tell the software that your Zeros are Trailing the data.

Sometimes you will have no leading or trailing zeros. Then your data might look like this.

T01
X6500Y4500
X11350Y3900
X12750Y2500
X15000Y2500
X16500Y2500
X17250Y4500
X19500Y4000
X21550Y3450
X23500Y3000

Notice how the size of the X and Y Coordinate values are not always the same. In the first line they are 4 digits long each, in the lines that follow the X Coordinates are 5 digits long and the Y Coordinates are 4 digits long. In this case the Zero Suppression must be set to "None"

If you notice that there are decimals in your data, then you can set the Zero Suppression to Decimal

End of Drill File

Drill files will typically end in an M30 command after all of the X and Y Coordinates are listed.