Gerber RS274X format description (Extended Gerber)

It is an extension to standard RS274D Gerber (commonly known as Gerber) that includes:


Benefits of RS274X

RS274X includes many high level commands and controls that let the creator of the Gerber data

specify the photo-plot very precisely, much more so than RS274D which entailed passing a lot of

critical information separately from the data file.

All required information is embedded into a single file.



The Official RS274X Specification

The RS274X specification was developed by Gerber Systems. Gerber was purchased by Mania Barco,

a Belgian company, Today called UCAMCO. The 274X spec is now available from there download site.

A new Gerber version called Gerber X2 is introduced in 2015, which will add some new attribute functions to 274X

X2 Gerber is currently not supported in Viewplot.



RS-274X parameters

RS-274X parameters define characteristics that apply to an entire plot or to a single layer,

depending on the parameter’s position in the file and whether it generates a new information layer

in the file (as, for example, layer-specific parameters do).

RS-274X parameters consist of two alpha characters followed by one or more optional modifiers.


RS-274X parameters may be grouped according to the scope of their function in

the file. The groups should appear in the file in the following order:


Directive parameters

Directive parameters control overall file processing and should be placed at the beginning of the file.


Directive parameters
AS Axis Select
FS Format Statement
MI Mirror Image
MO Mode of units
OF Offset
SF Scale Factor


Image parameters

Image parameters supply information about the entire (composite) image, and should be used only once in a file.


Image parameters
IJ Image Justify
IN Image Name
IO Image Offset
IP Image Polarity
IR Image Rotation
PF Plotter Film


Aperture parameters

Vector plotters control the width and shape of features by projecting light through a series of openings,

or apertures, in a rotating wheel. Each position on the wheel is identified by a unique D code.

When the D code appears in the data, the wheel rotates to the referenced position for exposure.


Unlike a vector device, a raster device has no apertures and therefore requires a description of the aperture

geometry to create the required lines and other features. In general, aperture parameters apply to an entire file.


Aperture parameters
AD Aperture Description
AM Aperture Macro


Layer-specific parameters

Layer-specific parameters supply information for the processing of one or more information layers

(no board layers !).

They may be used more than once in a file. Layer-specific parameters always generate a new layer and

should be placed at the beginning of the new layer. If not repeated for a given layer, the previous

layer-specific parameters remain in effect.


Layer-specific parameters
KO  Knockout
LN  Layer Name
LP Layer Polarity
SR Step and Repeat


Miscellaneous parameters

There is a single miscellaneous parameter:

IF = Include File

The IF parameter is used to include (nest) external files in a file.



Embedding Format Info in the 274X Header

RS274X includes a statement that embeds key information about the format, zero suppression and data mode

into a single line:


274X Header embedding Format
% Parameter delimiter {Begin and end of block}
L Leading zeros omitted
T Trailing zeros omitted
D Explicit decimal point (i.e. no zeros omitted)
A Absolute coordinate mode
I Incremental coordinate mode
Nn Sequence number, where n is number of digits (rarely used)
Gn Prepartory function code (rarely used)
Xa Format of input data (5.5 is max)
Yb Format of input data
Zb Format of input data (Z is rarely if ever seen)
Dn Draft code
Mn Misc code




Format Statement Leading Zeros Suppression, Absolute Coordinates format=2.4


Format Statement Trailing Zero Suppression, Incremental Coordinates, format=4.4


Embedded Units

RS274X files can use coordinate and aperture units of either inches or millimeters. The statements:

Embedded Units
%MOIN*% Inches
%MOMM*% Millimeters


Image Polarity

With the old RS274D one had to instruct the photo-plot operator manually on the desired polarity of the film.

With RS274X a command near the beginning of the file can invert the film's polarity.

%IPPOS*% - positive (left)

%IPNEG*% - negative (right)


It is also possible to build up a very complex plot by combining individual dark and clear plots and then

setting the overall polarity of the film.



