Skip to main content

Solder stencil generator, converts gerber files to a 3d-printable openSCAD solder stencil

Project description

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 -h
# Or:
(env) $ python -m gerber_to_scad -h
usage: main.py [-h] [-t THICKNESS] [-n] [-L LEDGE_THICKNESS] [-g GAP]
                         [-i INCREASE_HOLE_SIZE]
                         outline_file solderpaste_file output_file

Convert gerber files to an scad 3d printable solder stencil.

positional arguments:
  outline_file          Outline file
  solderpaste_file      Solderpaste file
  output_file           Output file

optional arguments:
  -h, --help            show this help message and exit
  -t THICKNESS, --thickness THICKNESS
                        Thickness (in mm) of the stencil. Make sure this is a
                        multiple of the layer height you use for printing
                        (default: 0.2)
  -n, --no-ledge        By default, a ledge around half the outline of the
                        board is included, to allow aligning the stencil
                        easily. Pass this to exclude this ledge.
  -f, --full-ledge      By default, a ledge around half the outline of the
                        board is included. Pass this to make the ledge around
                        the full perimeter instead of half.
  -L LEDGE_THICKNESS, --ledge-thickness LEDGE_THICKNESS
                        Thickness of the stencil ledge. This should be less than
                        the thickness of the PCB (default: 1.2)
  -g GAP, --gap GAP     Gap (in mm) between board and stencil ledge. Increase
                        this if the fit of the stencil is too tight (default:
                        0.0)
  -i INCREASE_HOLE_SIZE, --increase-hole-size INCREASE_HOLE_SIZE
                        Increase the size of all holes in the stencil by this
                        amount (in mm). Use this if you find holes get printed
                        smaller than they should (default: 0.0)

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

gerber_to_scad outline_file.gko toppaste_file.gtp 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gerber_to_scad-0.1.7.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gerber_to_scad-0.1.7-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file gerber_to_scad-0.1.7.tar.gz.

File metadata

  • Download URL: gerber_to_scad-0.1.7.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gerber_to_scad-0.1.7.tar.gz
Algorithm Hash digest
SHA256 367c156ea119d489d4af755c8b02208d95cc1f0f3b32845e6067a43da6454270
MD5 260efe885d01ddfff0392449fa9d123b
BLAKE2b-256 71c8ca3b03b3c22c25c3c8217a474a8ced6ba2bd751f2b94f6799e0437865e33

See more details on using hashes here.

Provenance

The following attestation bundles were made for gerber_to_scad-0.1.7.tar.gz:

Publisher: ci.yml on kirberich/gerber_to_scad

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gerber_to_scad-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: gerber_to_scad-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gerber_to_scad-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 2f1f18c4c4d58c132798969b2f74411c6e5b49995e7f1d854d4915bea104429f
MD5 341cc5d0df65f9d3f98d7161f63b919a
BLAKE2b-256 570d937c5f767d12d94ef8063ef62369fa41a453f64f1a774a6ede0b237b46cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for gerber_to_scad-0.1.7-py3-none-any.whl:

Publisher: ci.yml on kirberich/gerber_to_scad

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page