Skip to main content

GerberTools

Yet another tool for doing stuff with Gerber files. "Stuff" being:

  • rendering to SVGs;
  • rendering to 3D models (Wavefront OBJ format); and
  • (very) basic electrical DRC.

Why? [insert tool here] can already do this.

For as far as I could find, no (open source) tool could do these things from just gerber files (they use their own EDA file format), don't do it detailed enough for my liking, can't be scripted, and/or don't have a way to export the data. It's all kind of a mess. For example...

  • Other tools exist to render Gerber files to SVGs. But they use (comparatively) complex SVG operations to make things work, thus relying on the SVG rendering engine to do most of the work. If you're just viewing the file that's fine; if you're reading them from a script it's not. The SVGs generated by GerberTools only use polygons, making them much easier to read.

  • Most EDA tools nowadays have a 3D viewer built into them. But if they have an exporter at all, the export is limited to the board shape and holes. That's fine when you're doing 3D CAD, but it's nowhere near good enough when you're trying to make somewhat photorealistic renders, like this:

    Example render

    The input file format (i.e. the native format of the EDA tool) can also be an issue, for example when you're crazy enough to procedurally generate a PCB. So is scriptability.

  • DRC has the same "issues" as above: when you only have Gerber files and a netlist, good luck getting any EDA tool to help you.

Ultimately, I built this because I myself needed it. Maybe it'll help someone else as well, maybe not.

How?

The core is written in C++, but wrapped in a (scarcely documented) Python module. This module also includes a basic command-line interface. You can get it the usual way with pip:

pip install gerbertools

Once you have it, you can use the command-line interface using

gerbertools --help

or equivalently, if the above won't work due to path shenanigans,

python -m gerbertools --help

From within Python, you can do something like

import gerbertools
help(gerbertools)
print(gerbertools.get_version())
gerbertools.read('some_pcb').write_svg('some_pcb.svg')

You can also run the tests by running the test_boards.py script in the tests directory. This should give you some basic usage examples, and generates some example output files in tests/output.

Wheels should be available for Windows, MacOS, and Linux using the Python versions active at the time of writing. If you're reading this in N years and there is no wheel for your version, or you have some other reason to build it yourself, it should be fairly straightforward to do so. All dependencies are contained within the repository, so you really just need Python and a C++ compiler. The easiest way to build it is with:

NPROCS=10 pip install -v -e .

where the NPROCS environment variable specifies the maximum amounts of parallel compilation processes to use.

You can also build and install using the usual CMake methods, but then you only get the C++ library that the Python module is based on. So that's really only useful when you want to use the library from C++.

Copyright stuff

The polygon geometry processing is done using the Clipper library, lazily included as source files in this repository. It uses the Boost software license. The same thing goes for Earcut, which uses the ICS license. The relevant license text is at the top of the copied files.

Stuff I add will be licensed under MIT, which I'm more familiar with. Either way, it'll be permissively licensed.

The circuit board files in the test directory have different licenses. They are not distributed with or linked to any build, and I have no affiliation with the makers/owners of those boards.

Release files for gerbertools 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for gerbertools 0.1.0
File
gerbertools-0.1.0-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
gerbertools-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
gerbertools-0.1.0-cp39-cp39-macosx_10_14_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.14+ x86-64 Details
gerbertools-0.1.0-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details
gerbertools-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details
gerbertools-0.1.0-cp38-cp38-macosx_10_14_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.14+ x86-64 Details
gerbertools-0.1.0-cp37-cp37m-win_amd64.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-64 Details
gerbertools-0.1.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 Details
gerbertools-0.1.0-cp37-cp37m-macosx_10_14_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.14+ x86-64 Details
gerbertools-0.1.0-cp36-cp36m-win_amd64.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-64 Details
gerbertools-0.1.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ x86-64 Details
gerbertools-0.1.0-cp36-cp36m-macosx_10_14_x86_64.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.14+ x86-64 Details

Total release size:3.2 MB

Release files / gerbertools-0.1.0-cp39-cp39-win_amd64.whl

Download URL gerbertools-0.1.0-cp39-cp39-win_amd64.whl
Size 224.6 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
66bc7608c14015f0786cb30757f4e270c21f7810f4b83c39220c11e66e298b43
BLAKE2b-256 checksum
How to use checksums
ee7a2591dd311d7261c2f276718676dc458cb4f83d42d09fd9cde8d6497ba9e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.5.0.1 requests/2.20.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.10

Release files / gerbertools-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL gerbertools-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 310.1 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
389c18671736c2b2b8f19bb34a94d4528a5311abc2e4fc61388e940928e26e99
BLAKE2b-256 checksum
How to use checksums
975eb8096c84a123415f021fe03015a57b04104f3830b7a67cd318425266a119
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.5.0.1 requests/2.20.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.10

Release files / gerbertools-0.1.0-cp39-cp39-macosx_10_14_x86_64.whl

