A special note about units: Older versions of pcb used mils (1/1000 inch) as the base unit; a value of 500 in the file meant half an inch.  Newer versions uses a "high resolution" syntax, where the base unit is 1/100 of a mil (0.000010 inch); a value of 500 in the file means 5 mils.  As a general rule, the variants of each entry listed below which use square brackets are the high resolution formats and use the 1/100 mil units, and the ones with parentheses are the older variants and use 1 mil units.  Note that when multiple variants are listed, the most recent (and most preferred) format is the first listed.

Symbolic and numeric flags (SFlags and NFlags) are described in Object Flags.

Arc
---

     Arc [X Y Width Height Thickness Clearance StartAngle DeltaAngle SFlags]
     Arc (X Y Width Height Thickness Clearance StartAngle DeltaAngle NFlags)
     Arc (X Y Width Height Thickness StartAngle DeltaAngle NFlags)

X Y
     Coordinates of the center of the arc.

Width Height
     The width and height, from the center to the edge.  The bounds of the circle of which this arc is a segment, is thus 2*Width by 2*Height.

Thickness
     The width of the copper trace which forms the arc.

Clearance
     The amount of space cleared around the arc when the line passes through a polygon.  The clearance is added to the thickness to get the thickness of the clear; thus the space between the arc and the polygon is Clearance/2 wide.

StartAngle
     The angle of one end of the arc, in degrees.  In PCB, an angle of zero points left (negative X direction), and 90 degrees points down (positive Y direction).

DeltaAngle
     The sweep of the arc.  This may be negative.  Positive angles sweep counterclockwise.

SFlags
     Symbolic or numeric flags.

NFlags
     Numeric flags.

Connect
-------

     Connect ("PinPad")

PinPad
     The name of a pin or pad which is included in this net.  Pin and Pad names are named by the refdes and pin name, like "U14-7" for pin 7 of U14, or "T4-E" for pin E of T4.

Cursor
------

     Cursor [X Y Zoom]
     Cursor (X Y Zoom)

X Y
     Location of the cursor when the board was saved.

Zoom
     The current zoom factor.  Note that a zoom factor of "0" means 1 mil per screen pixel, N means 2^N mils per screen pixel, etc.  The first variant accepts floating point numbers.  The special value "1000" means "zoom to fit"

DRC
---

     DRC [Bloat Shrink Line Silk Drill Ring]
     DRC [Bloat Shrink Line Silk]
     DRC [Bloat Shrink Line]

Bloat
     Minimum spacing between copper.

Shrink
     Minimum copper overlap to guarantee connectivity.

Line
     Minimum line thickness.

Silk
     Minimum silk thickness.

Drill
     Minimum drill size.

Ring
     Minimum width of the annular ring around pins and vias.

