Fork with bugfixes and additional features.
Go to file
pszsh 0f93fcdf86 Ill clean up the working space soon. It is now a desktop application in the loosest of terms. Its still just a webapp, but a nicely packed one 2026-02-26 00:28:22 -08:00
cmd/genicon Ill clean up the working space soon. It is now a desktop application in the loosest of terms. Its still just a webapp, but a nicely packed one 2026-02-26 00:28:22 -08:00
frontend Ill clean up the working space soon. It is now a desktop application in the loosest of terms. Its still just a webapp, but a nicely packed one 2026-02-26 00:28:22 -08:00
static Ill clean up the working space soon. It is now a desktop application in the loosest of terms. Its still just a webapp, but a nicely packed one 2026-02-26 00:28:22 -08:00
.gitignore Ill clean up the working space soon. It is now a desktop application in the loosest of terms. Its still just a webapp, but a nicely packed one 2026-02-26 00:28:22 -08:00
LICENSE Initial prototype 2025-12-12 13:24:10 +01:00
README.md Ill clean up the working space soon. It is now a desktop application in the loosest of terms. Its still just a webapp, but a nicely packed one 2026-02-26 00:28:22 -08:00
app.go Ill clean up the working space soon. It is now a desktop application in the loosest of terms. Its still just a webapp, but a nicely packed one 2026-02-26 00:28:22 -08:00
build.sh Ill clean up the working space soon. It is now a desktop application in the loosest of terms. Its still just a webapp, but a nicely packed one 2026-02-26 00:28:22 -08:00
drill.go Fork with bugfixes and additional features. Init. Commit 2026-02-20 23:01:19 -08:00
enclosure.go Ill clean up the working space soon. It is now a desktop application in the loosest of terms. Its still just a webapp, but a nicely packed one 2026-02-26 00:28:22 -08:00
former.go Ill clean up the working space soon. It is now a desktop application in the loosest of terms. Its still just a webapp, but a nicely packed one 2026-02-26 00:28:22 -08:00
gbrjob.go Expanded the concept, needs a few touches still 2026-02-21 05:21:17 -08:00
gerber.go Added automatic USB port cutout placement based on F.Fab and B.Fab layers 2026-02-22 14:12:55 -08:00
go.mod Ill clean up the working space soon. It is now a desktop application in the loosest of terms. Its still just a webapp, but a nicely packed one 2026-02-26 00:28:22 -08:00
go.sum Ill clean up the working space soon. It is now a desktop application in the loosest of terms. Its still just a webapp, but a nicely packed one 2026-02-26 00:28:22 -08:00
instance.go Ill clean up the working space soon. It is now a desktop application in the loosest of terms. Its still just a webapp, but a nicely packed one 2026-02-26 00:28:22 -08:00
main.go Ill clean up the working space soon. It is now a desktop application in the loosest of terms. Its still just a webapp, but a nicely packed one 2026-02-26 00:28:22 -08:00
scad.go Ill clean up the working space soon. It is now a desktop application in the loosest of terms. Its still just a webapp, but a nicely packed one 2026-02-26 00:28:22 -08:00
session.go Ill clean up the working space soon. It is now a desktop application in the loosest of terms. Its still just a webapp, but a nicely packed one 2026-02-26 00:28:22 -08:00
stencil_process.go Ill clean up the working space soon. It is now a desktop application in the loosest of terms. Its still just a webapp, but a nicely packed one 2026-02-26 00:28:22 -08:00
stl.go Ill clean up the working space soon. It is now a desktop application in the loosest of terms. Its still just a webapp, but a nicely packed one 2026-02-26 00:28:22 -08:00
storage.go Ill clean up the working space soon. It is now a desktop application in the loosest of terms. Its still just a webapp, but a nicely packed one 2026-02-26 00:28:22 -08:00
svg.go Ill clean up the working space soon. It is now a desktop application in the loosest of terms. Its still just a webapp, but a nicely packed one 2026-02-26 00:28:22 -08:00
svg_render_darwin.go Ill clean up the working space soon. It is now a desktop application in the loosest of terms. Its still just a webapp, but a nicely packed one 2026-02-26 00:28:22 -08:00
svg_render_other.go Ill clean up the working space soon. It is now a desktop application in the loosest of terms. Its still just a webapp, but a nicely packed one 2026-02-26 00:28:22 -08:00
util.go Ill clean up the working space soon. It is now a desktop application in the loosest of terms. Its still just a webapp, but a nicely packed one 2026-02-26 00:28:22 -08:00
wails.json Ill clean up the working space soon. It is now a desktop application in the loosest of terms. Its still just a webapp, but a nicely packed one 2026-02-26 00:28:22 -08:00

