Contact Sales & After-Sales Service

Contact & Quotation

  • Inquire: Call 0086-755-23203480, or reach out via the form below/your sales contact to discuss our design, manufacturing, and assembly capabilities.
  • Quote: Email your PCB files to Sales@pcbsync.com (Preferred for large files) or submit online. We will contact you promptly. Please ensure your email is correct.
Drag & Drop Files, Choose Files to Upload You can upload up to 3 files.

Notes:
For PCB fabrication, we require PCB design file in Gerber RS-274X format (most preferred), *.PCB/DDB (Protel, inform your program version) format or *.BRD (Eagle) format. For PCB assembly, we require PCB design file in above mentioned format, drilling file and BOM. Click to download BOM template To avoid file missing, please include all files into one folder and compress it into .zip or .rar format.

What is an Aperture File? Gerber Tool Definition Guide

When working with older Gerber formats or legacy manufacturing systems, you’ll encounter a critical companion file that defines the shapes and sizes used to create your PCB artwork. The aperture file (.apt) contains the tool definitions that tell photoplotters exactly what shapes to draw and flash—without it, your Gerber data is essentially meaningless coordinates.

This guide explains what aperture files are, how they work with Gerber data, and why understanding them matters even in modern PCB workflows.

What is an Aperture File?

An aperture file (.apt) is a text-based document that defines the shapes and sizes of tools used to create PCB images from Gerber data. In the original RS-274-D Gerber format, the main Gerber file contains only XY coordinates and command codes—the actual shape definitions live in a separate aperture file, sometimes called a “wheel file.”

Think of apertures as digital stencils. When a photoplotter receives a command to “flash D10 at coordinates X100Y200,” it needs to know what D10 actually looks like. Is it a 50-mil round pad? A 60×80-mil rectangle? A thermal relief pattern? The aperture file provides these definitions, mapping each D-code number to a specific shape and dimension.

The term “aperture” comes from the physical aperture wheels used in early vector photoplotters. These machines had rotating disks with different-shaped holes cut into them. Light would shine through the selected aperture to expose the shape onto photographic film. Modern systems are digital, but the terminology stuck.

Aperture Files vs Embedded Apertures

Understanding when you need a separate aperture file depends on which Gerber format you’re using.

Format Comparison

Gerber FormatAperture LocationFile Extension
RS-274-D (Standard Gerber)Separate aperture file required.apt, .apr, .rep
RS-274-X (Extended Gerber)Embedded in Gerber fileNot needed
Gerber X2Embedded with metadataNot needed

RS-274-D, the original Gerber format from the 1960s, requires a separate aperture file (.apt) because the coordinate data and shape definitions are stored independently. RS-274-X, introduced in the 1980s, solved this problem by embedding aperture definitions directly within the Gerber file using special commands.

Today, most PCB software exports RS-274-X or Gerber X2 format by default, making separate aperture files unnecessary. However, you’ll still encounter .apt files when working with legacy designs, certain older manufacturing equipment, or specific CAM software that requires external aperture definitions.

Structure of an Aperture File

An aperture file is plain ASCII text listing D-code assignments and their corresponding shape definitions.

Basic Aperture File Format

D10 ROUND 0.050D11 ROUND 0.062D12 SQUARE 0.060D13 RECT 0.080 0.040D14 OBROUND 0.100 0.050D15 THERMAL 0.080 0.050 0.010 4

Each line assigns a D-code number to a shape type and dimensions. The file may also include header information specifying units (inches or millimeters) and other parameters.

Aperture Definition Components

ComponentDescriptionExample
D-codeTool number (D10-D999)D10
Shape typeGeometric shapeROUND, RECT
DimensionsSize parameters0.050, 0.080×0.040
Hole (optional)Center hole diameterX0.025

Standard Aperture Shapes

The Gerber format defines four standard aperture shapes that cover most PCB requirements.

Circle (C)

The most common aperture shape, used for round pads, vias, and drawing traces.

ParameterDescription
DiameterOuter diameter of circle
Hole diameterOptional center hole

Definition example: %ADD10C,0.050*% creates a 50-mil diameter circle.

Rectangle (R)

Used for rectangular pads, particularly for surface-mount components.

ParameterDescription
X sizeWidth of rectangle
Y sizeHeight of rectangle
Hole diameterOptional center hole

Definition example: %ADD11R,0.060X0.040*% creates a 60×40-mil rectangle.

Obround (O)

An oval shape consisting of two semicircles connected by straight sides. Common for elongated SMD pads.

ParameterDescription
X sizeOverall width
Y sizeOverall height
Hole diameterOptional center hole

