Patch to support Gerber X2 format: Extended metadata
Brought to you by:
spetm,
thepurlieu
This patch adds support for Gerber X2 to gerbv.
In practice, this prevents piles of spurious console errors as an X2 layer is loaded in.
Longer term X2 commands could be used to set the polarity of the layer properly, and to put copper layers in their stackup order by default.
Gerber X2 is so easy to implement, support is growing fast. Altium now outputs Gerber X2.
Example Gerber X2 format file.
Sorry, Bryce I can't accept this patch.
callbacks.c
It is not X2 support it is just a stub, and about window can't say it
yet. Also X2 metadata will be lost by gerbv on layer save, and for now
user even won't be warned.
X2 metadate should be saved if file is overwriten by gerbv.
gerber.c
printf() here is just for debug? It is useless for gerbv users.
I think X2 metadata can be shown in Analyse > Gerber window.
In "case A2I('T','F'):", I think "string" pointer should not change (and
be freed with g_free() before break), and other variable as pointer is
used in strcmp(). This is for similar use of "string" pointer as in other
case's in gerber.c file.
README
You should make separate patch with REAMDE changes about building gerbv
from git. And if you are not against log record in git log, patch file
should contain From: field with name and e-mail (git format-patch can
make this automatically).
Please, make patch with nicely formatted code.
String pointer cannot be freed directly, as program will crash.
X2 support is complete: there's almost nothing in X2 that gerbv needs
(unless you want to set the sort order). So it is in fact complete X2
support.
Remember Gerber X2 is Gerber X with a few extensions. It is not a new
format.
I will update patch, and add support for the upcoming extension to X2 that
the Ucamco developer just clued me into.
Yes it can: don't use "string" in strsep() , use other pointer.
How can anyone call lost metadate if file is saved as support?
Present situation is Gerbv reads X2 files, and strips X2 metadata. As such
this seems like an improvement.
A large fraction of Gerbv use is read only, so consider if it really is a
dealbreaker.
Sorry for garbled numbering, it is sourceforge contribution.
Here's an example Gerber X2 file, created from Altium.