Download URL gerbertools-0.1.0-cp39-cp39-macosx_10_14_x86_64.whl
Size 262.2 kB
Tags CPython 3.9 macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
c4d7884b3aa4c42f4abf748f7a5f594dba59194574aca4daa0690dca55c5f999
BLAKE2b-256 checksum
How to use checksums
7434afe0e71875e11d5c97315bbe2edbaed743cfa0c7ddce740f4b2054babd15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.5.0.1 requests/2.20.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.10

Release files / gerbertools-0.1.0-cp38-cp38-win_amd64.whl

Download URL gerbertools-0.1.0-cp38-cp38-win_amd64.whl
Size 227.4 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
96a83ec1dcd66e5379caa3eaa3d3ec791ec81ce36c60967aaa632bea0dec4ef2
BLAKE2b-256 checksum
How to use checksums
6d54e5c0e5096878488e1fcf596ec958b6f6739c343ea5c0d303271ec4e07558
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.5.0.1 requests/2.20.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.10

Release files / gerbertools-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL gerbertools-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 309.9 kB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
078213e84dae4f7ff4ddcda7c32baa137c2e6d24967bb2fc19d604f90fff580a
BLAKE2b-256 checksum
How to use checksums
18f8773621f6a66b0dababfabebb84c5382a15c738e0615c0ffc5f03d8325f43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.5.0.1 requests/2.20.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.10

Release files / gerbertools-0.1.0-cp38-cp38-macosx_10_14_x86_64.whl

Download URL gerbertools-0.1.0-cp38-cp38-macosx_10_14_x86_64.whl
Size 262.2 kB
Tags CPython 3.8 macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
7e9dce27a23ea412de09dbaa447a2645c2c4b3788a48a62d859d4e0d8479ac57
BLAKE2b-256 checksum
How to use checksums
75f9e6de31ab405ce3fdb7c1d307ed2dd2f3996dbd0a5451e473ae407abd49b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.5.0.1 requests/2.20.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.10

Release files / gerbertools-0.1.0-cp37-cp37m-win_amd64.whl

Download URL gerbertools-0.1.0-cp37-cp37m-win_amd64.whl
Size 227.6 kB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
7f185a9670a9a063b4cb7914e37492ef08ad801d74a0ebaf8a9979059aca7705
BLAKE2b-256 checksum
How to use checksums
ff5e6e6b244fe3258c52e7d8c21dfbd46b6c95566d075fbd9ee19e7972960dc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.5.0.1 requests/2.20.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.10

Release files / gerbertools-0.1.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL gerbertools-0.1.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 313.9 kB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
2329fc3a388a6f5cd575e9a577b145fc4f3910e3201ce942f9d944b2360096b0
BLAKE2b-256 checksum
How to use checksums
bea969e939988891a969d73f59e4f6dc36fba1a8137d5d98abd70141a20424a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.5.0.1 requests/2.20.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.10

Release files / gerbertools-0.1.0-cp37-cp37m-macosx_10_14_x86_64.whl

Download URL gerbertools-0.1.0-cp37-cp37m-macosx_10_14_x86_64.whl
Size 260.8 kB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
266fc445fe70a40c55c7ce02632d1da464ead59b29d20f49bdf1a88c7fd272bc
BLAKE2b-256 checksum
How to use checksums
c4a21ab796e4fd691d71499780ee196b167faffef0c65021da0de65d0bed0a62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.5.0.1 requests/2.20.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.10

Release files / gerbertools-0.1.0-cp36-cp36m-win_amd64.whl

Download URL gerbertools-0.1.0-cp36-cp36m-win_amd64.whl
Size 227.5 kB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
ac33611ec51ddb74f90496ef2d3f58d9bd39f946b8ad0f2dae579324e3b13532
BLAKE2b-256 checksum
How to use checksums
59f314662f55aafcb2a154691ca4a109faf93405b7c03f7fa241f455bfeb5132
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.5.0.1 requests/2.20.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.10

Release files / gerbertools-0.1.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL gerbertools-0.1.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 313.7 kB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
dda0792a160ffef244a0e9143681b4b050d307c3a2a6806580c8bf778c357661
BLAKE2b-256 checksum
How to use checksums
10d98ac4220812b4c3ca6e70f9275f95288b54b961e896c0db28cef28b7644e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.5.0.1 requests/2.20.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.10

Release files / gerbertools-0.1.0-cp36-cp36m-macosx_10_14_x86_64.whl

Download URL gerbertools-0.1.0-cp36-cp36m-macosx_10_14_x86_64.whl
Size 260.9 kB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
8488a6c0ca6931c5e546a1681e000882f06c3fbada1874e62996707642c94d07
BLAKE2b-256 checksum
How to use checksums
491b8a042ae56e3fc58b7bc6d386bd4217994e22038e900f925e731be2c6dc43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.5.0.1 requests/2.20.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.10

Release history Release notifications | RSS feed

This release

0.1.0 This release

12 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page