Board File format. PCBNEW

update: aug, 03 2006

Rubriques:

1 - General Informations:

2 - Layer numbering:

3 - First line of description:

4 - $GENERAL

5 - $SHEETDESCR

6 - $SETUP block:

7 - $EQUIPOT

8 - $MODULE

8.1 - General description:

8.2 - Field Description:

8.3 - Drawings:

8.4 - Pad Descritions:

8.5 - $SHAPE3D

9 - $PAD

10 - Graphic items:

10.1 - $DRAWSEGMENT

10.1.1 - Line:

10.1.2 - Circle:

10.1.3 - Arc:

10.2 - $TEXTPCB

10.3 - $MIRE

10.4 - $COTATION

11 - Track, vias and Zone section:

11.1 - $TRACK

11.2 - $ZONE

12 - $EndBOARD


Board File Format

1 - General Informations:

First line is something as:

PCBNEW-BOARD Version 0 date 5/1/2005-14:45:23

All the following descriptions are like this:

$DESCRIPTION
some data
...
$endDESCRIPTION

Example:

$GENERAL
Ly 1FFF8001
Links 66
NoConn 0
Di 24940 20675 73708 40323
Ndraw 16
Ntrack 267
Nzone 1929
Nmodule 29
Nnets 26

$EndGENERAL

$SHEETDESCR
Sheet A4 11700 8267
Title ""
Date "23 feb 2004"
Rev ""
Comp ""
Comment1 ""
Comment2 ""
Comment3 ""
Comment4 ""

$EndSHEETDESCR

2 - Layer numbering:

Tracks and other items (texts, drawings ...) use one layer.
Pads and vias use several layers.
There are 16 copper layers and 12 technical layers.
The layer parametre used in descriptions has the value:

value

layer name

"Copper" layers

0

Copper layer

1 to 14

Inner layers

15

Component layer

16

Copper side adhesive layer

Technical layers

17

Component side adhesive layer

18

Copper side Solder paste layer

19

Component Solder paste layer

20

Copper side Silk screen layer

21

Component Silk screen layer

22

Copper side Solder mask layer

23

Component Solder mask layer

24

Draw layer (Used for general drawings)

25

Comment layer (Other layer used for general drawings)

26

ECO1 layer (Other layer used for general drawings)

26

ECO2 layer (Other layer used for general drawings)

27

Edge layer. Items on Edge layer are seen on all layers

Mask layer:

Sometimes, a mask layer parameter is used.

It is a 32 bits mask used to indicate a layer group usage (0 up to 32 layers).

A mask layer parameter is given in hexadecimal form.

Bit 0 is the copper layer, bit 1 is the inner 1 layer, and so on...(Bit 27 is the Edge layer).

Mask layer is the ORed mask of the used layers


3 - First line of description:

Format:

PCBNEW-BOARD Version <version number> date <date>-<time>

Date and time are useful only for information (not used by pcbnew).


4 - $GENERAL

This data is useful only when loading file.

It is used by pcbnew for displaying activity when loading data.

$GENERAL

Start description

Ly 1FFF8001

Obsolete (used for old pcbnew compatibility)

Links 66

Total number of connections

NoConn 0

Remaining connections

Di 24940 20675 73708 40323

Bounding box coordinates:

X_start Y_start X_end Y_end

Ndraw 16

Number of draw items like eged segments, texts...

Ntrack 267

Number of track segments

Nzone 1929

Number of zone segments

Nmodule 29

Number of modulss

Nnets 26

Number of nets

$EndGENERAL

End description


5 - $SHEETDESCR

This the page size and texts.

$SHEETDESCR

Start description

Sheet A4 11700 8267

<Page size> X_size Y_size in mils (1/1000 inch)

Title ""

Title text

Date "23 feb 2004"

Date text

Rev ""

Revision text

Comp ""

Company name text

Comment1 ""

Comment text, line 1

Comment2 ""

Comment text, line 2

Comment3 ""

Comment text, line 3

Comment4 ""

Comment text, line 4

$EndSHEETDESCR

End description


6 - $SETUP block:

This data bock is used for design settings

This is useful only for board edition.

$SETUP

Start block "SETUP"

InternalUnit 0.000100 INCH

