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

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.

Tuesday, 6 June 2017

Using existing pcb layouts as footprint element libraries in pcb-rnd

Recent additions to the modular import and export code in pcb-rnd have allowed for existing pcb layouts to now be used as footprint element libraries.

This is likely to be of use in computer labs, organisations maintaining multiple seats with version controlled design elements, and also handy for distributing design element libraries generally.

The preferences dialogue allows various sources of design elements to be specified, such as wget for gedasymbols.org, the EDA agnostic edakrill repository, local directories, scripted elements in pcblib, and now board layout files.

As shown in the screen shot, the path to the file is prepended with


Here is a simple example of the "i" insert element dialogue box, with a native pcb-rnd lihata (.lht) board layout being used as a source of footprints on a new layout:

The code allows any supported board format to serve as a source of design elements; here is another example of the insert element dialogue, this time using a board layout in gEDA PCB's (.pcb) format:

Testing of this new feature with more exotic board types would be appreciated, such as Kicad and Eagle XML layouts, so that any corner cases can be identified and dealt with.

Wednesday, 31 May 2017

New routing options in pcb-rnd including angle-preserving rubber band and curvy knees on silk and copper

Recent refinement of the pcb-rnd rubber band code has allowed a radius to be specified (other than the default of zero radius) when routing tracks.

The key commands:




are used to alter the radius used for bends in the track being routed. These settings can also be adjusted in the preferences dialog.

With this capability, free-form, artistic trackwork is easier without needing other vector drawing utilities for copper, silk and outline layer features.

The following creation was done quickly and easily in pcb-rnd without needing to use any svg or similar vector artwork as a preliminary source of contours, thanks to the new radiused rubber band feature:

DJ Delorie's teardrop code is a longstanding plugin available for both pcb-rnd and gEDA PCB. The teardrops() plugin is enabled in pcb-rnd by default.

Beyond the merely artistic, this "banana mode" ability is also of interest to those routing RF and high speed signals on their PCB.

DRC can auto enforce clearances around other features while rubber banding as well, as seen in the videos below.

Here is the angle preserving rubber band mode.


Here is the bendy knee support in action.


And here is the teardrop effect being applied with the ":" key, followed by the




Monday, 8 May 2017

pcb-rnd now has native support for Eagle XML (.brd) PCB layout import

Taking advantage of the modular import/export infrastructure in pcb-rnd that was first exploited for KiCad s-expression and KiCad legacy layout support, an IO module has recently been developed to allow native import of Eagle XML (.brd) layout files.

This is a significant milestone as it allows recovery of archived Eagle XML designs by existing or previous Eagle users, as well as facilitating continued distribution and use of open hardware designs originally designed in Eagle and then shared with the maker/OSHW community.

Here is an example, an Eagle XML format OSHW design, namely, the Replicape A4, from:


loaded directly into pcb-rnd:

Further testing is needed to refine text scaling and validate element placement/rotation routines.

Users are invited to experiment and make feature requests or report any issues.

Sunday, 16 April 2017

Bitmap import now supported by pcb-rnd, including Easter eggs

Support for parametric footprints within pcb-rnd, the gEDA PCB fork, now allows on the fly insertion of any graphic file type as a silkscreen bitmap, including easter egg depictions, of course, that are supported by the netpbm package that the bitmap() script depends on.

At this point in time, netpbm supports:

bmp, fiasco, fits, gem, gif, jpeg, palm, ps, rast, rle, sgi, sir, tiff, xwd, zeiss, png

which means that any of these image formats can be inserted, on the fly, into a pcb-rnd PCB layout as a bitmap.

The bitmap() script can be found on the edakrill repository.

The script files need to be installed in the search path for parametric footprint elements, i.e.


The footprint insertion dialogue is invoked with the usual "i" command, at which point the path to the image can be entered into the bitmap() footprint dialogue as follows, along with pixel size details:

At which point the graphic is turned into an element in the buffer:

Which can then be placed on the layout:

This is a somewhat simpler way of inserting images than other workflows including the use of pstoedit or image2footprint, previously described, which are used standalone to generate the layout element for subsequent insertion into the PCB layout.

