Homebrew, open source, repurposed, hacked, software defined, open hardware

Friday, 15 December 2017

Importing Cadsoft Eagle Binary layouts and libraries into pcb-rnd

Further work has gone into pcb-rnd's


import/output plugin for Cadsoft Eagle layouts.

as a result, pcb-rnd can now import:

  • Eagle XML format layouts (.brd), i.e. version 6 and up, including netlist
  • Footprints in Eagle XML format libraries (.lib)
  • Eagle binary format layouts (.brd), i.e. versions 3, 4 and 5, including netlist
  • Footprints in Eagle binary format libraries (.lib)

With this new capability, existing OSHW designs and user contributed parts libraries can remain in the information commons without being fenced off by new changes to Eagle licensing.

As an example, here is the VK3AJG BC547 80m SSB transceiver design, loaded from an Eagle binary format layout (.brd) file made available by G4USP:

and here is a manufacturer supplied footprint for a 50mil spaced header that was only available in an Eagle binary library format:

and here is the same header after being exported in Kicad format and loaded into pcbnew:

And here is the legendary TV-be-gone PCB, found in Eagle binary format, and loaded into pcb-rnd:

These new capabilities are in SVN head currently, but will be in the next pcb-rnd package release due shortly.

Caveats include:

  • Eagle's occasional use of net names which are invalid in pcb-rnd, i.e. '-' for the ground net. These are changed to 'GND' on load if present.
  • Eagle's allows an element to be named '-', i.e. for a ground terminal. These are changed to 'HYPHEN' on load.
  • Thermals for features are indirectly defined in the Eagle file format with electrical nets, so thermals are not automatically generated on import at this point in time, but this could be implemented with more work, subject to user demand.
  • Further to this, an element, i.e. a decoupling capacitor, may have no clearance for one pin on a GND copper polygon, and the other pin may have no clearance for a VCC copper polygon. This can be achieved with padstacks, but the simpler option is to remove one of the pours, sort out the clearance on one of the pins for the remaining plane and proceed to connect the other pin based on the rat lines/DRC.
  • tDocu and bDocu layer features in elements are currently combined with silk layer features. Once pcb-rnd subcircuit refactoring is complete in the next development cycle, footprints will be able to support both silk and documentation layer features and the import-export plugins will be upgraded accordingly.

A loaded layout or library can be modified and/or saved in pcb-rnd's native file format, or exported into other supported formats which include:

  • Kicad s-expression and legacy
  • Protel Autotrax
  • gEDA PCB
  • FidoCadJ

allowing pcb-rnd to provide Eagle->gEDA PCB, Eagle->Kicad and Eagle->Protel Autotrax conversion if required, subject to any feature limitations in the target formats.

As with any of the other layout formats supported by pcb-rnd, an Eagle binary layout can be also be nominated for use as a library in pcb-rnd's preferences.

In closing, with native support for both Eagle layouts and libraries in pcb-rnd, the need for external utilities such as eagle2gedapcb or translate2geda or the various ulp scripts in existence for exporting to foreign formats from within Eagle is much reduced. It should also be noted that pcb-rnd can be run headless, allowing batch conversion of files from the command line.

Thanks also to LA3PNA for his help with example files!!

Friday, 8 September 2017

Importing HPGL plot data into pcb-rnd PCB layouts

HPGL support has now been added to pcb-rnd, allowing import of HPGL plot data exported from programs such as mechanical CAD packages and graphic design and page layout packages such as Inkscape.

HPGL, short for "Hewlett Packard Graphics Language", is a simple graphics language tailored to the needs of plotters, allowing multiple pens to be defined, along with paths, arcs, and pen up, and pen down commands.

The importer code will import an HPGL file into a PCB layout, allowing artwork to be added to copper layers, silkscreen layers, mask layers, or outline layers.

Importantly, the outline layer is used to define board shapes. If the board is to fit a selected enclosure, the geometry is commonly available in and manipulated with mechanical CAD software packages which can export HPGL.

Of particular note, pcb-rnd supports subtraction layer types, allowing artwork to be subtracted from soldermask, paste and silk layers to achieve more complicated effects.

Users keen to convert bitmaps to outlines can achieve this easily in Inkscape with the "convert bitmap to outline" function, followed by export in HPGL format.

The first step is to import the bitmap into Inkscape

The bitmap is then placed on the sheet:

The bitmap need to be selected with a mouse click:

Having done this, the bitmap can be converted to an outline:

The dialogue box even allows the bitmap to be inverted if required:

having traced the outline, the bitmap and the outline will be overlaid on the sheet

The bitmap can be deleted, leaving just the traced outline, at which point export to HPGL can be performed:

After exporting the paths to an HPGL file, the HPGL file can be imported into pcb-rnd

the HPGL data then appears in the paste buffer:

After clicking, the paste buffer contents appear on the active layer:

For those playing with Kicad's pcbnew layout editor, this code now provides a pathway for HPGL->Kicad PCB layout format, since pcb-rnd supports export to Kicad layout format.

