This guide provides detailed technical instructions for converting legacy RS-274-D (Standard Gerber) files generated in Tango PCB into modern, standardized RS-274-X (Extended Gerber) format. The guide covers theoretical foundations, dimension conversion procedures, shape mapping, syntax rules, as well as concrete examples of aperture reports and raw RS-274-D files.
1. Introduction: Difference Between RS-274-D and RS-274-X Formats
The primary challenge when working with legacy CAD software such as Tango PCB lies in how printed circuit board (PCB) geometry data is stored:
- RS-274-D (Standard Gerber): Contains strictly vector commands for photoplotter head positioning (e.g., X0100Y0200D01*) and tool/aperture ID calls (e.g., D10*). The Gerber file itself does not contain information regarding the shape or dimensions of aperture D10. That data resides in a separate text report (the Aperture Report, typically with a .REP or .APT extension).
- RS-274-X (Extended Gerber): A self-contained format that includes full definitions of shapes, dimensions, and measurement units for all D-codes used in the documentation at the very beginning (header) of the file. Modern CAM manufacturing software and modern Gerber viewers exclusively require the RS-274-X format.
2. Structure of Tango Aperture Report (.REP / .APT)
When generating photoplotter files in Tango PCB, the program creates a textual aperture table. The main parameters in this table are:
- Code (D-Code): The aperture identifier, starting from D10 upwards.
- Shape: Defines the geometry (Ellipse, Rd Rect, Rect, Square).
- X and Y Dimensions: Physical tool size. In Tango PCB, these values are always expressed in mils (thousandths of an inch: 100 mil = 0.100 in = 2.54 mm).
- Assignments: Section showing which D-codes are assigned to which PCB layer (routes, pads, silkscreen, mask).
Sample APT (.REP) File Example:
3. Structure of Legacy RS-274-D Gerber File
A raw RS-274-D Gerber file contains coordinate moves and light beam commands for photo-plotters:
- G70*: Sets coordinates to inches.
- G90*: Enables absolute positioning.
- G01*: Linear interpolation.
- D02*: Light beam OFF (move without drawing / Pen Up).
- D01*: Light beam ON (drawing line / Pen Down).
- D10*, D12*...: Aperture selection command.
Sample Legacy RS-274-D Gerber File Snippet:
*%FSLAX44Y44*
SFA1.0B1.0*%
G70*
G90*
G01*
D02*
D10*
X13720Y43920D02*
X13720Y43920D01*
X13720Y46870D01*
X13760Y46870D01*
X13760Y43920D01*
...
D02*
D12*
X68250Y39000D02*
X68500Y39000D01*
D02*
D10*
X68500Y39000D02*
X68500Y39000D01*
X68500Y39500D01*
X68450Y39500D01*
4. RS-274-X Header Syntax and Rules
To convert an RS-274-D file into RS-274-X, an aperture header block must be prepended to the very beginning of the file. Each aperture definition command is enclosed within percent signs (%) and terminated with an asterisk (*).4.1. Defining Units of Measurement
The initial header line establishes the measurement system for the entire file. For inches, the command is: %MOIN*%4.2. Shape Mapping and Conversion Formulas
Each individual aperture is defined using the general template: %ADD| Tango Shape | RS-274-X Code | Description & Geometry | RS-274-X Syntax | Translation Example |
|---|---|---|---|---|
| Ellipse (X = Y) | C | Circle | %ADD<D>C,<Diameter>*% | D10 Ellipse 010 010 → %ADD10C,0.010*% |
| Rd Rect | O | Obround (Rounded Rectangle) | %ADD<D>O,<X>X<Y>*% | D22 Rd Rect 080 150 → %ADD22O,0.080X0.150*% |
| Rect / Square | R | Rectangle / Sharp Square | %ADD<D>R,<X>X<Y>*% | D15 Rect 060 040 → %ADD15R,0.060X0.040*% |
| Ellipse (X ≠ Y) | E | True Ellipse | %ADD<D>E,<X>X<Y>*% | D18 Ellipse 060 040 → %ADD18E,0.060X0.040*% |
5. Step-by-Step Conversion Procedure
Step 1: Analyze the Tango Report (.REP)
Open the .REP / .APT file in a text editor (e.g., Notepad or Notepad++) and locate the Aperture and Tool Descriptions section. List all D-codes along with their shapes and X/Y dimensions.Step 2: Construct the Aperture Header Block
Prepare the list of RS-274-X definitions. Based on the sample .REP file above, construct the following header block:
%MOIN*%
%ADD10C,0.010*%
%ADD11C,0.008*%
%ADD12C,0.012*%
%ADD13C,0.018*%
%ADD14C,0.030*%
%ADD15C,0.040*%
%ADD16C,0.050*%
%ADD17C,0.045*%
%ADD18C,0.070*%
%ADD19C,0.100*%
%ADD20C,0.120*%
%ADD22O,0.080X0.150*%
%ADD23O,0.100X0.170*%
Step 3: Insert Header into Gerber Files
Open the raw Gerber layer file (e.g., CTR.GTO for silkscreen or CTR.GTL for top copper) in a text editor. Place the cursor at the very first line of the file (before existing command lines like *%FSLAX44Y44* or G70*). Paste the constructed header block. The modified file top will look as follows:
%MOIN*%
%ADD10C,0.010*%
%ADD11C,0.008*%
%ADD12C,0.012*%
%ADD22O,0.080X0.150*%
%ADD23O,0.100X0.170*%
*%FSLAX44Y44*
SFA1.0B1.0*%
G70*
G90*
G01*
D02*
D10*
X13720Y43920D02*
X13720Y43920D01*