Definition example: %ADD12O,0.080X0.040*% creates an obround 80 mils wide and 40 mils tall.

Polygon (P)

Regular polygons with a specified number of sides, useful for hexagonal pads or special shapes.

ParameterDescription
Outer diameterCircle circumscribing polygon
VerticesNumber of sides (3-12)
RotationAngle in degrees
Hole diameterOptional center hole

Definition example: %ADD13P,0.060X6X0.0*% creates a hexagon with 60-mil outer diameter.

D-Codes Explained

D-codes are the link between Gerber coordinate commands and aperture file definitions. Understanding how they work helps troubleshoot aperture-related problems.

D-Code Categories

D-code RangeFunction
D01Draw (pen down, shutter open)
D02Move (pen up, shutter closed)
D03Flash (stamp aperture at location)
D10-D999Aperture selection

D01, D02, and D03 are operation commands that control how the photoplotter moves and exposes. D10 and higher select which aperture to use for subsequent operations.

How D-Codes Work in Gerber Files

When a Gerber file contains:

D10*X1000Y2000D03*X1500Y2000D03*

This means: select aperture D10, flash it at coordinates (1000,2000), then flash it again at (1500,2000). Without the aperture file defining what D10 looks like, the photoplotter cannot create the image.

Creating and Managing Aperture Files

Most modern PCB software handles aperture definitions automatically, but understanding the manual process helps when troubleshooting or working with legacy data.

Automatic Aperture Generation

SoftwareAperture Handling
Altium DesignerAuto-generates embedded or external
KiCadEmbedded apertures in RS-274-X
EagleGenerates with CAM processor
OrCAD/AllegroConfigurable embedded/external

When using RS-274-X format, aperture definitions are embedded within the Gerber file using AD (Aperture Definition) commands. No separate .apt file is needed.

Manual Aperture File Creation

If you must create a separate aperture file for RS-274-D compatibility:

  1. Export your design to RS-274-D format
  2. Note which D-codes your software assigns
  3. Create a text file listing each D-code with shape and dimensions
  4. Save with .apt extension
  5. Include with your Gerber files

Aperture Matching

When using an existing aperture file (.apt) rather than generating one, the PCB software scans your PCB design primitives and attempts to match them with definitions in the loaded aperture file. If no exact match exists, the software may:

  • Paint the shape using a smaller aperture
  • Generate a .MAT (match) file listing missing apertures
  • Abort Gerber generation if no suitable aperture exists

Common Aperture File Problems

Aperture files are a frequent source of manufacturing issues, particularly with legacy data.

Troubleshooting Guide

ProblemCauseSolution
Missing aperturesAperture file not includedInclude .apt with Gerbers
Wrong pad sizesD-code mismatchVerify aperture definitions match design
Distorted shapesUnit mismatchCheck inch vs mm settings
Thermal gaps wrongIncorrect thermal definitionReview thermal aperture parameters
Traces wrong widthDraw aperture incorrectCheck circle diameter for D-code

File Compatibility Issues

IssueDescription
Format variationsDifferent software uses different aperture file formats
Unit ambiguityFile may not specify inches or millimeters
D-code conflictsSame D-code defined differently in multiple files
Missing fileAperture file separated from Gerber during transfer

Aperture Macros for Complex Shapes

Beyond standard apertures, the Gerber format supports aperture macros (AM) for creating custom shapes.

Common Macro Apertures

ShapeUse Case
ThermalPower/ground plane connections
DonutAnnular ring pads
TargetFiducial marks
Custom polygonSpecialized pad shapes

Aperture macros are defined using a primitive-based language that combines basic shapes (circles, lines, polygons) into complex patterns. Thermal relief apertures are so common they have dedicated primitives in the macro language.

Thermal Relief Example

A thermal relief connects a pad to a copper pour while providing thermal isolation for easier soldering:

%AMTHERM*1,1,0.080,0,0*1,0,0.040,0,0*20,1,0.010,0,-0.030,0,0.030,0*20,1,0.010,-0.030,0,0.030,0,0*%

This creates a thermal with outer diameter 0.080, inner diameter 0.040, and four 0.010-wide spokes.

Modern Alternatives to Separate Aperture Files

While aperture files (.apt) remain relevant for legacy compatibility, modern workflows have largely moved beyond them.

Embedded Apertures (RS-274-X)

The RS-274-X format embeds aperture definitions using AD commands within the Gerber file:

%ADD10C,0.050*%%ADD11R,0.060X0.040*%

This eliminates the need for separate files and prevents aperture/Gerber mismatches.

Gerber X2 Attributes

