pcb-rnd knowledge pool

 

DXF exporter rewrite

dxf1 by Tibor 'Igor2' Palinkas on 2017-08-29

Tags: announcement, dxf, export, format, rewrite

node source

 

 

Abstract: Original announcement on the DXF exporter rewrite.

  Imported from the mailing list archives.

1. What we have

pcb-rnd got a new dxf exporter. It exports the outline, plated drills, unplated drills, top copper, bottom copper, top silk and bottom silk; each of these in their own separate dxf layer. It is capable of exporting lines, arcs, holes, polygons (and this includes elements, texts, pins, pads, etc.).

The goal is not to provide a 100% reliable storage of PCB data, but to communicate with mechanical engineers who are interested in board dimensions and location of mounting holes.

The code is very young yet; known bugs are:

A sample board in the native .lht format, exported to the old .pcb format and .dxf and a png rendered with librecad (click for the soruce files):

DXF export rendered with librecad

The new feature is accessible from svn trunk; the next release in October will include it.

We've tested the output with librecad, freecad, solid works and aspire.

2. what we could have later - dxf importer, anyone interested?

In theory I could also write a basic, somewhat limited, strictly 2d dxf importer, if there's measurable active user demand (including will to contribute sample files on request).

This could be used for the other direction, when the mech eng designs the shape of the board and the location of the main components (e.g. connectors) and you want to import that for laying out the board around.

3. how it happened (full code rewrite)

This code is brand new. It does not depend on any external library. I started to write it from scratch yesterday. We used to have Bert's dxf HID, but that did not yield working output and it was large (4980 sloc vs. the new code that's only 520 sloc).

Before anyone says "not invented here syndrome": it took 5 and a half hours total, including the time I spent on understanding the basics of librecad and the dxf file format. I am sure fixing the ~5ksloc code would have taken a magnitude more. Learning the API of some largish dxf lib would have taken even longer. And the result wouldn't have been much better.

4. where to get it, how to try it


svn checkout svn://repo.hu/pcb-rnd/trunk
./configure --buildin-export_dxf
make
cd src && ./pcb-rnd

Testing & feedback are welcome.