Skip to content

Garoci/FabConvert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TheFabConvert (fabconvert)

License: MIT Python 3.9+ Status: Beta PRs Welcome Formats

TheFabConvert (fabconvert) converts PCB fabrication files between SVG ⇄ DXF ⇄ Gerber as a Python library, a CLI, and an optional desktop GUI.

Screenshot

Motivation

Open-source tooling often covers one pair of formats, or embeds conversion inside a larger EDA stack. There has not been a small, dedicated open-source project that offers direct, easy conversion between Gerber, DXF, and SVG in one place — library + CLI + GUI — without pulling in a full CAD application. This project fills that gap.

Current status

Early stage / beta. The public surface is usable for common centreline-style copper and outline work, but the API and format coverage are still evolving. Support for more fabrication file formats (especially PCB-related ones) is planned.

Current limitations

Some constructs are not yet supported and will raise a clear error (or, for a few write paths, drop geometry with a note) rather than silently invent data.

Gerber (read)

Raised as fabconvert.formats.gerber_io.UnsupportedGerberConstruct:

Construct Notes
G36 / G37 region mode (polygon fill) Not supported yet — planned for a future release
AM macro apertures (%AM) Not supported
%SR step-and-repeat Not supported
Missing %FS coordinate format Refused (cannot interpret coordinates safely)
Non-circular apertures (e.g. rectangle R) Only circular apertures today
Empty files (no draws / flashes) Refused

On write, filled ClosedPolygons (e.g. copper pours) are not emitted as Gerber regions; the writer notes the loss rather than inventing unsupported G36/G37 output.

DXF

  • DXF has no native stroke-width property for traces the way Gerber apertures do. Writers reconstruct filled outlines from centreline + width; readers recover width from closed outline "ribbons" via medial-axis / pairing heuristics when possible.
  • Unit detection uses $INSUNITS plus heuristics; pass --unit / unit_override when the file is unitless or wrong.
  • Recovery via ezdxf may still load structurally awkward files with auditor notes.

See docs/formats.md for the full conversion matrix and behaviour notes.

Installation

git clone https://github.com/fabconvert/fabconvert.git
cd fabconvert
pip install .

GUI extra

pip install .[gui]

Development environment

pip install .[dev]

You can combine extras, e.g. pip install ".[gui,dev]".

CLI usage

After install, the fabconvert entry point is available:

fabconvert --help
fabconvert convert board.svg board.dxf
fabconvert convert board.gbr board.svg --unit mm
fabconvert info board.dxf
fabconvert batch ./in ./out --to gbr --pattern "*.svg"

Subcommands: convert, info, batch, gui. Use --unit mm|inch|mil|cm|m when input units are ambiguous.

GUI usage

Install the GUI extra, then either:

fabconvert-gui

or:

fabconvert gui

Drag-and-drop conversion with a live before/after geometry preview (PySide6).

Using it as a Python library

import fabconvert
from fabconvert.alignment import Units
from fabconvert.formats.gerber_io import UnsupportedGerberConstruct

# One-shot conversion (dispatches on file extensions)
fabconvert.convert("board.svg", "board.dxf")
fabconvert.convert("board.gbr", "board.svg")

# Named helpers
fabconvert.svg_to_dxf("board.svg", "board.dxf")
fabconvert.dxf_to_svg("board.dxf", "board.svg", unit_override=Units.MM)
fabconvert.gerber_to_svg("board.gtl", "board.svg")

# Inspect intermediate geometry
geom, alignment = fabconvert.read("board.gtl")
print(alignment.detected_unit, geom.bounds())
fabconvert.write(geom, "board.svg")

try:
    fabconvert.read("regions.gbr")
except UnsupportedGerberConstruct as e:
    print("unsupported Gerber construct:", e)

Supported formats

Format Extensions (read and write)
SVG .svg
DXF .dxf
Gerber .gbr, .gtl, .gbo, .gbs, .gbl, .gto, .gts, .gko, .gm1

All six conversion directions (SVG↔DXF↔Gerber) go through a shared intermediate model (GeometrySet in millimetres). Details: docs/formats.md.

Roadmap

This is only the beginning. The long-term goal is broad support for common fabrication file formats, especially PCB-related ones (richer Gerber region/macro support, more DXF entity types, and additional fab formats as the project grows).

Contributing

Contributions, issues, and pull requests are welcome. See docs/contributing.md for layout, setup, and golden rules.

Full docs index: docs/index.md (quickstart, CLI, library API, GUI, troubleshooting, changelog).

License

MIT — see pyproject.toml .

About

First Commit, as i just tried to solve the conversion of Fab files and yes i'm a newbie programmer. You will be notified for next versions, Click WATCH button, and Star me if it was useful ♥

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages