# Former A desktop application for generating 3D-printable solder paste stencils and snap-fit enclosures from KiCad/Gerber files. ![Former](static/showcase.png) ## Features **Stencil Generation** - Parses RS-274X Gerber solder paste layers - Supports standard apertures (Circle, Rectangle, Obround) and Aperture Macros with rotation - Generates optimized STL meshes for 3D printing - Automatic cropping to PCB bounds **Enclosure Generation** - Generates snap-fit enclosures with lids and trays from KiCad `.gbrjob` projects - Native OpenSCAD `.scad` export for parametric editing - Interactive 3D layer viewer with per-layer colorization (KiCad color scheme) - Visual cutout placement on any surface (top, bottom, sides) with live 3D preview - Automatic USB port detection and cutout alignment from F.Fab/B.Fab layers - Tray clip system with vertical relief slots - Dado/engrave mode for surface text and logos **Desktop App** - Native macOS and Windows application (Wails v2) - Project saving and loading with persistent cutout state - CLI mode for scripted/batch workflows ## Install ### Requirements - [Go](https://go.dev/dl/) 1.21+ - [Wails CLI](https://wails.io/docs/gettingstarted/installation): `go install github.com/wailsapp/wails/v2/cmd/wails@latest` - [Node.js](https://nodejs.org/) 18+ (for frontend build) - macOS: Xcode Command Line Tools (`xcode-select --install`) ### Build **macOS:** ```bash ./build.sh ``` **Windows (native):** ```bat build-windows.bat ``` **Cross-compile for Windows (from macOS/Linux):** ```bash ./build-windows.sh ``` The built application will be at `build/bin/Former.app` (macOS) or `build/bin/Former.exe` (Windows). ## CLI Usage Former can also run headless from the command line: ```bash ./Former [options] [outline.gbr] ``` ### Options | Flag | Default | Description | |------|---------|-------------| | `--height` | 0.16 | Stencil height in mm | | `--wall-height` | 2.0 | Wall height in mm | | `--wall-thickness` | 1.0 | Wall thickness in mm | | `--dpi` | 1016 | Rendering DPI | | `--keep-png` | false | Save intermediate PNG | ### Example ```bash ./Former --height=0.16 --keep-png my_board-F_Paste.gbr my_board-Edge_Cuts.gbr ``` ## 3D Printing Tips For fine-pitch SMD stencils (TSSOP, 0402, etc.): - **Nozzle**: 0.2mm recommended - **Layer height**: 0.16mm total (0.10mm first layer + 0.06mm second) - **Build surface**: Smooth PEI sheet for flat stencil bottom ## Acknowledgments Former began as a fork of [pcb-to-stencil](https://github.com/kennycoder/pcb-to-stencil) by [Nikolai Danylchyk](https://github.com/kennycoder), a Go tool for converting Gerber paste layers to STL stencils. The original Gerber parser and STL mesh generation formed the foundation that Former builds upon. ## License MIT License — see [LICENSE](LICENSE) for details.