What is an Aperture Table in Gerber?
An aperture table in Gerber is a list of all the apertures (shapes) used in a PCB design. Each aperture is identified by a unique code called an aperture number or D-code. The aperture table defines the shape, size, and type of each aperture.
In RS-274D, the aperture table is stored separately from the main Gerber file. This allows for easy modification and reuse of apertures across different designs. The aperture table is typically stored in a file with a .apr extension.
Example Aperture Table
Here is an example of an aperture table in RS-274D format:
%ADD10C,0.010*%
%ADD11R,0.050X0.030*%
%ADD12O,0.060X0.040*%
%ADD13P,0.015*%
In this example:
– D10 is a circular aperture with a diameter of 0.010 inches
– D11 is a rectangular aperture with a size of 0.050 x 0.030 inches
– D12 is an obround (oval) aperture with a size of 0.060 x 0.040 inches
– D13 is a polygon aperture approximating a circle with a diameter of 0.015 inches
Aperture Types and Shapes
RS-274D supports several standard aperture types and shapes:
Aperture Type | Shape |
---|---|
C | Circle |
R | Rectangle |
O | Obround (rounded rectangle/oval) |
P | Regular polygon (approximates a circle) |
The size of each shape is defined using one or more parameters after the shape letter. For example, %ADD10C,0.010*%
defines a circular aperture with a 0.010 inch diameter.
In addition to standard shapes, RS-274D also allows custom aperture shapes to be defined using aperture macros. Aperture macros use primitive shapes and operations to build up complex custom apertures.
Referencing Apertures in Gerber Data
Once the apertures are defined in the aperture table, they can be referenced in the main Gerber file to draw pads, traces, and other features on the PCB layers.
Apertures are selected using the “D” code followed by the aperture number. For example, D10*
selects aperture D10. The selected aperture is then used for all subsequent drawing commands until a new aperture is selected.
Here is an example of drawing commands in RS-274D using the example apertures defined earlier:
D10*
X1000Y1000D03*
X1500Y1000D03*
D11*
X2000Y1500D03*
X2500Y1500D03*
This would:
1. Select aperture D10 (0.010″ circle)
2. Flash (draw) the aperture at location X1000, Y1000
3. Flash the same aperture at X1500, Y1000
4. Select aperture D11 (0.050″ x 0.030″ rectangle)
5. Flash aperture D11 at X2000, Y1500
6. Flash aperture D11 again at X2500, Y1500
Advantages of Separate Aperture Tables
Using separate aperture tables in RS-274D provides several advantages over embedding the aperture definitions directly in the Gerber data:
-
Reusability: Aperture tables can be saved and reused across many different PCB designs. This promotes standardization and saves time defining the same apertures over and over.
-
Smaller file sizes: By factoring aperture definitions out into a separate file, the main Gerber data file can be made smaller. Only the aperture numbers need to be referenced, not the full definitions.
-
Easier editing: Aperture tables can be edited independently of the main Gerber data. Shapes, sizes, and types can be tweaked without having to regenerate the full Gerber file.
-
Simpler macros: Using an aperture table allows aperture macros to be defined once and referenced multiple times. Without an aperture table, the full macro definition would need to be embedded each time it is used, bloating the file size.
Gerber File Structure with Aperture Tables
A complete Gerber data package using RS-274D with separate aperture tables typically consists of two files:
- Main Gerber file (.gbr) – contains the layer image data referencing the apertures by number
- Aperture file (.apr) – contains the aperture table definitions
The two files are linked using the %ADD
command in the main Gerber file. The %ADD
command references the aperture definitions in the .apr file.
Here is an example of the structure:
Main .gbr file:
G04 This is the main Gerber file*
%FSLAX24Y24*%
%IPPOS*%
%LPD*%
%ADD10C,0.010*%
D10*
X1000Y1000D03*
X1500Y1500D03*
M02*
.apr aperture file:
G04 This is the aperture file*
%ADD10C,0.008*
%ADD11C,0.012*
%ADD12R,0.02X0.05*
%ADD13O,0.06X0.03*
In this example, the main .gbr file references aperture D10 defined in the separate .apr file. The .apr file contains additional aperture definitions that could be used by the main file.
FAQ
What is the current Gerber format standard?
The current Gerber format standard is RS-274X, also known as Extended Gerber or GerberX. It extends RS-274D with new commands and features while maintaining backwards compatibility.
Are aperture tables required in RS-274D?
No, using separate aperture tables is optional in RS-274D. Aperture definitions can also be embedded directly in the main Gerber file. However, using aperture tables is considered a best practice for the reasons outlined above.
Can multiple .gbr files share the same aperture table?
Yes, multiple .gbr files can reference the same .apr aperture file. This is useful for defining common apertures used across different PCB layers.
How do I view or edit Gerber files?
Gerber files can be viewed and edited using various PCB CAD tools, such as KiCad, Eagle, Altium, etc. There are also standalone Gerber viewer applications available.
What is the file extension for Gerber files?
The official file extension for Gerber files is .gbr or .art. However, other extensions like .gtl (top layer), .gbl (bottom layer), etc. are also sometimes used to specify the PCB layer.
In conclusion, RS-274D with separate aperture tables is a powerful and flexible way to define PCB artwork in the Gerber format. By separating aperture definitions from the main image data, designs are more modular, reusable, and compact. Understanding how to create and utilize aperture tables is a key skill for any PCB designer working with Gerber files.