For those exporting to a Kicad layout, this is as simple as a "Save As" in the File menu, and here is the exported layout in pcbnew: 

Multilayer combinations are obviously possible, which can then be combined into a single subcircuit if required:

In the above screenshot, subtraction layers have been added and can be seen in the layer list on the left.

Layers can be quickly and easily added to groups by either right clicking in the layer list on the left of the layout window. In addition, layers can also be added, along with manipulation of the layer stackup, in the preferences->layers dialogue window. This dynamic manipulation of the layer stackup is now possible thanks to the extensive layer refactoring previously undertaken in pcb-rnd.

The next packaged release of pcb-rnd will include the HPGL import code. For now, until then, it can be obtained from svn head and compiled.

The code that converts the HPGL data resides in a LGPL licensed C89 library called Libuhpgl. Libuhgpl is a small, portable library for parsing and generating HPGL data. It is suited to use in any software that can import or export 2d object models.

Wednesday, 19 July 2017

PolyHatch command for cross hatching polygons in pcb-rnd

During development of the Protel Autotrax/Easytrax layout format import/export plugin, a separate polygon helper plugin was also developed to facilitate conversion of complex polygons into cross hatched versions.

This allowed export of complex Polygons to Protel  Autotrax/Easytrax format, which only supports lines and rectangular solid fills.

Because the cross hatching routine is just another plugin, the command can be applied to any polygon in a layout, if the need arises.

The command is invoked with the usual colon typed at the keyboard, followed by the command

i.e. ":PolyHatch(interactive)"

To use the command, you need to have a polygon or polygons selected. Here, we are using a layout with open hardware logos to demonstrate:

First, you need to select a polygon to crosshatch. Here, we select a logo on the top silkscreen layer:

After issuing the command


the interactive dialog window appears:

The dialog allows the hatching style, clearances and spacing to be specified:

After hitting OK, the polygon will be crosshatched using the currently selected layer (in this example "Top component" copper), and the new cross hatched version of the polygon will appear in addition to the original polygon:

The still selected, original polygon can be deleted, leaving the cross hatched version. Note that the cross hatching has appeared on the currently selected top component copper layer, not the top silk layer of the original polygon:

Multiple polygons can be selected for simultaneous conversion, i.e:

Note also that we have switched the active layer to the Ground plane layer. We now invoke the :PolyHatch(interactive) command again

After deleting the selected original polygons which are not needed, we now find the cross hatched versions on the ground plane:

Free fills or copper pours are a more typical target for the PolyHatch cross hatching function.

Here is a top copper polygon drawn over a DIP footprint with some additional tracks with associated clearances:

The polygon is selected, and the :PolyHatch(interactive) command invoked:

After deleting the original selected polygon, we are left with a cross hatched ground plane:

It is worth noting that the "Rubberband" tracks placed with rubber band mode contain arcs, and that these arcs have had their clearances preserved, i.e. pcb-rnd, like gEDA PCB, supports DRC for arcs on copper layer.

In addition to facilitating export to legacy formats such as Protel Autotrax/Easytrax, the PolyHatch plugin is likely to be useful for creating capacitative sensors on PCB layouts, as well as facilitating more creative designs, i.e.

For those using Kicad, and lacking an easy means of crosshatching a polygon for use as a capacitative sensor or to modify transmission line impedance, pcb-rnd can load and export Kicad format layouts, greatly simplifying this task.