Embedded Aperture Definitions

One of the major shortcomings of the old RS274D spec was that the definition of each aperture was

not part of data file;

instead it was transferred manually on paper or as a text file similar to what is seen below:

Aperture Definitions
D-code Shape  SizeX SizeY
D10 round 0.010  
D11 square 0.030  
D12 rect 0.060 0.020
D13 thermal 0.050  
D14 oblong 0.060 0.025


Some apertures are obvious - the round, square and rectangle. But both the oblong and the thermal

are subject to the photo-plot operator's interpretation as shown below.


Basic Thermal --- Rotated Thermal --- Square Thermal


With 274D, building the exact thermal shape was a job for the photo-plot operator; there was significant

amount of effort and expense involved in creating these custom apertures and libraries had to be maintained.

With 274X even complex apertures are described using macros that the photo-plotter (and Viewplot)

synthesizes on-the-fly.


The Basic Aperture Definitions

RS274x includes several "standard" apertures since these represent more than 90 percent of the flash types used:

These are all assumed to be centered and can be defined with a round or rectangular hole if desired.



Standard Circle



Circle Code
AD Aperture description parameter
D{code} D-code to which this aperture is assigned (10-999)
C Tells 274X this is a circle macro
$1 Value (inches or mm) of the outside diameter
$2 Optional, if present defines the diameter of the hole
$3 Optional, if present the $2 and $3 represent the size of a rectangular hole



Circle Examples


Circle Code
Code Fig Size
%ADD21C,.100*% A 0.10 diameter circle on D21
%ADD22C,.100X.050*% B 0.10 dia circle with 0.05 hole on D22.
%ADD23C,.100X.050X.050*% C 0.10 dia circle with 0.05 square hole on D23
%ADD24C,.100X.050X.025*% D 0.10 dia circle with 0.05 x 0.025 rectangular hole on D24



Standard Rectangles



Rectangle Code
AD Aperture description parameter
D{code} D-code to which this aperture is assigned (10-999)
R Tells 274X this is a rectangle macro
$1 Value (inches or mm) of rect's length in X
$2 Value if rect's height in Y
$3 Optional, if present defines the diameter of the hole
$4 Optional, if present the $2 and $3 represent the size of a rectangular hole


Aperture Macros

The more general aperture macro can be thought of as a type of programming language where one builds up

a complex aperture definition from a series of simpler primitives. While this is a very powerful feature of

RS274X, using it has its drawbacks.

Remember that 274X is essentially Gerber Scientific's standard - photo-plotter's from other manufacturer's

may not read 274X at all - even if they do implement a subset of 274X it is usually the simpler commands

that are supported and complex commands such as aperture macros may not translate correctly or at all.

Therefore most PCB layout programs do not make use of complex aperture macros.

However macros are almost required defining thermal reliefs - and since thermal reliefs are very important

in power and ground planes we'll do a detailed example of macros using the thermal primitive.



Macro Primitives

Remember we said a macro is like a programming language - the complex aperture is built from one or more

shapes called primitives.


Available primitives include:

Macro Primitives
Primitive Name Primitive Nr Description and Parameter Number
Circle 1 Round
Line Vector 2 or 20 Rectangle defined by endpoints width and rotation. Square ends
Line Center 21 Rect - defined by center and length, width and rotation. Square ends
Line-Lower Left 22 Rect - defined by lower left coordinate, length, width and rotation
Outline 4 Outlines an area defined by coordinate pairs. max vertices is 50
Polygon 5 A regular polygon with 3-10 sides. defined by center, outer diameter and rotation
Moire 6 Target defined by center, number of circles circle thickness, cross hair length, thickness and rotation
Thermal 7 Thermal relief defined by outer diameter, inner diameter, crosshair thickness

and rotation


Aperture Macro Example - Thermal Relief

The thermal relief is so important that it has its own primitive - even though it could be built from other primitives.



