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
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.
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.
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.
The "C" is followed by the tool diameter. The units of measure can vary. In the above example the UOM is Inches.
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.
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.
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.
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.
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
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
then you will need to tell the software that the Zeros are Leading the data. But if your data looks like this
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.
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.