The above tennis racquets can be saved in Kicad s-expression format quite easily. The only caveat is that Kicad does not support arcs on copper, which were used for the racquet frames. After shifting the racquets to the silk layer (to get around Kicad's limitations with arcs) the layout can be exported with "File:Save As"

and then saved as a Kicad s-expression format layout

after which, the layout can be viewed in Kicad's pcbnew layout editor, complete with cross hatched polygons:

Friday, 7 July 2017

pcb-rnd support for Protel Autotrax / Easytrax layout file import and export

An additional import/export module has been developed in the FOSS PCB layout tool pcb-rnd to allow layouts in Protel Autotrax and Protel Easytrax formats to be imported and exported.

Protel Autotrax and Protel Easytrax were industry standard DOS based PCB design tools in the early 1990s. Protel Easytrax was a cut down version of Protel Autotrax. The more capable Protel Autotrax required a dongle to operate.

Altium recently released Protel Autotrax as freeware, and it still has something of a following among those familiar with it who are happy to continue using it in a DOS emulator. Arguably, those with low end hardware in educational or hackerspace contexts may still find Protel Autotrax quite adequate for PCB design stations, particularly now that subsequent conversion to multiple formats is possible with pcb-rnd.

The import/export feature will primarily be of use to those seeking to:
  • modify previously distributed Protel Autotrax and Easytrax designs in something other than the original Protel Autotrax software
  • use legacy Protel Autotrax and Easytrax designs sourced from others to generate gerbers for fabrication
  • export footprints and designs for existing Protel Autotrax users 
  • convert Protel Autotrax and Easytrax designs into any of the other formats supported by pcb-rnd, such as postscript, png, svg, gcode, XYRS, kicad legacy layouts, kicad s-expression layouts, etc...
  • convert old footprints in Protel Autotrax and Easytrax designs for use in more modern tools.
Netlists are also imported along with Protel Autotrax and Easytrax design  geometry.

Because Protel Autotrax and Easytrax only support rectangular polygonal copper pours, the exporter will export any complex, non-rectangular polygons in a design as an outline of the islands and holes, and cross hatch the interior.

Simple rectangular polygonal pours are however exported as standard Protel Autotrax/Easytrax rectangular "Free Fill" rectangles.

For lines, 90 degree arc segments, pads and pins, however, exporting to Protel Autotrax format will be essentially lossless, within the limitations of the 1 mil resolution of the Protel Autotrax/Easytrax format, and 90 degree quadrant arc support in the Protel Autotrax/Easytrax format

Protel Moiro Targets and Cross Hair targets are not supported on import.

Also, pins and vias with connection/clearance flags for the GND and POWER copper layers are not acted on. This will not be an issue for any designs which do not have dedicated GND and/or POWER copper layers.

"Multi" and "board" layer elements are combined with the top silk layer during import into pcb-rnd, as they are not explicitly supported as layer types in pcb-rnd.

"Keepout", which delineates the board outline and cutouts, is mapped to the outline layer in pcb-rnd.

For those keen to implement an importer for some other format, the io_autotrax code would serve as a good template for those keen to give rolling their own a go. Alternatively, if provided with sufficient, suitable examples and summary information for a given format, we can look at the feasibility of implementing the importer.

Here's a nixie clock layout from lupinesystems

Here's a PICAXE40 radio controller board loaded into pcb-rnd: 

Here's a QRP SSB 80m transceiver design loaded into pcb-rnd

This screenshot shows the netlists loaded along with a single board Z80 computer layout:

this screenshot of the SSB transceiver layout loaded into pcb-rnd shows how Autotrax users create pours without the use of polygons

Here's a VK3BHR LC-meter design developed in pcb-rnd:

and here it is after a round trip to and from Protel Autotrax format, showing how complex polygonal copper pours are replaced by outlines of the polygonal islands and holes by the exporter, which are then filled with cross hatching:

Here's another example with cross hatching applied to polygons on export:

after saving as Protel  Autotrax, and then loading it back into pcb-rnd, the crosshatching used in place of the complex polygonal copper pour can be seen:

And yeah, here is a q-meter layout by the inimitable VK5JST/VK5TR

And finally, a frequency meter by Dave Jones, yep.... that Dave Jones

Friday, 9 June 2017

template defined, multiple pick and place (PnP) xyrs file format support in pcb-rnd

Following interest by multiple users, the existing XYRS pick and place machine export code has been extended to allow

  • any one of various formats to be selected during export, and
  • formats to be easily defined by users with simple additions to two files, a template file and the main exporter
  • export formats including BOM and formats requiring per-pin and/or per-pad information, even up to details such as pad area for special finishes

The new formats are accessible through the usual export menu:

with which selection of the "XY" format presents the XYRS export format options and units for export:

For those keen to export a custom format, any new format can be defined in the following file:


The format is pretty self explanatory. The user simply needs to choose a new name for the export type, create suitable text header fields, and then decide on the order of exported values, and their separator.

Following this, the new exporter type must be added to the existing structure in the xy.c file


and then, to make the new exported format active, it has to be added to the switch statement further down in xy.c :

If ./configure has not already been run previously in pcb-rnd/trunk  it will need to be run, after which




is all that is needed to make the changes active.

Alternatively, if you have an example of a format you would like implemented in the exporter, someone on IRC will be able to help you implement it.

After Macrofab, TM220 and TM240 export were added to the exporter, KiCad .pos format was also implemented as a quick and easy demonstration of the template based configuration, and, as a bonus, allow the use of scripts written by KiCad users for further customisation of position files for multiple reel pick and place machines.

The OpenPnP project can use ordinary xyrs and KiCad .pos files, so pcb-rnd users should have no difficulty using OpenPnP software.

The default xyrs outputs and .pos outputs are also suitable for assemblers such as SmallBatchAssembly.

The main differences to note between formats
  • are clockwise vs anti-clockwise rotation specified in degrees 
  • the origin of rotation, i.e. what is zero degrees
  • where the origin of the board is, i.e. bottom-left vs upper-left corner, which affects the y-coordinate direction
  • delimiters, which can be commas, spaces or tabs
  • whether layers are called top and bottom, or 1 and 2, respectively
Once the requirements are known, any of these aspects can be tailored to suit the required format in the export template.

The only other cautionary note is that some default footprints may not adhere to the usual conventions relating to rotation and centroid, i.e.  pin 1 should be at the top or top left, and the coordinate centroid for the footprint should indeed be the centroid of the element.

Finally, if your default footprints' description and value fields are transposed, the exported xy file will also have these values transposed. As always, the quality of your final PCB will depend on the validity of the footprint elements you use.