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:

pcb-rnd/trunk/src_plugins/export_xy/default_templ.h



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

pcb-rnd/trunk/src_plugins/export_xy/xy.c


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

   make

in

   pcb-rnd/trunk

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

    board@



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.