File Formats for Copper Connection

Copper Connection outputs a variety of file types.

Zip

Upon export, Copper Connection copies the Gerber and Excellon-format files into a single compressed file ('.zip'). Not only does the compressed file save upload time, but it keeps all of the layers together. The 'zip' file is the only file that the manufacturer needs to make your boards.

Gerber

To have a board professionally manufactured, the PCB manufacturer requires the board layout in an industry standard format. Gerber files describe the copper, silkscreen, and solder mask layers. All PCB manufacturers accept Gerber RS-274X files.

The Gerber format is officially defined by Ucamco The Gerber Format Specification. Copper Connection is programmed from specification revision I1, December 2012. See also: Wikipedia Gerber Format.

IMPORTANT: Exported files may look different to the manufacturer due to their equipment's interpretation of the file format. Do not rely on Copper Connection's conversion algorithm. Instead, use the manufacturer-recommended viewing tool to personally verify the output before placing an order.

Gerber File Naming Conventions

By default, Copper Connection names the exported Gerber files using the name of the board file with the following extensions:

.gtoTop silkscreen (overlay)
.gtpTop solder paste
.gtsTop solder mask
.gtlTop copper
.gp1Upper inner layer
.gp2Lower inner layer
.gblBottom copper
.gbsBottom solder mask
.gbpBottom solder paste
.gboBottom silkscreen (overlay)
.gm1Board outline

The layer information is also stored within the file itself -- in the initial level name (LN) command and in a header comment.

File Header Comments

You can examine the contents of Gerber files by opening them in Notepad. The files generated by Copper Connection begin with basic documentation to assist operators.

G04*
G04 Format:               Gerber RS-274X*
G04 Layer:                TopSilkscreen*
G04 This File Name:       Sandwich v5.gto*
G04 Source File Name:     Sandwich v5.rrpcb*
G04 Part Number:          KSANDPCB*
G04 Revision:             5.0*
G04 Unique ID:            91058d8e-8bb4-444d-8420-57ae1be64991*
G04 Generated Date:       Wednesday, 16 January 2013 22:53:05*
G04*
G04 Customer Contact:     Example name and phone number*
G04 Special Instructions: Sample instructions here*
G04*
G04 Created Using:        Robot Room Copper Connection v1.0*
G04 Software Contact:     http://www.robotroom.com/CopperConnection/Support.aspx*
G04*
G04 Zero Suppression:     Leading*
G04 Number Precision:     2.4*
G04*

The keys (such as "Created Using:") in the comments do not change based on the user's locale/language. So, you can programmatically key off of them. However, the spacing and line order can change. So, skip G04, skip any white space, read key up to colon (':') skip any white space, and read value up to but not including the asterisk '*'. A colon will never appear as part of the key. An asterisk will never appear in the key or the value.

Multiline values are placed on sequential lines, starting with G04 and enough spaces to align them to the other values. Blank lines are simple G04*.

The part number, revision, customer contact, and special instructions come from Board Property fields. If a particular Board Property field is empty, the associated line will not appear in the file.

Unique ID

The Unique ID is a globally unique identifier (GUID) that is stored in the Gerber/Excellon files during Export. A new ID is generated each time. It does not contain any customer or product information.

There is no specific purpose for the unique ID. However, it could allow a manufacturer to associate all of the files of a board with their order tracking system. Also, it can help detect mixed up sets of files, as the IDs are all supposed to match.

Gerber Export Settings

To generate Gerber and Excellon files for PCB manufacturing, choose Export from the File menu.

Click on the Gerber tab to see the specific settings. The settings default to the most popular values. Place the cursor over the label for each setting to display a tool tip.

Export settings

Export settings

Excellon

Gerber files lack drill hole information. So, the manufacturer also requires an Excellon NC drill file.

The Excellon drill format is officially defined by the Excellon program manual. Copper Connection is designed against revision CNC-7 (as of January 2013). See also: Wikipedia Excellon Format.

When exported, the output file ends in .txt. The file includes both the drill/tool/aperture definitions and hole locations.

You can examine the contents of an Excellon drill file using Notepad. Like the Gerber files, the same header documentation is included to assist the operator. The difference is that Excellon comments start with a semicolon and end at the end of the line (rather than an asterisk).

Hole Locations

The list of board hole locations can also be copied or saved in generic formats. Choose Hole Locations from the Data menu.

The Hole Locations feature is primarily targeted at users that etch their own boards at home. However, the data may also be useful for importing into other programs. PCB manufacturers do not want the hole information in these formats. Use Excellon instead.

The Hole Locations file begins with "Hole locations for", followed by the board filename, and ends in ".txt".

