7.8 File Syntax
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 [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.
- 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 [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 [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 [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 [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 [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.
- Number
- A number, whose value is normally given in hex, individual bits of which
represent pcb-wide flags as defined in PCBFlags.
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.
- 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 (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 [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.
- X Y
- Coordinates of the Mark, for older element formats that don't have
the mark as part of the Element line.
Net ("Name" "Style") (
... connects ...
)
|
- Name
- The name of this net.
- Style
- The routing style that should be used when autorouting this net.
Netlist ( ) (
... nets ...
)
|
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 enpoints 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 enpoints 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 ["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 [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 (SFlags) (
... (X Y) ...
... [X Y] ...
)
|
- SFlags
- Symbolic or numeric flags.
- X Y
- Coordinates of each vertex. You must list at least three coordinates.
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.
- 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 [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 [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 [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.
- 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 [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