← Back to team overview

kicad-developers team mailing list archive

Re: EDA in a better (open and free) world :-)]

 


I have a few things to say about Kicad's *.brd file format and all the
work that is being invested in it currently:

1) It is not self documenting. There is a tendency to think that
because it is ASCII, there are no secrets. While that may be true, in
Kicad's format, *there are also very few hints*. By comparison, an XML
file or a SPECCTRA DSN file has plenty of self documenting hints. For
example consider an XML attribute like

diam="12.5"

this is self documenting.

2) It is not arbitrarily extensible. Each extension of the format
requires too much careful design thought. By comparison, an XML file or
the DSN format is far more obvious, particularly when it comes to
nesting elements within elements.

3) All the work that is being done now on conversion programs which
write directly to the *.brd file format are precariously vulnerable to
any future change in the *.brd file format. I see recently that klui
wrote a drill diameter consolidator that spits out a revised *.brd
file. Well when and if the *.brd file format were to change, this
utility would instantaneously encounter a problem: its output files
would be obsolete, if not its input files. This is exactly the reason
I wrote the SPECCTRA code so that it is not an external program which
accessed a *.brd file. The truth is, my SPECCTRA work knows nothing of
the *.brd file format. It knows only of the internal memory
architecture of a BOARD tree, and in theory it is more immune from
changes in the *.brd format. While this is an argument that all
conversion programs should become integral to Kicad, following this path
to the extreme would lead to code bloat and quality degradation in my
opinion. So what is best? I think Python is the answer here. If we
had a stable memory/document model in PCBNEW, and a Python language
binding, then these conversion programs and utilities could be written
in Python and that code would *not be loaded unless it were needed*. So
it solves the code bloat problem, it solves the file format lock-in
problem.

I would suggest that if a file format change were to be done, that it be
done ASAP, and then the Python support be added ASAP, so folks could
start writing these conversion utilities to work on the document model
in memory rather than to/from disk.

What format would be better? A better format would have these qualities:

A) It would be largely self documenting.

B) It would be easily parsed with standard software tools.

C) It would have the capability to represent all the constructs in a PCB
design file, many of which are embodied in the SPECCTRA DSN spec. Not
all constructs would be present in each file, but the capacity to
represent them if needed is desirable.

Two 2 solution paths that should be in the discussion:

1) SPECCTRA DSN with exentions. The extensions would be for text and
for library references and any other required extension we would need.
We could use the same lexer and parser as we use now for the DSN files.

2) XML syntax wrapper around a grammar to be determined. I would
propose a SPECCTRA like grammar (wrapped in XML syntax instead of the
parentheses based DSN). We could use libxml2 or expat which are C++ XML
parsers.

Kicad has had a SVN repository for only a year now. So I would say that
it is just getting legs. It can and will take on more developers than
it has now.

*But adding developers without a common vision could lead to chaos.*
Therefore this discussion is important because it helps settle the
vision issue before the developers come in larger numbers.

The file format discussion becomes part of a larger vision for the
direction we want to take the project. Such a vision could be called a
roadmap.

Jean-Pierre, what are your thoughts on the current *.brd file format?
Would you want to stay with the current format forever, or possibly
change it?

Dick


Dick,
All you said is true.

Changes it pcbnew involve changes in .brd format.
.brd format is 15 years old, and was a compromise between a clear and
readable format (opposite to a binary format)
and the time to read a file (for a large boards) with PCs existing 15
years ago.

It can be changed now.
(We can to stay with the current format forever only if forever does not
take a long time to finish)
Which is mandatory is only the ability for a recent pcbnew version to
read all the old board designs.

I have no preference for XML syntax or SPECCTRA grammar.
But i know what are some features for a new format:

A) It would be largely self documenting. : mandatory.

B) It would be easily parsed with standard software tools. : Sure...

C) It would have the capability to represent all the constructs in a PCB
design file.
Not all constructs would be present in each file, but the capacity
to represent them if needed is desirable.
Obvious.

I can add:
Format must be easily human readable (Edif is not easily readable...)
Data must be coded without any reference to its internal representation
in kicad.

This means:

Obviously, sizes and positions can be coded in inches or mm but not in
internal units
diam="12.5mm" or diam="0.5inch"
or something like
unit=mm
diam="12.5"

other example:
angle = "34.0" and not angle = 340 like now

This is very important in others items like layers, flags, options:
layer[0] is bad, but
layer[copper] or layer.copper is better.
or something like:
layer[0] = copper
before using layer[0].

This is true for all items like pads vias, tracks with are on one or
more layers.
And of course mainly true to code flags and options (like pad shapes,
locked footprints, texts justification ...)

I also believe pcbnew internal units will be changed in a next future
from 1/10000 inch to a smaller unit (1/100000 inch or 1/10000 mm)
to handle properly small pad and track sizes in inches and mm because
modern components are smaller and smaller and use a small metric grid.
This also is a reason to change the .brd file format


--

Jean-Pierre CHARRAS








Follow ups