Escaping Characters

Gerber and Excellon Files

Gerber and Excellon are ASCII-only file formats, with additional reserved characters.

Text elements are drawn using Gerber line and arc commands, and are therefore unaffected by the ASCII limitation. So, the only characters that might be out of range would appear in comments in the file. Limiting comment characters to ASCII does not affect the final appearance of the manufactured board. Unicode characters are first normalized using normalization form KD. Any remaining reserved and non-ASCII characters are then stripped.

Tab Delimited and Comma Separated Files

Unicode content is unaltered. UTF-8 encoding is used.

Special characters such as tabs, commas, carriage returns, and line feeds can be misinterpreted as delimiters. So, double quotes ("example") enclose text fields, leaving the special characters unaltered.

This presents a problem with quote marks inside the double-quoted fields. So, a quote is preceded by yet another quote mark. For example, Test    "this" (with a tab in the middle) becomes "Test    ""this""" in the file.

The process is reversed when reading the file: The very first and very last quote characters are removed, and every pair of quotes is turning into one quote.

Settings

Settings follow the INI file standard. Rather than using quotes, the following characters are escaped with a backslash ('\'):

\\A single backslash
\nLinefeed
\rCarriage return

Unicode content is unaltered. UTF-8 encoding is used.

RRB

Robot Room Compact Circuit Board (RRB) format is a proprietary binary format. It will have breaking changes without notice and is not intended for interoperability. Use RRPCB instead.

RRPCB

Robot Room Printed Circuit Board (RRPCB) format is human and machine readable. It is a text file.

The very best way to learn about the RRPCB format is to save a simple board with various elements (or choose Example PCBs in the Help menu). Then, open it in Notepad. The formatting and conventions were intentionally chosen to be familiar to users of the software and to anyone with programming experience. You should do so now, to follow along as you read.

The contents of an RRPCB file consist of two parts:

Aside: JSON and XML were considered, but hierarchies were not needed and both standards are more verbose. There are lots of free converters for transforming tab-delimited to JSON and XML, such as Mr. Data Converter.

Unicode content is unaltered. UTF-8 encoding is used.

Settings in RRPCB

The settings portion on an RRPCB file consists primarily of Board Settings. They are named to correspond to the fields in that window.

Settings are sorted in alphabetical order by section, with the unnamed general section at the start of the file. Blank lines are ignored/eliminated.

Images in RRPCB

Images are stored under settings in the [Images] section. Most boards do not include images.

An image setting name is Image_GloballyUniqueId. If an image is duplicated multiple times on a board, only a single copy is stored, and it is referenced by its GUID.

The image value is encoded as Base64 (A-Z, a-z, 0-9, +, /, padded with =). After decoding to binary, the image is in the format originally provided by the user (jpeg, png, tif, etc).

In C# .NET:

image = Image.FromStream(new MemoryStream(Convert.FromBase64String(valueString)));

Element Data in RRPCB

The settings section ends with [Data]. If you want to skip the settings, simply look for the first line that begins with [Data], and copy after that line until the end of the file. For example, you can copy the elements and paste them into a spreadsheet.

The first row in the elements is the column titles. Column order is not significant. Columns will be inserted/added/deleted in the future. So, key off the column title, not the column position.

The element content is in invariant format. For example, periods are always used for decimals and keywords (layers, column titles, item types) do not change for local languages. However, obviously text entered by the user is in their local language.

Ids are positive integers that are unique per board. An element's id may change as the board is edited.

Besides identifying the element, ids determine draw order on their layer. Lower number ids are drawn underneath higher number ids for their layer.

Non-empty fields in text columns are always quoted, following the escape rules for other tab-delimited content.

Empty elements, unknown element types, or improper elements are skipped and will not be written back to the file upon saving.

Custom Data in RRPCB

Do not edit files without making a backup first, as you may make them unreadable. Malformed files may crash the program or may not manufacturer correctly. Proceed at your own risk.

Note Element

The Note type may be beneficial if you want to add user-visible comments. For example, you may want to perform your own custom design check and note any issues. The best way to see how to make a note by hand or programmatically is to add a note to the board using the Note tool in Copper Connection.

ThirdPartyData Element Column

The ThirdPartyData column is element-specific storage for use by external programs. It is read, stored in memory, and written back to the file upon save. If not empty, it is always double-quoted. For example, the value 5 should be stored as "5", even though it isn't text and doesn't have any special characters.

Custom Settings

If you want to save information not related to a specific element, you can place it in the settings portion of the file. But, instead of placing settings in the general section, make your own section such as [ThirdPartyXYZ].