Internal unit for pcbnew, all coordinates are in

this unit

GridSize 500 500

Current grid X Y size (500 x 500 units)

ZoneGridSize 100

Grid used for zone filling (100 units, i.e 0.01 inch)

Layers 2

Number of layers (2 = double sided board)

must be 1 to 16

TrackWidth 250

Current track width

TrackWidthHistory 170

Last used track widths

TrackWidthHistory 250

TrackWidthHistory 400

TrackClearence 100

Isolation for DRC (Design rules check)

ZoneClearence 200

Isolation used in zone filling

DrawSegmWidth 120

Current segment width for drawings on technical layers

EdgeSegmWidth 120

Current segment width for drawings on "edge layer"

ViaSize 700

Current via size

ViaDrill 250

Via drill for this board

ViaSizeHistory 450

Last used via sizes

ViaSizeHistory 650

ViaSizeHistory 700

TextPcbWidth 120

Current text width for texts on copper or technical layers. This is not for text on footprints

TextPcbSize 600 600

Current text X Y size

EdgeModWidth 120

Current Segment width for footprint edition

TextModSize 120 600

Current text XY size for texts for footprint edition

TextModWidth 120

Current text width for texts for footprint edition

PadSize 700 700

Current X Y pad size (footprint edition)

PadDrill 320

Current pad drill

AuxiliaryAxisOrg 0 0

Auxiliary axis position