Image size and resolution should be kept sensible, as the resulting footprint silkscreen elements will get quite big and bloat a layout if excessively high resolution images are used, and may encounter manufacturer limitations with minimum silkscreen dimensions, i.e. less than 6 or 8 mil, depending on the manufacturer.

Sunday, 9 April 2017

Line, Polygon and Arc objects now supported in pcb-rnd font glyphs

Further work on multiple font support in pcb-rnd  handling has  led to the addition of support for not just polygons within glyphs, but also arc objects. Until now, gEDA PCB and pcb-rnd have been limited to line objects only within glyphs.

pcb-rnd's   :FontEdit   code has been updated to allow arcs to be edited and saved by those wishing to create their own fonts or modify existing fonts. Those familiar with   :FontEdit   and   :FontSave   will appreciate the ability to use arcs when creating rounded glyphs in a new font:

Fonts with arc objects can be saved as standalone font files in pcb-rnd's new lihata (.lht) file format. These font files can then be easily shared, and loaded into a pcb-rnd layout with the font load window (CTRL-SHIFT-F).

Here is an example of an arc based default font, (default_arc.lht) alternative to the legacy default_font:


Multiple fonts can be used simultaneously in pcb-rnd; here is the traditional default_font shown above the arc based example font:

Advantages of the new arc-based font are more compact gerber export, and more compact font description files, since three or more lines can be replaced with just one arc description.

The traditional default_font remains the default font in pcb-rnd, but users are free to try out the example arc based font in the trunk/font directory in addition to the traditional default_font in the trunk/src directory if keen.

The default_arc.lht example arc based font is a working example of the new font file syntax, and can be referred to by those keen to design their own fonts.

Those crafting new font files in lihata (.lht) format should find the format quite human parseable, and need only note that hashes of the form

  ha:j {


which contain details for a particular glyph, in this case, "j", need have the character escaped if the hash refers to one of the following ASCII chars:

  {     }      \      :      ~     ;     =     &     #

and also ASCII 32, the space character, for lihata parsing to behave properly.

Examples of how to do this can be seen in the default_arc.lht example file, either by pulling down an svn copy of the repo, or browsing the repo online at


pcb-rnd also supports multiple font editing options with the updated   :FontEdit   code via the miantenance menu, allowing editing of the current font within a layouts, or editing of fonts residing on disk:

Thursday, 6 April 2017

QR code and code128 barcode support for PCB layouts now in pcb-rnd, the gEDA PCB fork

As part of the extensible parametric footprint support in the gEDA PCB fork, pcb-rnd, support for QR-codes and code128 barcodes on pcb layouts has been implemented.

The necessary awk scripts can be obtained from the EDAkrill repository, http://repo.hu/projects/edakrill/

Installation of the qrencode library on the machine running pcb-rnd is required.

A QR-code can be instantiated with a footprint attribute like:

 qr(hello world, 37.00mil)


 code128(hello world, 0.001m)

embedded in a netlist exported from a schematic. The dimension refers to the pixel size.

Of note, parametric footprints scripts are able to parse the usual dimension suffixes, i.e. mm, mil, dmil, cmil, in, um

Alternatively, and somewhat simpler, is to simply use the "i" element insertion dialogue within the layout editor to provide the text and pixel dimensions for insertion as a QR-code, i.e.

The QR-code text and pixel size can be selected, along with either high or low level error coding:

After this, the QR-code can be placed on the layout, like any footprint element:

and here's the QR-code with a bit of zoom applied...

Similarly, a code128 format barcode can be instantiated with a footprint attribute like:

  code128(hello world, 1000.00um)


  code128(hello world, 0.1cm)

or by instantiating the "i" insert element dialogue, i.e.

after the height, barcode bar width and text are defined, the element can be placed on the layout:

Like any footprint element, the text label can be resized and moved.

A footprint created this way can be saved from the buffer either before placement, or after copying into the buffer, if a standalone footprint is required, i.e. for importing into KiCad or frequent use.

Of note, the pairs of awk scripts that implement the qr() and code128() parametric footprints need to be placed in pcb-rnd's


directory, and can serve as templates for your own modifications or alternative parametric footprint types which will automatically show up in the element insertion dialogue on restarting pcb-rnd, if placed in this directory.

Over time, additional user contributed awk scripts for parametric footprints will also be available on edakrill, the new platform and  format agnostic EDA repository.