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

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.

    pcb-rnd/trunk/pcblib/parametric/

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

http://igor2.repo.hu/cgi-bin/minisvn.cgi?cmd=browse&repo=pcb-rnd&path=trunk

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)

or

 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)

or

  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

   trunk/pcblib/parametric

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.

Wednesday, 29 March 2017

ISO 3098 CAD compatible font support, dwarven rune, and Klingon support, in the gEDA PCB fork pcb-rnd

In keeping with the monthly feature release schedule for pcb-rnd, on April 1, 2017, the gEDA PCB fork pcb-rnd will release new features designed to enhance backwards compatibility, improve compliance with ISO  3098, and anticipate future needs of users.

The ASCII character set has been ported from the ISO 3098 compatible open font osifont to the new pcb-rnd polygonal glyph format, to allow its use in PCB layouts.

This complements the existing stroked default font, as well as the stroked Hershey Sans 1 Stroke Font, also available for use within pcb-rnd.

The commitment to ongoing support for legacy users has been cemented with the addition of a Runic font, believed to be popular among Numenoreans who, it is thought, continue to use awk, C89, and at times, scheme.

Looking forwards to future users, and in particular, the Treaty of Organia in 2267, a Klingon pIqaD HaSta font has also been ported to pcb-rnd.

pcb-rnd retains support for the traditional gEDA PCB font file format, as well as the new, more fully featured lihata (.lht) file format which supports lines, arcs and polygons within font glyphs.




Here's a screen shot of the exported gerber being viewed in the gerber viewer gerbv, showing dwarvish runes, Klingon, osifont, and the Hershey Sans One Stroke font.



The support for these fonts has been made possible by the multiple font support recently implemented in pcb-rnd, in addition to the newly implemented support for polygons within font glyphs in the new pcb-rnd lihata (.lht) file format used for both pcb layouts and font files.

Both stroked fonts and polygonal glyph fonts (.lht) are dealt with in the font browser window:




The new pcb-rnd file format even allows an individual refdes to have an individual font allocated, if required:


To join in on the fun, head on over and grab yourself a copy of pcb-rnd.

To convert truetype fonts into pcb-rnd compatible lihata font files, you'll need to use the Apache Batik utility ttf2svg to convert the desired glyphs to SVG glyphs.

These SVG glyphs can then be converted to a pcb-rnd compatible font file with the outlineFont2centrelineFont utility. The outlineFont2centrelineFont utility is still a work in progress, but it was used to generate the Klingon, Dwarven Rune and osifont files pretty quickly and easily. The outlineFont2centrelineFont README explains how to go about doing the conversion. All that remains to be done with it is automatic merging of inside and outside paths in truetype or svg glyphs (these were done manually for the fonts shown).

Over time, new fonts in legacy and/or lihata (pcb-rnd .lht) will be added to the new EDA tool agnostic repository, EDAkrill:

http://repo.hu/projects/edakrill/

The EDAkrill project is an effort to create a platform and toolchain agnostic repository of footprints, symbols, fonts and anything else EDA related.


Monday, 20 March 2017

Converting inkscape paths to pcb-rnd and gEDA PCB layouts, lines and footprint elements

Inkscape is a powerful FOSS vector graphics tool that allows editing of complex paths which can then be exported to various formats.

Being able to export paths to PCB layout software is useful for a number of reasons, such as enabling custom or artisanal board outlines and tracks to be implemented, such as the following flying spaghetti monster (FSM) designed with pcb-rnd and FidoCadJ:

 

or allowing intelligent design of exotic footprints like the following touch pad example:


After looking at an Inkscape HPGL export module written by Aaron Spike, a pair of python modules were written, based on the Inkscape's HPGL exporter.

These extension scripts are available from:

https://github.com/erichVK5/inkscape2pcb

