Skip to main content

gerber_to_scad

Simple python script for converting gerber files into a 3d printable solder stencil scad file

This repository has both a CLI tool, and a web app you can run locally or self-host. The tool used to run online at solder-stencil.me, but this is currently offline. If anyone misses it, let me know and I might bring it back!

Installation

  • To install just the library: pip install gerber-to-scad
  • To install the library and the web service: pip install "gerber-to-scad[service]"

gerber_to_scad requires python3.10 or higher.

Development setup

  • Clone the repo
  • Make sure you have poetry installed.
  • Run poetry install.
  • To activate the poetry virtualenv, run poetry shell.

Note: on M1 macs, scipy doesn't install correctly out of the box. If you're getting installation errors, try this:

brew install openblas
export OPENBLAS="$(brew --prefix openblas)"
poetry install

Usage

You'll get some information on available options if you run it with the -h argument:

(env) $ gerber_to_scad from-files --help

Usage: gerber_to_scad from-files [OPTIONS]

  Generate a stencil from an outline and paste gerber file.

Options:
  --outline FILE                  File containing the outline layer
                                  [required]
  --paste FILE                    File containing the solderpaste layer (top
                                  or bottom)  [required]
  --output FILE                   Output file  [required]
  -t, --thickness FLOAT           Stencil thickness in mm. Should be a
                                  multiple of your layer height.  [default:
                                  0.2]
  -a, --alignment-aid [ledge|frame|none]
                                  Alignment aid to include with the stencil.
                                  [default: ledge]
  -f, --full-ledge                [ledge] Extend the ledge all the way around
                                  the board (default is half ledge).
  -L, --ledge-thickness FLOAT     [ledge] Ledge thickness in mm. Should be
                                  less than the PCB thickness.  [default: 1.2]
  --frame-width FLOAT             [frame] Width of the frame in mm.  [default:
                                  155.0]
  --frame-height FLOAT            [frame] Height of the frame in mm.
                                  [default: 155.0]
  --frame-thickness FLOAT         [frame] Thickness of the frame in mm.
                                  [default: 1.2]
  -g, --gap FLOAT                 Gap in mm between board and ledge. Increase
                                  if fit is too tight.  [default: 0.0]
  -i, --increase-hole-size FLOAT  Increase all hole sizes by this amount in
                                  mm.  [default: 0.0]
  --flip                          Flip the stencil (use for bottom layer
                                  stencils).
  --openscad-binary PATH          Path to the OpenSCAD binary. Only used when
                                  output ends in .stl.  [default: openscad]
  --help                          Show this message and exit.

For basic usage, simply run the script with input files for the gerber outline and solderpaste files and specify an output:

gerber_to_scad from-files --outline=outline_file.gko --paste=toppaste_file.gtp --output=output.scad

Specifying a .stl file as the output file will directly call OpenSCAD to create the STL - if OpenSCAD is not on the path, you can use --openscad-binary=<path> to specify it

Contributing

Contributions are very welcome, I don't have a lot of time to spend on this project, but I try to review PRs as much as I can!

  • Please use ruff to format your code - if you use VS code, you can open the gerber_to_scad.code-workspace file to get all the right automatic formatting in your editor, or you can just run ruff format . in the project root.

Metadata

Release files for gerber-to-scad 0.2.1

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

Source distribution (sdist)

Source distribution for gerber-to-scad 0.2.1
File Size Uploaded
gerber_to_scad-0.2.1.tar.gz 13.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gerber-to-scad 0.2.1
File Interpreter ABI Platform
gerber_to_scad-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 28.2 kB

Release files / gerber_to_scad-0.2.1.tar.gz

Download URL gerber_to_scad-0.2.1.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2b8d2c43e43aa85911c3d412725002191035b87d7e65d6380fb68a51c05bf5b4
BLAKE2b-256 checksum
How to use checksums
1eb46234d22af497a29347517bea645396f5ffaa02728f530577739318ed73e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 7, 2026.

Transparency log

Release files / gerber_to_scad-0.2.1-py3-none-any.whl

Download URL gerber_to_scad-0.2.1-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
230221b9c412688fc8541f5bc3b6aa70662f18eacd4c463e7449f66b657d67b8
BLAKE2b-256 checksum
How to use checksums
a92aad86509cacbefb434ef6cee1fdb3f576c56cbf1833a2a680120767d98371
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 7, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 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