It goes without saying, that this is something we have all been waiting for since the dawn of UNIX and hierarchical file systems.
Finally, we now have the ability to mount a pcb layout as a virtual filesystem, allowing metadata to be inspected and modified from within the terminal, with scripts, or from within midnight commander... or even from within Emacs!
More observant readers will already have noted that someone using a single board computer can now mount the PCB layout of their single board computer on their single board computer filesystem and inspect their single board computer hardware from the command line of their single board computer.
Enough said! Down to business!
The first thing is to have a computer running some form of *nix. pcb-rnd will build on most systems, and supports motif, gtk and headless CLI operation. Importantly, for fuse filesystem export, you will need to be running a version of GNU/Linux with fuse support.
The next thing is to checkout svn head of pcb-rnd
This can be done from a terminal with
svn checkout svn://repo.hu/pcb-rnd/trunk
if you do not have subversion (svn) installed, and you are on a debian/ubuntu based system, you can use the following command first to install svn
sudo apt-get install svn
you should also install midnight commander, and the fuse development libraries which support userspace filesystems
sudo apt-get install mc libfuse-dev
once you have checked out pcb-rnd, do the following
cd pcb-rnd/trunk
./configure --buildin-export_vfs_fuse --buildin-export_vfs_mc
during configuration, you should see amidst the output, something like
FUSE VFS server yes, buildin [export_vfs_fuse]
GNU mc VFS server yes, buildin [export_vfs_mc]
if ./configure is successful, and dependencies are met, you can proceed to build with the following command
make
once built, you can try out the build, with
cd src
./pcb-rnd
The Fuse filesystem allows users to create their own filesystems in userspace. Most modern GNU/Linux distributions will have kernel support for fuse. If you have kernel support for fuse, you can now test fuse filesystem export.
Make a temporary mount point somewhere
mkdir /tmp/pcb-mnt
then mount your pcb onto the mount point!
./pcb-rnd -x vfs_fuse ~/foxhunt-attenuator/fox-attenuator-v1.lht /tmp/pcb-mnt
and now, you can go ahead and explore your pcb data
cd /tmp/pcb-mnt
ls
etc...
Of course, a file browser, a web browser, Emacs or midnight commander are much easier ways to explore the mounted fuse filesystem than using the CLI.
pcb-rnd can also load Eagle binary, Eagle XML and KiCad layouts, Protel Autotrax and respective footprints allowing similar inspection of metadata once loaded into pcb-rnd's data model.
If you do not have fuse support, then you can still play along with midnight commander. To inspect a board's metadata in midnight commander without using fuse, the following configuration files need to be set up.
Install the file
pcb-rnd/trunk/src_plugins/export_vfs_mc/upcb
in /usr/lib/mc/extfs.d
i.e. with the command
sudo cp pcb-rnd/trunk/src_plugins/export_vfs_mc/upcb /usr/lib/mc/extfs.d
Then add the following in mc.ext (which is usually found in /etc/mc/mc.ext) just above the final # Default section in mc.ext:
# PCB files
shell/.pcb
Open=%cd %p/upcb://
the above code determines which file endings are treated as mountable by midnight commander. In the example above, it is set to ".pcb"
The one remaining thing to do is to install the built version of pcb-rnd, so that midnight commander can launch it when required. You can do this from the pcb-rnd/trunk directory with the following command
sudo make install
On starting midnight commander, pcb layouts with matching file-endings will be automatically mounted, allowing the metadata to be traversed within the file browser.
Motivation:
Apart from the obvious motivation to impress your friends, coworkers and spouse, there are some very simple, slightly impractical, and arguably silly, script examples that demonstrate the power of this new capability, and how easy it is to access board metadata via a virtual filesystem.
Homebrew, open source, repurposed, hacked, software defined, open hardware
Monday, 1 April 2019
Saturday, 30 March 2019
Converting gerber to pcb layouts - improvements to translate2coralEDA
After getting around to long needed refactoring of translate2geda, the work in progress result is translate2coralEDA, which has cleaned up the code, as well as adding support for features that are not possible in either gEDA PCB or KiCad.
The code will be back-ported to translate2geda, with exported elements subject to the limitations of the gEDA PCB footprint format which will be the default for translate2geda.
The default export format for translate2coralEDA is pcb-rnd (.lht), which supports padstacks, polygonal copper pad shapes, as well as arcs on copper within footprints, which are called subcircuits in pcb-rnd.
Perhaps the best example of the support for new features in the data model is the improved gerber importing code, which can create pads from arbitrary polygonal shapes - subject to sanity checks on size and geometry - and import copper arcs as copper features rather than pads, within footprints (subcircuits).
Here is an example of the top copper layer from a recently designed Raspberry Pi WSPR shield for the 2m band, converted by translate2coralEDA from the top copper layer gerber into a footprint (.a.k.a. .lht subcircuit) which has then been loaded into pcb-rnd
Gerber import is subject to a number of caveats, namely, the data in a gerber file lacks logical grouping, and heuristics are used to try and identify pad or pin features. These heuristics will occasionally be fooled by islands of copper pour that are about the right size to be a pad or pin. These can easily be converted back into polygonal copper features within pcb-rnd however.
The most important caveat is that some EDA tools, like Eagle, paint the features with a raster of thin horizontal lines delineated by similar lines forming borders of copper shapes, making techniques such as this far less practical.
Accordingly, gerber conversion is a last resort and is really only for those keen to salvage design data, extract features, i.e. exotic footprints, or modify reference implementations for which only gerbers have been provided.
pcb-rnd can export to KiCad, Protel Autotrax and gEDA PCB formats, subject to the limitations of their respective data models.
For those wondering, the spiral inductor footprints were created with the SpiralInductorFootprintGenerator utility, also available on github.
The code will be back-ported to translate2geda, with exported elements subject to the limitations of the gEDA PCB footprint format which will be the default for translate2geda.
The default export format for translate2coralEDA is pcb-rnd (.lht), which supports padstacks, polygonal copper pad shapes, as well as arcs on copper within footprints, which are called subcircuits in pcb-rnd.
Perhaps the best example of the support for new features in the data model is the improved gerber importing code, which can create pads from arbitrary polygonal shapes - subject to sanity checks on size and geometry - and import copper arcs as copper features rather than pads, within footprints (subcircuits).
Here is an example of the top copper layer from a recently designed Raspberry Pi WSPR shield for the 2m band, converted by translate2coralEDA from the top copper layer gerber into a footprint (.a.k.a. .lht subcircuit) which has then been loaded into pcb-rnd
Gerber import is subject to a number of caveats, namely, the data in a gerber file lacks logical grouping, and heuristics are used to try and identify pad or pin features. These heuristics will occasionally be fooled by islands of copper pour that are about the right size to be a pad or pin. These can easily be converted back into polygonal copper features within pcb-rnd however.
The most important caveat is that some EDA tools, like Eagle, paint the features with a raster of thin horizontal lines delineated by similar lines forming borders of copper shapes, making techniques such as this far less practical.
Accordingly, gerber conversion is a last resort and is really only for those keen to salvage design data, extract features, i.e. exotic footprints, or modify reference implementations for which only gerbers have been provided.
pcb-rnd can export to KiCad, Protel Autotrax and gEDA PCB formats, subject to the limitations of their respective data models.
For those wondering, the spiral inductor footprints were created with the SpiralInductorFootprintGenerator utility, also available on github.
Subscribe to:
Posts (Atom)