Aperture Macro
Code Fig Size
%ADD32THERM100*%   Assigns THERM100 to D-code 32
AM   Aperture macro
THERM100   Name of the macro
*   Terminates name
7   Primitive 7, which is a thermal relief
0,0   First two parms: x,y center
0.100 A Third parm: outer diameter (solid black see)
0.050 B Fourth parm: inner diameter (clear)
0.025 C Fifth parm: crosshair width (clear)
0.0   Sixth parm: crosshair rotation (not used here)



Multiple Layers

It's been pretty standard practice in the PCB industry to build up a photo-tool from multiple Gerber files.

However the instructions to the photo-plotter operator have always been manual - leaving room for errors

and omissions. Here's how it used to be done:


Plotting Instructions for XYZ
Film1: top  
targets.gbr pos
comp.gbr  pos
padmaster.gbr pos
Film2: bottom  
targets.gbr pos
sold.gbr pos
padmaster.gbr pos
Film3: vcc  
vcc1.gbr pos
clearance.gbr neg
traces.gbr pos


Image Polarity

RS274X includes two special commands, %LPD*% and %LPC*% that organizes data inside the file by layer.

With a few judicious LPD/LPC commands combined with the IP (image polarity)

command one can build up complex ground planes quickly and easily.

In the example below we will show how the LPD/LPC can be used to put a circuit-trace easily on a power plane.


The main difficulty with putting a circuit trace on a power plane is

clearing away the metal around the circuit trace and it's associated pads.

With standard Gerber the layout software often had to fill in with small strokes

the entire power-plane metal area except where the clearance would be.

This results in a very large and unwieldy Gerber file.


G04 Image Parameters ***


%IPNEG*% This will reverse polarity of the entire film, eliminating the need to stroke the metal area of the power-plane.
%ADD10C,,,*% Here we define some round apertures and a thermal
%LNINTERNAL_VCC*% This is our basic VCC powerplane layer consisting of clearance pads, thermal reliefs, the outer trace that defines the board edge, and the clearance for the inner trace.
%LPD*% Indicates digitized data is dark. However when the entire film is reversed the digitzied data will be clear.
G04 NEW LAYER ***  
%LNTRACE_VCC*% This defines the circuit trace and two pads A,B
%LPC*% note that the data here is clear or reversed out. however when the entire film is negated the digitized data will be black on the film.
M02* End of the job




The series of images below show how a ground plane can be easily drawn, a trace within the ground plane

is placed and substracted, and the entire image is then reversed.


Internal_VCC data.

Note the large pads at A,B and the fat clearance trace.

The inner TRACE data. Since the layer is defined as LPC it will be subtracted from the INTERNAL_VCC plane data.


The dark VCC layer merged with the clear TRACE layer but before polarity reversal.


The dark VCC layer merged with the clear TRACE layer after polarity reversal.



G36/G37 Polygons

The G36/G37 polygon command is a very powerful command and will see more use in the future for describing

complex data often encountered in IC packages, RF and microwave circuits and analog devices.


When the photo-plotter sees a G36* command it immediately changes mode - it now ignores any aperture setting

and treats each draw command as the edge of a polygon to be filled in. The application creating the Gerber file

should create simple clean polygons.




Sample Usage of G36/G37

G04 G36/G37 Polygon Example ***
%ADD10C,,,*% Here we define some apertures
G54D10* Select D10
G36* Switch into polygon mode. The diameter and Shape of D10 no longer matters.
X123Y123D02* Move to initial position with pen up
X234D01* Draw a line (edge)
Y456D01* Draw a line (edge)
X234D01* Draw a line (edge)
Y123D01* Draw a line (edge) back to original start
G37* End polygon mode



The Gerber RS274X format description is a summarize from the Official RS274X Specification &

What's all this about RS274X Anyway document written by Steve DiBartolomeo from

Artwork Conversion Software


A summarize from the Basic (D)Gerber Apertures, D-Codes and Plot Files