Noo-D(l)eus Ex Machina - Freeform PCB design proto

The very first prototype PCB testing the new pcb-rnd->FidoCadJ->pcb-rnd toolchain easing freeform bezier & cubic spline track/PCB creation.

Similar projects worth following
A longstanding desire of mine has been to improve the ease with which cubic splines and cubic bezier derived tracks can be implemented in PCB layouts. My preferred layout editor is pcb-rnd, a fork of the gEDA PCB project.

Recent development efforts with pcb-rnd include modular import/export infrastructure, including KiCad, various autorouter formats and also netlist import from tools such as TinyCad and LT-Spice, in addition to the gEDA schematic tool gschem.

FidoCadJ is a simple and efficient cross platform Java layout and schematic design tool, prompting the addition of FidoCadJ layout export to pcb-rnd.

With this new capability available, I decided to tackle an export module within FidoCadJ to pcb-rnd. FidoCadJ lacks Gerber export... so... I thought, what better way to stress test the free form track layout capabilities of the new pcb-rnd -> FidoCadJ -> pcb-rnd toolchain than to do a board depicting his extraterrestrial noodliness... the FSM?

Free form trackwork employing beziers or cubic splines in the usual FOSS/crippleware EDA offerings is not trivial.

Part of the difficulty stems from the Gerber format (which an PCB destined for manufacture will typically end up being represented by) supporting arcs, polygons and lines, and flashed apertures, but not beziers or cubic splines.

Some of the more dedicated practitioners of the art use graphic design tools such as InkScape to generate the paths required for the layout, and then convert them with various scripts to layouts.

Obvious difficulties with this include scaling, and representing the basic layout in Inkscape as a template against which tracks can be laid. Additionally, desktop publishing and graphic design tools don't usually come with useful libraries of component footprints.

My usual PCB layout editor is pcb-rnd, a fork of the gEDA PCB layout tool.

The pcb-rnd project has been on a bit of an import/export module frenzy lately, and when FidoCadJ was stumbled upon, the natural thing to do was to implement an export module to FidoCadJ layout format.

FidoCadJ is an easy to use cross platform Java application that allows schematic creation and also PCB board layout. It has a 5mil grid, and a good library of basic footprints. It is a successor to FidoCad, a C++ program first used in the 90s in Italy to share schematic and layouts on Usenet in a compact format.

FidoCadj exports in a variety of formats, including SVG, pdf, and ps, but lacks Gerber output. It does, however, natively support cubic beziers and cubic splines.

Excited by the possibility of a very natural and simple method of achieving freeform, artistic track and outline design on PCB layouts, the logical thing was to add an export module to FidoCadJ to export pcb-rnd/PCB (.pcb) layouts which would include the beziers and cubic splines converted to line elements.

The FidoCadJ repo was cloned locally, and emacs was fired up.

The FidoCadj code is very nicely structured, and I was able to use an unpopulated skeleton for an Eagle export module that was there as a basis for the gEDA exporter.

FidoCadJ is interesting as it expresses footprints and symbols as a one line "macro", which is defined in libraries. Default standard library macros are not routinely "exploded" on saving, but non-standard, local macros can be.

The FidoCadj exporter code allows macros to be dealt with by the exporter module, or "exploded" into primitives by the Export "overseer" code which can then be submitted individually for processing by the currently invoked exporter.

In the case of gEDA pcb-rnd/PCB, footprints primitives are not a subset of the layout elements, and have slightly different formatting. For this reason, the exporter code has to explicitly deal with the full macro definition and do its own parsing, returning footprint appropriate primitives wrapped in a single footprint Element[]() wrapper in the layout file.

Once this was appreciated, implementation of the exporter proceeded smoothly.

A motivated Java coder could implement a similar exporter for KiCad if keen, but pcb-rnd exports to Kicad anyway, and can be run headless as a command line batch conversion utility, so it would now be a bit of a duplication of effort for a KiCad user to code an exporter in FidoCadJ.

I will post the FidoCadj exporter code once I have cleaned it up to suit the FidoCadJ style guide, at which time I will also submit it to the git project itself.

Import and export code requires testing, and to test the newly implemented, a suitable layout was conceived.


Initial layout in gEDA pcb-rnd/PCB (.pcb) format. 50mm x 100mm board outline done in pcb-rnd to set constraints. The layout was then exported to FidoCadJ format. Freeform design of outline layer, silk screen and tracks on top and bottom copper done within FidoCadJ. At this point the design was exported back to gEDA pcb-rnd/PCB format for final touches and export to gerber for manufacture.

x-pcb-layout - 965.05 kB - 02/17/2017 at 15:18


View file

  • PCb's ordered and paid for

    a10391815 hours ago 0 comments

    The board was designed with my usual PCB fab, Hackvana, in mind, since Hackvana have specials that apply to 50mm x 50mm, 50mm x 100mm, and 100mm x100mm sizes, or sizes that fit within these dimensions Accordingly, the board fits within 50mm x 100mm.

    Hackvana reviewed the gerbers and shceduled the job for manufacture this week. If I'm lucky, I'll have the board within a week, using DHL for freight.

    The next step will be blinkenlights and some quick and dirty AtTiny coding.

    Until the boards arrive, I think I'll refine the export module in terms of automatic footprint rotation on export, and better default silkscreen widths in the footprints..

    The FidoCadJ export module in the layout editor pcb-rnd also deserves some further round trip testing,

  • First FidoCadJ code submission ready

    a1039181a day ago 0 comments

    The style check now passes without errors, so it's time to send the git diff to the lead dev for FidoCadJ, along with the new pcb-rnd exporter module.

    The changes to the FidoCadJ code add the export option to the menu system, and allow the Export routine to call the new code.

    the pcb-rnd exporter module handles the conversion from the internal data structure to the pcb-rnd export file.

    The flying spaghetti monster continues to export properly, and the circuit layer in FidoCadJ ends up on bottom silk, as planned, in pcb-rnd.

    Testing has confirmed that cubic splines consisting of only two vertices now export to a pcb-rnd layout as a single line segment, keeping the exported file ore compact.

    FidoCadJ users now have access to not only gerber export from pcb-rnd, but also g-code.

    Thinking ahead, FidoCadJ is likely to be an ideal tool for stroked (centreline defined) font design, i.e. Hershey Family/Engraving/Milling/PCB/EggBot fonts.... but first, we need to confirm that the exported PCB is manufacturable, as intended....

  • Further optimisation of FidoCadJ export code

    a10391812 days ago 0 comments

    The exporter now simplifies cubic splines with only two vertices by replacing them with an equivalent single line segment.

    FidoCadJ includes a style guide for use with codecheck.

    I just ran codecheck on my export module....

    ~/Source/FidoCadJ/dev_tools$ ./ ../../CodeAnalysis/checkstyle/checkstyle-6.10-all.jar


    Checkstyle results stored in fidocadj_check.txt
    lines on fidocadj_check.txt
    1080 fidocadj_check.txt

    I'd better sort out those indented sections and braces....

    Am still wondering about how best to implement footprint rotation...

View all 3 project logs

Enjoy this project?



Does this project spark your interest?

Become a member to follow this project and never miss any updates