Gerber X2 adds metadata attributes that describe what each aperture represents (pad, via, conductor) in addition to its shape. This provides manufacturing intelligence beyond pure geometry.

IPC-2581 and ODB++

These newer formats include aperture-equivalent information in structured databases, eliminating the ambiguity issues that plagued separate aperture files.

FormatAperture Handling
IPC-2581Pad definitions in XML
ODB++Feature definitions in structured files

Best Practices for Aperture Files

When working with aperture files, follow these guidelines to avoid manufacturing problems.

Export Recommendations

RecommendationReason
Use RS-274-X when possibleEliminates separate aperture file
Include units in aperture filePrevents inch/mm confusion
Keep aperture file with GerbersPrevents separation during transfer
Verify D-code assignmentsEnsures apertures match design
Don’t modify auto-generated filesMaintains consistency

Verification Steps

  1. Load Gerber and aperture files in viewer together
  2. Verify pad sizes match design intent
  3. Check trace widths are correct
  4. Confirm thermal reliefs appear properly
  5. Compare against your PCB design software’s preview

Useful Resources for Aperture Files

Documentation

ResourceDescription
Ucamco Gerber SpecificationOfficial format documentation
RS-274-X User’s GuideExtended Gerber format details
IPC-2581 StandardModern CAD-to-CAM format

Software Tools

ToolFunction
GC-PrevueProfessional CAM viewer
GerbvFree open-source viewer
ViewMateFree Gerber viewer
CAM350Industry CAM software

Downloads

ResourceURL
Gerber Format Specificationucamco.com/gerber
Gerbv Viewergerbv.github.io
ViewMatepentalogix.com

Frequently Asked Questions About Aperture Files

Do I need an aperture file with modern Gerber files?

If your software exports RS-274-X or Gerber X2 format (most modern tools do), aperture definitions are embedded within the Gerber file itself. No separate aperture file (.apt) is required. However, if you’re working with RS-274-D format or legacy equipment, you’ll need to include the aperture file with your Gerber data.

What happens if my aperture file is missing?

Without an aperture file, RS-274-D Gerber data contains only coordinates and D-code references—the actual shapes are undefined. The manufacturing equipment cannot create the PCB image. Most Gerber viewers will show just dots or lines at coordinate locations without proper shape representation. Always verify your aperture file is included when submitting RS-274-D data.

Why do my pads appear the wrong size in the Gerber viewer?

This typically indicates a mismatch between the aperture file and Gerber data, or a unit discrepancy. Check that your aperture file uses the same units (inches or millimeters) as your Gerber coordinates. Also verify that D-code assignments in the aperture file match those used in the Gerber data—a common problem when mixing files from different design revisions.

Can I edit an aperture file manually?

Yes, aperture files are plain text and can be edited with any text editor. However, manual editing is risky—incorrect aperture dimensions directly affect your manufactured board. If you must edit, carefully verify units, D-code assignments, and dimensions. Test by viewing the modified files in a Gerber viewer before sending to manufacturing.

Should I use embedded or separate apertures?

Use embedded apertures (RS-274-X format) whenever your manufacturer supports them—virtually all modern facilities do. Embedded apertures eliminate the risk of aperture file separation or mismatch. Only use separate aperture files (.apt) when required for legacy equipment compatibility or when your manufacturer specifically requests RS-274-D format.

Conclusion

The aperture file (.apt) is a legacy but still relevant component of PCB manufacturing data. While modern RS-274-X and Gerber X2 formats have largely eliminated the need for separate aperture definitions, understanding how apertures work—as D-code mapped shape definitions—helps troubleshoot Gerber issues and work with older designs.

When possible, use embedded apertures through RS-274-X export. When separate aperture files are required, keep them paired with their Gerber data, verify unit consistency, and always check your output in a Gerber viewer before sending to manufacturing. The few minutes spent verifying aperture definitions can save days of manufacturing delays from incorrect pad sizes or missing shapes.

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Sales & After-Sales Service

Contact & Quotation

  • Inquire: Call 0086-755-23203480, or reach out via the form below/your sales contact to discuss our design, manufacturing, and assembly capabilities.

  • Quote: Email your PCB files to Sales@pcbsync.com (Preferred for large files) or submit online. We will contact you promptly. Please ensure your email is correct.

Drag & Drop Files, Choose Files to Upload You can upload up to 3 files.

Notes:
For PCB fabrication, we require PCB design file in Gerber RS-274X format (most preferred), *.PCB/DDB (Protel, inform your program version) format or *.BRD (Eagle) format. For PCB assembly, we require PCB design file in above mentioned format, drilling file and BOM. Click to download BOM template To avoid file missing, please include all files into one folder and compress it into .zip or .rar format.