README.md

Gerber Solder Paste Layer to Solder Stencil Converter

A Go tool to convert Gerber files (specifically solder paste layers) into 3D printable STL stencils.

Features

  • Parses standard RS-274X Gerber files.
  • Supports standard apertures (Circle, Rectangle, Obround).
  • Supports Aperture Macros (AM) with rotation (e.g., rounded rectangles).
  • Automatically crops the output to the PCB bounds.
  • Generates a 3D STL mesh optimized for 3D printing.
  • Enclosure Generation: Automatically generates a snap-fit enclosure and tray based on the PCB outline.
  • Native OpenSCAD Support: Exports native .scad scripts for parametric editing and customization.
  • Smart Cutouts: Interactive side-cutout placement with automatic USB port alignment.
  • Tray Snap System: Robust tray clips with vertical relief slots for secure enclosure latching.

Usage

Run the tool using go run:

go run main.go gerber.go [options] <path_to_gerber_file> [optional_board_outline_file]

Options

  • --height: Stencil height in mm (default: 0.16mm).
  • --wall-height: Wall height mm (default: 2.0mm).
  • --wall-thickness: Wall thickness in mm (default: 1mm).
  • --keep-png: Save the intermediate PNG image used for mesh generation (useful for debugging).
  • -server: Start the web interface server.
  • -port: Port to run the server on (default: 8080).

Example

go run main.go gerber.go -height=0.16 -keep-png my_board_paste_top.gbr my_board_outline.gbr

This will generate my_board_paste_top.stl in the same directory.

Enclosure Generation

To generate an enclosure, use the web interface. Upload a .gbrjob file and the associated Gerber layers. The tool will auto-discover the board thickness and outline.

  1. Upload: Provide the Gerber job and layout files.
  2. Configure: Adjust wall thickness, clearance, and mounting hole parameters in the UI.
  3. Preview: Use the interactive preview to place and align side cutouts for connectors.
  4. Export: Generate STLs or OpenSCAD scripts for both the enclosure top and the tray.

Web Interface

To start the web interface:

go run main.go gerber.go -server

Then open http://localhost:8080 in your browser. You can upload files and configure settings via the UI.

3D Printing Recommendations

For optimal results with small SMD packages (like TSSOP, 0402, etc.), use the following 3D print settings:

  • Nozzle Size: 0.2mm (Highly recommended for sharp corners and fine apertures).
  • Layer Height: 0.16mm total height.
    • First Layer: 0.10mm
    • Second Layer: 0.06mm
  • Build Surface: Smooth PEI sheet (Ensures the bottom of the stencil is perfectly flat for good PCB adhesion).

These settings assume you run the tool with -height=0.16 (the default).

How it Works

  1. Parsing: The tool reads the Gerber file and interprets the drawing commands (flashes and draws). For enclosures, it parses the .gbrjob to identify board layers.
  2. Rendering: It renders the PCB outline and layers into a high-resolution internal image.
  3. Path Extraction: Board edges are traced and simplified to generate 2.5D geometry.
  4. Meshing: It converts the image into a 3D mesh (STL) or generates CSG primitives (SCAD) using the board topology.
  5. Export: The resulting files are saved for 3D printing or further CAD refinement.

License

This project is licensed under the MIT License - see the LICENSE file for details.