(Auxiliary axis is the reference coordinate (0 0 coordinate) for EXCELLON drilling files

$EndSETUP

End block "SETUP"


7 - $EQUIPOT

$EQUIPOT describes a net name.

$EQUIPOT

Start block

Na 2 "N-000026"

Na <internal net number> « net name »

St ~


$EndEQUIPOT

End block

Note1:

Internal net number is an arbitrary number.

It is computed by pcbnew when compiling netlist.

Note2:

Net 0 is not a real net.

Net 0 is the net number used internally by pcbnew for all the no connected pads.


Example:

$EQUIPOT;

Na 0 ""

St ~

$EndEQUIPOT$EQUIPOT

Na 1 "DONE"

St ~

$EndEQUIPOT

$EQUIPOT

Na 2 "N-000026"

St ~

$EndEQUIPOT

$EQUIPOT

Na 3 "TD0/PROG"

St ~

$EndEQUIPOT

8 - $MODULE

Decription =start by:

$MODULE <module name>

And ends with

$EndMODULE <module name>

Module description has four sections:

  1. General description (fixed size)

  2. Field description (variable size)

  3. Drawing description (variable size)

  4. Pad description. (variable size)

  5. 3D shape informations.

Note:

All coordinates are relative to the module position.

Its means the coordinates of segments, pads, texts ... are given for a module in position 0, rotation 0.

If a module is rotated or mirrored, real coordinates must be computed according to the real position and rotation.

8.1 - General description:

$MODULE bornier6

$MODULE <module lib name>

Po 62000 30500 2700 15 3EC0C28A 3EBF830C ~~

Po Xpos Ypos Orientation(0.1deg) Layer TimeStamp Attribut1Attribut2

Attribut1 = ~or 'F' for autoplace (F = Fixed, ~= moveable)

Attribut2 = ~or 'P' for autoplace (P = autoplaced)

Li bornier6

Li <module lib name>

Cd Bornier d'alimentation 4 pins

Cd comment description (displayed when browsing libraries)

Kw DEV

Kw Keyword1 Keyword2 ... (for footprint selection by keywords)

Sc 3EBF830C

Sc TimeStampOp

Op 0 0 0

Op <rotation cost 90 deg> <rotation cost 180 deg> for auto place.

rotation cost = 0 (no rotation allowed) to 10 (null cost)

Note:

Usually, components are on layer 15 (component layer) or 0 (copper layer).

If the component is on layer 0, it is"mirrored". The "mirror axis is the X axis

8.2 - Field Description:

There are 2 to 12 fields

Field 0 = component reference (U1, R5 ...) (required)

Field 1 = component value (10K, 74LS02 ...) (required)

Other fields (optional) are comments.

Format:

T<field number> Xpos Ypos Xsize Ysize "text"


T0 500 -3000 1030 629 2700 120 N V 21 "P1"

Xpos Ypos Xsize Ysize "text"

T0 = reference

T1 0 3000 1201 825 2700 120 N V 21 "CONN_6"

T1 = value


8.3 - Drawings:

Tells how to draw module shape.

Drawings are segment, circle, arc.

DS -6000 -1500 -6000 1500 120 21

DS is a Draw Segment

DS Xstart Ystart Xend Yend Width Layer

DS 6000 1500 6000 -1500 120 21

An other Draw Segment


Other Drawings are:

DC ox oy fx fy w

DC is a Draw Circle

DC Xcentre Ycentre Xpoint Ypoint Width Layer

DA x0 y0 x1 y1 angle width layer

DA is a Draw Arc

X0,y0 = Start point x1,y1 = end point


8.4 - Pad Descritions:

All the pads of this footprint are listed here (Many $PAD/$EndPAD sections here)..

See $PAD description.

8.5 - $SHAPE3D

3D shape informations:

The real shape description is a vrml file, build by Wings3d.

This shape can be scaled, moved and rotated.

This is because a single 3D shape can be used for many footprints (for instance, we use the shape resistor.wrl for several resistor footprints, by tuning the X, Y, Z scale of the 3D shape according to the different size of resistor footprints).

Some smd footprints are using this feature.

For the same reasons, the 3D shape can be moved (by the move factor) and/or rotated.

Real shape unit is 0.1 inch (1 unit vrml = 0.1 inch = 2.54 millimeter).

An other reason exists: when a footprint is very big ( a big connector) or very small (a small SMD resitor) whe must create a 3D shape small or bigger than real size, in order to use easily the 3D modeler.


$SHAPE3D

Start description

Na "device/bornier_6.wrl"

FileName (default path is kicad/modules/packages3d/)

Sc 1.000000 1.000000 1.000000

X Y Z scale factor

Of 0.000000 0.000000 0.000000

X Y Z offset (move vector, in 3D units (0.1 inch))

Ro 0.000000 0.000000 0.000000

X Y Z rotation (in degree)

$EndSHAPE3D

End description


The 3D shape coordinates are relative to the footprint coordinates.

The 3D shape must be scale, moved and rotated according to the parameters Sc Of and Ro,

and after moved and rotated according to the footprint coordinates and rotation.

If the footprint is « inverted » (that is, located on copper side) the 3D shape must be « inverted » too.

Note:

A footprint may have several 3D shapes (for instance an integrated circuit and his socket).


9 - $PAD

Pads have different shapes and attributes.

Pad shapes are:

Circle.

Oblong(or oval).

Rectangular (Square is like a rectangle).

Trapeze.

Pad attributes are:

And shape can be draw with an offset related to the drilling hole.

The hole shale is round or oblong

$PAD

Start description

Sh "2" C 1500 1500 0 0 2700

Shape: <pad name> shape Xsize Ysize Xdelta Ydelta Orientation

Dr 600 0 0

or (oblong hole)

Dr 600 0 0 O 600 650

Drill <Pad drill> Xoffset Yoffset (round hole)

or (oblong hole)

Drill <Pad drill.x> Xoffset Yoffset <Hole shape> <Pad drill.x> <Pad drill.y>

At STD N 00E0FFFF

Attributs: <Pad type> N <layer mask>

Ne 8 "GND"

Net reference of the pad: <netnumber> <net name>

Po -3000 0

X_pos Y_pos (relative to the module position)

$EndPAD

End description

Note:

<Pad type> is the Pad Attribute. It is one of: "STD" "SMD" "CONN" "HOLE" "MECA".

Shape is one of:

Hole shape = O (O for Oblong)


Example:

$PAD

Sh "3" C 1500 1500 0 0 2700

Dr 600 0 0

At STD N 00E0FFFF

Ne 10 "TD0_1"

Po -1000 0

$EndPAD

10 - Graphic items:

There are drawing items like segments, circles, texts, targets and cotations.

10.1 - $DRAWSEGMENT

Draw segments are :

10.1.1 - Line:

$DRAWSEGMENT

Start description

Po 0 67500 39000 65500 39000 120

Position shape Xstart Ystart Xend Yend width

De 28 0 900 0 0

Description layer type angle timestamp status

$EndDRAWSEGMENT

End description


Note:

10.1.2 - Circle:

$DRAWSEGMENT

Start description

Po 1 67500 39000 65500 39000 120

Position shape Xcentre Ycentre Xend Yend width

De 28 0 900 0 0

Description layer type angle timestamp status

$EndDRAWSEGMENT

End description

Note:

10.1.3 - Arc:

$DRAWSEGMENT

Start description

Po 2 67500 39000 65500 39000 120

Position shape Xstart Ystart Xend Yend width

De 28 0 900 0 0

Description layer type angle timestamp status

$EndDRAWSEGMENT

End description

Note:

Currently, only 90 degrees arcs are supported.(thereby, angle = 900)

Example:

$DRAWSEGMENT

Po 0 67500 34000 67500 39000 120

De 28 0 900 0 0

$EndDRAWSEGMENT

10.2 - $TEXTPCB

Example:

$TEXTPCB

Start description

Te "TDI"

Text "string"

Po 57250 35750 600 600 150 0

Position Xstart Ystart Xsize Ysize rotation

De 15 1 0 0

Description layer normal timestamp 0

normal = 0 : text is mirrored.

normal = 1 : text is normal.

$EndTEXTPCB

End description


Example:

$TEXTPCB

Te "TCK"

Po 57250 33500 600 600 150 0

De 15 1 0 0

$EndTEXTPCB

10.3 - $MIRE

shape 1

shape 0


$MIREPCB

Start description

Po 0 28 28000 51000 5000 150 00000000

Position shape Xpos Ypos size width timestamp

$EndMIREPCB

End description

10.4 - $COTATION


$COTATION

Start description

Ge 0 24 0

General shape layer timestamp

currently, shape = 0.

Te "4,5500''"

Text "string"

string is the cotation value in inches ou millimetres

Po 50250 5791 600 800 170 0 1

Position (for text) Xpos Ypos Xsize Ysize width orient normal

Sb 0 27500 6501 73000 6501 150

Coordinates of segments (axis, arrows...)

Sd 0 73000 9000 73000 5081 150

Sg 0 27500 9000 27500 5081 150

S1 0 73000 6501 72557 6731 150

S2 0 73000 6501 72557 6271 150

S3 0 27500 6501 27943 6731 150

S4 0 27500 6501 27943 6271 150

$EndCOTATION

End description


11 - Track, vias and Zone section:

11.1 - $TRACK

Track section decribes tracks and vias on copper layers.

Each track (or via) has a two line descrition:

For a track segment:

Position shape Xstart Ystart Xend Yend width

Description layer 0 netcode timestamp status

Shape parameter is set to 0 (reserved for future changes).

For a via:

Position shape Xstart Ystart Xend Yend diameter

Description layer 1 netcode timestamp status

For a via, layer parameter gives :

On the 4 less significant bits: the starting layer of the via

On the 4 next bits: the ending layer.

For instance, a via starting at copper kayer (layer 0) end ending at component layer (layer 15 has the layer parametre set to F0 hexadecimal or 240 decimal.

Shape parameter is the via type (through = 3, blind = 2, buried = 1)

Timestamp parameters are set to 0 (reserved for future changes).

Status parameter can be set to 0 (Used internally for routing infos)..


$TRACK

Start description

Po 0 36750 37000 36550 37000 250

Position shape Xstart Ystart Xend Yend width

width = diameter for a via

De 15 0 1 0 400

Description layer type netcode timestamp status

type = 0 for a track segment.

type = 1 for a via

Po 0 39000 36750 38750 37000 250

An other track

De 15 0 1 0 0

Po 3 53500 27000 53500 27000 650

This is a via (via "through") from layer 15 (component) to layer 0 (copper)

De 15 1 14 0 0

$EndTRACK

End description


11.2 - $ZONE

Zone section is like track section. (There is no via in Zone section).

$ZONE

Start description

Po 0 67100 33700 67100 38600 100

Same as track description

De 0 0 2 3EDDB09D 0

$EndZONE

End description


12 - $EndBOARD

$EndBOARD terminates the whole board description.

Must be the last line.


Page 12 - - 10