and the *.py and *.inx scripts need to be copied (you'll probably need sudo / superuser privileges) into your local inkscape extensions folder, i.e.

/usr/share/inkscape/extensions

After starting Inkscape up again, and creating a design...


...you should have the options to export to both gEDA PCB footprint (.fp) format, and to pcb-rnd layout (.lht) format available in the "Save As:" menu:


The paths in the layout are automatically flattened and converted to line segments in the exporter:

Here's the exported layout being viewed in pcb-rnd, the fork of gEDA PCB:


And here's the layout exported as a footprint, being viewed in gEDA PCB.


Naturally, KiCad users can use the same scripts to export footprint designs, since KiCad can import gEDA PCB footprint (.fp) natively.

There may be scope to improve the code by implementing export of solid polygons, but more needs to be learned about Inkscape's internal data structures first.

Support for specifying line thickness has also been added to the export dialog, and can range from 8mil (default) to 250mil (mil being thousands of an inch, a.k.a. thou, a.k.a. 254 microns, a.k.a. 0.254mm). This is a fairly sane range of values, but the thickness can always be changed in gEDA PCB or pcb-rnd if necessary.




The scripts have been tested with "px" as the default unit of measurement in Inkscape. One "px" maps to one mil in gEDA PCB and pcb-rnd; users will need to confirm that exported dimensions are maintained when exporting; if not, the dpi setting could be experimented with for scaling during export.

In closing, it should be mentioned that accurate geometry in Inkscape is most easily achieved by individually clicking on nodes, and then manually entering their required coordinates.

Wednesday, 15 March 2017

Importing Mentor Graphics Design Capture netlists into gEDA pcb-rnd

In the continued effort to have pcb-rnd (the actively developed fork of the gEDA PCB layout tool) support additional import and export formats, the ability to import netlists from the Mentor Graphics Design Capture has now been added and tested.

Based on a set of example files supplied by a Mentor Graphics Design Capture user, import has been implemented following reverse engineering of the EDIF files supplied.

Of note, the importer does not use the old EDIF import code, relying instead on the s-expression parser library more recently developed for KiCad import.

The importer allows use of the native Mentor parts database, with a regex based translation table during import into pcb-rnd that translates Mentor's parts into pcb-rnd native footprint names. This can use any attribute of the input part and can generate the pcb footprint using parts of the input string,

e.g. there is a single rule that says if Part Name is Dummy_HDR 1x2 P:2.54mm, extract the "1x2" and the "P:2.54mm" sections and add attribute 

footprint=connector(1, 2, 2.54mm)

which is a valid pcb-rnd parametric footprint.

This feature allows those using the Mentor Graphics Design Capture for schematic design to then layout a PCB in pcb-rnd based on the exported schematic netlist. The supported export netlist format is a flattened EDF file.

Options for further development and improvements include attempts to import mentor footprints (i.e. geometry), and possibly attempts to import hierarchic netlists, with subsequent flattening within pcb-rnd.

Starting with a Mentor Graphics Design Capture schematic


the next step is to generate a netlist for importing by pcb-rnd based on the Mentor Graphics Design Capture schematic; the first thing is to open the utilities menu


In this menu, the option for exporting a netlist in EDIF format can be selected. In particular, the flattened schematic option must be selected:


If successful, an EDIF format netlist should be written to your filesystem:


The next step is to load the netlist file within pcb-rnd:






It is at this point the footprints should be seen on the layout, and connections can be viewed with the rats nest optimize 'o' button:


from here, PCB layout proceeds as usual, with, of course, the option of adding additional footprints with the insert 'i' command.


In closing, the pcb-rnd project is keen to enable a variety of workflows and foster interoperability between layout and design tools. If you have a preferred schematic design tool, or are considering a move away from an existing tool and would like to see the ability to import legacy designs, feel free to get in touch with the developers on irc.

Thursday, 9 March 2017

Exotic and complex footprint creation for gEDA PCB, pcb-rnd and KiCad pcbnew using FidoCadJ

Sometimes there are complex or exotic footprints that need to be made which are most easily achieved with bezier curve, cubic spline and ellipsoidal features in addition to the usual rectilinear elements.

A good example of one such footprint came up on the Kicad forums; a contact pad for use with rubber dome pushbutton switches which have a conductive underside which shorts out the gap in the exposed pad:


The fairly symmetrical design and filleted features are a natural fit for the cubic bezier, ellipsoid and cubic spline support in FidoCadJ, the no nonsense 2D cross platform CAD package which now has an export module for exporting these design features as line elements in a gEDA PCB / pcb-rnd layout.

The design was fairly quickly prototyped in FidoCadJ at a scale that suited the features. It should be noted that on export, FidoCadJ allows a magnification factor to be provided to allow the design to be magnified or shrunken, so the 5mil grid in FidoCadJ never becomes a limitation.

The design was executed on the "circuit" layer in FidoCadJ, since this is the default layer, and when exported to gEDA PCB / pcb-rnd format by the export module, is exported to the rear silk layer with 10mil lines by default.


After creating the outline and the interlocking features with cubic splines and lines, the internal, open portions were hatched with additional lines to act as fill. Following this, the layout was exported to a gEDA PCB / pcb-rnd (.pcb) layout using a magnification ratio of 0.18, which generated a footprint of the desired dimensions (~ 6mm round):


The exported layout was then loaded in pcb-rnd, the fork of gEDA PCB. The same process would work with mainline gEDA PCB.


The layout can be flipped in pcb-rnd / PCB with the tab key, if the underside is to be viewed, as above.

For an essentially round design such as this, a more uniformly contoured outer margin can be achieved by using an encircling ellipsoid, and deleting un-necessary line segments. This was ultimately done in this case, to create a more uniformly rounded appearance than cubic beziers were able to achieve.

Looking at the line elements from the front, the elements were selected with Alt-A, and then Ctrl-C was used to copy them into the buffer:


This design has point symmetry, enabling the copied elements to be mirrored twice, or rotated, to complete the other half of the footprint. The buffer contents were mirrored Left-Right:


and the buffer was then mirrored Up-Down:




The transformed buffer elements are then placed where they belong, completing the basic design. Some of the "fingers" were lengthened a little to fine tune the spacing, and any residual gaps in the hatched areas were filled with additional lines:



At this stage, the elements can be moved from the bottom silk layer to the front copper layer. First of all, the top copper layer needs to be selected in the layer list in the left dialogue of the gEDA PCB / pcb-rnd screen. Once the intended layer is selected, Alt-A is used to select all of the elements, and then "Shift-M" is used to move the elements to the top copper layer:


At this point, a KiCad pcbnew user can simply use the "Save As" dialogue to save the layout in either KiCad legacy or KiCad s-expression format, at which point it can be loaded into pcbnew for further manipulation:


gEDA users keen to create a gEDA PCB / pcb-rnd compatible footprint can proceed to do so by again using "Alt-A" to select all of the elements, followed by "Ctrl-X" to cut the elements to the buffer. Ensure the cursor is over an appropriate centroid or origin for the planned footprint - in this case the centre of the element was chosen for the mouse pointer location when "Ctrl-X" was used:


Using the "Buffer" menu, the buffer contents can be converted to a footprint with "Convert Buffer To Element" command:


Which results in the new element (footprint):


At this point the element can be saved to a footprint file:


Here's the final result, a footprint being viewed in pcb-rnd:



The remaining work required for use with a netlist and design rules checking is suitable numbering of the overlapping pads, to end up with two distinct electrical groups of pads, numbered either pad "1", or pad "2".

In a complex footprint design like this (ultimately with 401 distinct pads!), this is most easily achieved by loading the footprint into a text editor and doing some search and replace on the consecutively numbered pads.

Alternative approaches to creating a footprint like this would include using pstoedit, or tracing outlines in a utility like inkscape, and then exporting in a format compatible with one's preferred PCB layout editor or an intermediate conversion utility.

The method described is efficient, and appears to be the quickest and least painful method for complex curve creation in footprints at present.

It is worth noting that FidoCadJ now has support for loading a background image, which, with suitable scaling of the image prior to use, can provide a background template for duplication with cubic bezier, cubic spline, line and ellipsoidal elements.