Element
-------

     Element [SFlags "Desc" "Name" "Value" MX MY TX TY TDir TScale TSFlags] (
     Element (NFlags "Desc" "Name" "Value" MX MY TX TY TDir TScale TNFlags) (
     Element (NFlags "Desc" "Name" "Value" TX TY TDir TScale TNFlags) (
     Element (NFlags "Desc" "Name" TX TY TDir TScale TNFlags) (
     Element ("Desc" "Name" TX TY TDir TScale TNFlags) (
        ... contents ...
     )

SFlags
     Symbolic or numeric flags, for the element as a whole.

NFlags
     Numeric flags, for the element as a whole.

Desc
     The description of the element.  This is one of the three strings which can be displayed on the screen.

Name
     The name of the element, usually the reference designator.

Value
     The value of the element.

MX MY
     The location of the element's mark.  This is the reference point for placing the element and its pins and pads.

TX TY
     The upper left corner of the text (one of the three strings).

TDir
     The relative direction of the text.  0 means left to right for an unrotated element, 1 means up, 2 left, 3 down.

TScale
     Size of the text, as a percentage of the ``default'' size of of the font (the default font is about 40 mils high).  Default is 100 (40 mils).

TSFlags
     Symbolic or numeric flags, for the text.

TNFlags
     Numeric flags, for the text.

Elements may contain pins, pads, element lines, element arcs, and (for older elements) an optional mark.  Note that element definitions that have the mark coordinates in the element line, only support pins and pads which use relative coordinates.  The pin and pad coordinates are relative to the mark.  Element definitions which do not include the mark coordinates in the element line, may have a Mark definition in their contents, and only use pin and pad definitions which use absolute coordinates.

ElementArc
----------

     ElementArc [X Y Width Height StartAngle DeltaAngle Thickness]
     ElementArc (X Y Width Height StartAngle DeltaAngle Thickness)

X Y
     Coordinates of the center of the arc.  These are relative to the Element's mark point for new element formats, or absolute for older formats.

Width Height
     The width and height, from the center to the edge.  The bounds of the circle of which this arc is a segment, is thus 2*Width by 2*Height.

StartAngle
     The angle of one end of the arc, in degrees.  In PCB, an angle of zero points left (negative X direction), and 90 degrees points down (positive Y direction).

DeltaAngle
     The sweep of the arc.  This may be negative.  Positive angles sweep counterclockwise.

Thickness
     The width of the silk line which forms the arc.

ElementLine
-----------

     ElementLine [X1 Y1 X2 Y2 Thickness]
     ElementLine (X1 Y1 X2 Y2 Thickness)

X1 Y1 X2 Y2
     Coordinates of the endpoints of the line.  These are relative to the Element's mark point for new element formats, or absolute for older formats.

Thickness
     The width of the silk for this line.

Flags
-----

     Flags(Number)

Number
     A number, whose value is normally given in hex, individual bits of which represent pcb-wide flags as defined in PCBFlags.

Grid
----

     Grid [Step OffsetX OffsetY Visible]
     Grid (Step OffsetX OffsetY Visible)
     Grid (Step OffsetX OffsetY)

Step
     Distance from one grid point to adjacent points.  This value may be a floating point number for the first two variants.

OffsetX OffsetY
     The "origin" of the grid.  Normally zero.

Visible
     If non-zero, the grid will be visible on the screen.

Groups
------

     Groups("String")

String

     Encodes the layer grouping information.  Each group is separated by a colon, each member of each group is separated by a comma.  Group members are either numbers from 1..N for each layer, and the letters c or s representing the component side and solder side of the board.  Including c or s marks that group as being the top or bottom side of the board.

          Groups("1,2,c:3:4:5,6,s:7,8")

Layer
-----

     Layer (LayerNum "Name") (
        ... contents ...
     )

LayerNum
     The layer number.  Layers are numbered sequentially, starting with 1. The last two layers (9 and 10 by default) are solder-side silk and component-side silk, in that order.

Name
     The layer name.

contents
     The contents of the layer, which may include lines, arcs, rectangles, text, and polygons.

Line
----

     Line [X1 Y1 X2 Y2 Thickness Clearance SFlags]
     Line (X1 Y1 X2 Y2 Thickness Clearance NFlags)
     Line (X1 Y1 X2 Y2 Thickness NFlags)

X1 Y1 X2 Y2
     The end points of the line

Thickness
     The width of the line

Clearance
     The amount of space cleared around the line when the line passes through a polygon.  The clearance is added to the thickness to get the thickness of the clear; thus the space between the line and the polygon is Clearance/2 wide.

SFlags
     Symbolic or numeric flags

NFlags
     Numeric flags.

Mark
----

     Mark [X Y]
     Mark (X Y)

X Y
     Coordinates of the Mark, for older element formats that don't have the mark as part of the Element line.

Net
---

     Net ("Name" "Style") (
        ... connects ...
     )

Name
     The name of this net.

Style
     The routing style that should be used when autorouting this net.

Netlist
-------

     Netlist ( ) (
        ... nets ...
     )

Pad
---

     Pad [rX1 rY1 rX2 rY2 Thickness Clearance Mask "Name" "Number" SFlags]
     Pad (rX1 rY1 rX2 rY2 Thickness Clearance Mask "Name" "Number" NFlags)
     Pad (aX1 aY1 aX2 aY2 Thickness "Name" "Number" NFlags)
     Pad (aX1 aY1 aX2 aY2 Thickness "Name" NFlags)

rX1 rY1 rX2 rY2
     Coordinates of the endpoints of the pad, relative to the element's mark.  Note that the copper extends beyond these coordinates by half the thickness.  To make a square or round pad, specify the same coordinate twice.

aX1 aY1 aX2 aY2
     Same, but absolute coordinates of the endpoints of the pad.

Thickness
     width of the pad.

Clearance
     add to thickness to get clearance width.

Mask
     width of solder mask opening.

Name
     name of pin

Number
     number of pin

SFlags
     symbolic or numerical flags

NFlags
     numerical flags only

PCB
---

     PCB ["Name" Width Height]
     PCB ("Name" Width Height]
     PCB ("Name")

Name
     Name of the PCB project

Width Height
     Size of the board

If you don't specify the size of the board, a very large default is chosen.

Pin
---

     Pin [rX rY Thickness Clearance Mask Drill "Name" "Number" SFlags]
     Pin (rX rY Thickness Clearance Mask Drill "Name" "Number" NFlags)
     Pin (aX aY Thickness Drill "Name" "Number" NFlags)
     Pin (aX aY Thickness Drill "Name" NFlags)
     Pin (aX aY Thickness "Name" NFlags)

rX rY
     coordinates of center, relative to the element's mark

aX aY
     absolute coordinates of center.

Thickness
     outer diameter of copper annulus

Clearance
     add to thickness to get clearance diameter

Mask
     diameter of solder mask opening

Drill
     diameter of drill

Name
     name of pin

Number
     number of pin

SFlags
     symbolic or numerical flags

NFlags
     numerical flags only

Polygon
-------

     Polygon (SFlags) (
        ... (X Y) ...
        ... [X Y] ...
     )

SFlags
     Symbolic or numeric flags.

X Y
     Coordinates of each vertex.  You must list at least three coordinates.

Rat
---

     Rat [X1 Y1 Group1 X2 Y2 Group2 SFlags]
     Rat (X1 Y1 Group1 X2 Y2 Group2 NFlags)

X1 Y1 X2 Y2
     The endpoints of the rat line.

Group1 Group2
     The layer group each end is connected on.

SFlags
     Symbolic or numeric flags.

NFlags
     Numeric flags.

Styles
------

     Styles("String")

String

     Encodes the four routing styles pcb knows about.  The four styles are separated by colons.  Each style consists of five parameters as follows:

     Name
          The name of the style.

     Thickness
          Width of lines and arcs.

     Diameter
          Copper diameter of pins and vias.

     Drill
          Drill diameter of pins and vias.

     Keepaway
          Minimum spacing to other nets.  If omitted, 10 mils is the default.

     Styles("Signal,10,40,20:Power,25,60,35:Fat,40,60,35:Skinny,8,36,20")
     Styles["Logic,1000,3600,2000,1000:Power,2500,6000,3500,1000:
        Line,4000,6000,3500,1000:Breakout,600,2402,1181,600"]

Note that strings in actual files cannot span lines; the above example is split across lines only to make it readable.

Symbol
------

     Symbol [Char Delta] (
     Symbol (Char Delta) (
        ... symbol lines ...
     )

Char
     The character or numerical character value this symbol represents. Characters must be in single quotes.

Delta
     Additional space to allow after this character.

SymbolLine
----------

     SymbolLine [X1 Y1 X2 Y1 Thickness]
     SymbolLine (X1 Y1 X2 Y1 Thickness)

X1 Y1 X2 Y2
     The endpoints of this line.

Thickness
     The width of this line.

Text
----

     Text [X Y Direction Scale "String" SFlags]
     Text (X Y Direction Scale "String" NFlags)
     Text (X Y Direction "String" NFlags)

X Y
     The location of the upper left corner of the text.

Direction
     0 means text is drawn left to right, 1 means up, 2 means right to left (i.e. upside down), and 3 means down.

Scale
     Size of the text, as a percentage of the ``default'' size of of the font (the default font is about 40 mils high).  Default is 100 (40 mils).

String
     The string to draw.

SFlags
     Symbolic or numeric flags.

NFlags
     Numeric flags.

Thermal
-------

     Thermal [Scale]

Scale
     Relative size of thermal fingers.  A value of 1.0 makes the finger width twice the annulus width (copper diameter minus drill diameter).  The normal value is 0.5.

Via
---

     Via [X Y Thickness Clearance Mask Drill "Name" SFlags]
     Via (X Y Thickness Clearance Mask Drill "Name" NFlags)
     Via (X Y Thickness Clearance Drill "Name" NFlags)
     Via (X Y Thickness Drill "Name" NFlags)
     Via (X Y Thickness "Name" NFlags)

X Y
     coordinates of center

Thickness
     outer diameter of copper annulus

Clearance
     add to thickness to get clearance diameter

Mask
     diameter of solder mask opening

Drill
     diameter of drill

Name
     string, name of via (vias have names?)

SFlags
     symbolic or numerical flags

NFlags
     numerical flags only

Object Flags
============

Note that object flags can be given numerically (like 0x0147) or symbolically (like "found,showname,square".  Some numeric values are reused for different object types.  The table below lists the numeric value followed by the symbolic name.

0x0001 pin
     If set, this object is a pin.  This flag is for internal use only.

0x0002 via
     Likewise, for vias.

0x0004 found
     If set, this object has been found by FindConnection().

0x0008 hole
     For pins and vias, this flag means that the pin or via is a hole without a copper annulus.

0x0010 rat
     If set for a line, indicates that this line is a rat line instead of a copper trace.

0x0010 pininpoly
     For pins and pads, this flag is used internally to indicate that the pin or pad overlaps a polygon on some layer.

0x0010 clearpoly
     For polygons, this flag means that pins and vias will normally clear these polygons (thus, thermals are required for electrical connection).  When clear, polygons will solidly connect to pins and vias.

0x0010 hidename
     For elements, when set the name of the element is hidden.

0x0020 showname
     For elements, when set the names of pins are shown.

0x0020 clearline
     For lines and arcs, the line/arc will clear polygons instead of connecting to them.

0x0040 selected
     Set when the object is selected.

0x0080 onsolder
     For elements and pads, indicates that they are on the solder side.

0x0080 auto
     For lines and vias, indicates that these were created by the autorouter.

0x0100 square
     For pins and pads, indicates a square (vs round) pin/pad.

0x0200 rubberend
     For lines, used internally for rubber band moves.

0x0200 warn
     For pins, vias, and pads, set to indicate a warning.

0x0400 usetherm
     Obsolete, indicates that pins/vias should be drawn with thermal fingers.

0x0400
     Obsolete, old files used this to indicate lines drawn on silk.

0x0800 octagon
     Draw pins and vias as octagons.

0x1000 drc
     Set for objects that fail DRC.

0x2000 lock
     Set for locked objects.

0x4000 edge2
     For pads, indicates that the second point is closer to the edge.  For pins, indicates that the pin is closer to a horizontal edge and thus pinout text should be vertical.

PCBFlags
========

0x00001
     Pinout displays pin numbers instead of pin names.

0x00002
     Use local reference for moves, by setting the mark at the beginning of each move.

0x00004
     When set, only polygons and their clearances are drawn, to see if polygons have isolated regions.

0x00008
     Display DRC region on crosshair.

0x00010
     Do all move, mirror, rotate with rubberband connections.

0x00020
     Display descriptions of elements, instead of refdes.

0x00040
     Display names of elements, instead of refdes.

0x00080
     Auto-DRC flag.  When set, PCB doesn't let you place copper that violates DRC.

0x00100
     Enable 'all-direction' lines.

0x00200
     Switch starting angle after each click.

0x00400
     Force unique names on board.

0x00800
     New lines/arc clear polygons.

0x01000
     Crosshair snaps to pins and pads.

0x02000
     Show the solder mask layer.

0x04000
     Draw with thin lines.

0x08000
     Move items orthogonally.

0x10000
     Draw autoroute paths real-time.