clean up
This commit is contained in:
@@ -1,30 +1,26 @@
|
||||
TODO: Add table of content
|
||||
# KiKit Fixture Processor
|
||||
Processing script for KiKit panelizes PCBs and draws a fixture sketch and positions the whole panel for easy CNC and MSLA processing.
|
||||
|
||||
The script:
|
||||
|
||||
- Panelizes the board
|
||||
- Moves the finished panel to the origin `(0, 0)`
|
||||
- Adds alignment holes
|
||||
- Adds silskcreen text
|
||||
- Extends the copper layers
|
||||
|
||||
The resulting output is intended for repeatable CNC/MSLA processing.
|
||||
|
||||

|
||||
|
||||
# Install kikit
|
||||
## Install kikit
|
||||
Install `kikit`:
|
||||
```bash
|
||||
pipx install --system-site-packages kikit
|
||||
```
|
||||
|
||||
# KiKit Fixture Processor
|
||||
Processing script for KiKit panelizes PCBs and draws a fixture sketch and positions the whole panel for easy CNC processing.
|
||||
|
||||
The script:
|
||||
|
||||
- Draws fixture reference geometry
|
||||
- Centres the finished panel inside a predefined fixture frame
|
||||
- Adds mechanical alignment pin holes
|
||||
- Moves the finished panel to the origin `(0, 0)`
|
||||
|
||||
The resulting output is intended for repeatable CNC manufacturing workflows
|
||||
where drilling, routing, and UV exposure all share the same physical fixture
|
||||
and alignment holes.
|
||||
|
||||
Check the kikit panelization [examples](https://yaqwsx.github.io/KiKit/latest/panelization/examples/).
|
||||
|
||||
---
|
||||
|
||||
# Usage
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
# Panelize the PCB using the preset defined in `myPreset.json`.
|
||||
@@ -46,7 +42,13 @@ The new `panel/Flow_Controller_Panel.kicad_pcb` file will contain the panelized
|
||||
}
|
||||
```
|
||||
See all values in [default.json](https://raw.githubusercontent.com/yaqwsx/KiKit/refs/heads/master/kikit/resources/panelizePresets/default.json)
|
||||
## Exporting gcode files from KiCad
|
||||
|
||||
Check the kikit panelization [examples](https://yaqwsx.github.io/KiKit/latest/panelization/examples/).
|
||||
|
||||
# Exporting gcode for CNC
|
||||
|
||||
## pcb2gcode
|
||||
Use CNC for drilling holes and milling board outlines. You can also use CNC for isolation traces milling. However, the best result will give you MSLA PCB exposure. TODO: Add link to the section
|
||||
|
||||
Adapt milling and drilling parameters in `millproject`. Look up [pcb2gcode/wiki](https://github.com/pcb2gcode/pcb2gcode/wiki) for help.
|
||||
```bash
|
||||
@@ -54,22 +56,15 @@ nano millproject
|
||||
```
|
||||
*Make sure to set `mirror-axis` in the `millproject` to half of your board width!!!*
|
||||
|
||||
Run the export by providing the `.kicad_pcb` file as a first argument:
|
||||
|
||||
```bash
|
||||
# Input layers/filenames and all milling/drilling parameters are taken from the config file: 'millproject'.
|
||||
docker run --rm -i -t \
|
||||
-u "$(id -u):$(id -g)" \
|
||||
-v "$(pwd):/data" \
|
||||
ptodorov/pcb2gcode
|
||||
./export_for_cnc.sh panel/Flow_Controller_Panel.kicad_pcb
|
||||
```
|
||||
The script will first generate gerber files in the `gerbers` directory and then generate gcode files in the `gcode` directory.
|
||||
|
||||
Launch the `gSender` program.
|
||||
* Load the `gcode/drill.ngc` file for drilling holes.
|
||||
* Load the `gcode/outline.ngc` file for milling the board outlines.
|
||||
* Load the `gcode/back.ngc` file if you want to mill the isolation traces.
|
||||
* Load the `gcode/front.ngc` file if you want to mill the isolation traces.
|
||||
* Load the `output/gcode/drill.ngc` file for drilling holes.
|
||||
* Load the `output/gcode/outline.ngc` file for milling the board outlines.
|
||||
* Load the `output/gcode/back.ngc` file if you want to mill the isolation traces.
|
||||
* Load the `output/gcode/front.ngc` file if you want to mill the isolation traces.
|
||||
|
||||
## Milling tip: Increase the thermal spoke and trace width
|
||||
When routing for milling, use the widest traces possible. 1mm, 2mm and wider, the machine doesn't care, but later you won't be soldering leads to small fragile strips of copper. You can use copper pours for routing too.
|
||||
@@ -85,21 +80,11 @@ Convert KiCad PCB layers to `.pm4n` files for direct UV exposure on an **Anycubi
|
||||
|
||||
---
|
||||
|
||||
## Files
|
||||
|
||||
| File | Purpose |
|
||||
|---|---|
|
||||
| `export.sh` | Main entry point — exports Gerbers from KiCad, converts to `.pm4n` |
|
||||
| `gerber_to_pm4n.py` | Python converter (Gerber → RLE → pm4n binary surgery) |
|
||||
| `Dummy.pm4n` | Template file for your specific printer. |
|
||||
|
||||
---
|
||||
|
||||
## Setup
|
||||
|
||||
### 1. Create the Dummy.pm4n
|
||||
|
||||
Open **CHITUBOX_Basic** slicer, select printer **Anycubic Photon Mono 4**, slice any tiny STL (a 1×1×0.05 mm box), and save as `Dummy.pm4n` in the same directory as `export.sh`.
|
||||
Open **CHITUBOX Basic** slicer, select printer **Anycubic Photon Mono 4**, slice any tiny STL (a 1×1×0.05 mm box), and save as `Dummy.pm4n` in the same directory as `export_for_msla.sh`.
|
||||
|
||||
This file is reused for every job — it carries the correct LCD resolution metadata.
|
||||
|
||||
@@ -113,64 +98,18 @@ pip install pygerber Pillow numpy
|
||||
|
||||
Or activate the venv once and put `source .venv/bin/activate` in your shell profile.
|
||||
|
||||
---
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
./export.sh [OPTIONS] <path/to/board.kicad_pcb>
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
| Option | Default | Description |
|
||||
|---|---|---|
|
||||
| `--layers L,L,...` | `Front,F.Mask` | KiCad layer names to process |
|
||||
| `--invert L,L,...` | *(none)* | Layers to invert the image for |
|
||||
| `--mirror L,L,...` | *(none)* | Layers to mirror X for |
|
||||
| `--exposure N` | `60` | Exposure time in seconds |
|
||||
| `--dummy FILE` | `./Dummy.pm4n` | Path to dummy template |
|
||||
| `--out DIR` | `./output` | Output directory |
|
||||
| `--dpmm N` | `58.824` | Render resolution (native = 17 µm/px) |
|
||||
| `--pos X,Y` | centred | Board position in mm from top-left |
|
||||
|
||||
---
|
||||
|
||||
## Examples
|
||||
|
||||
### Typical: top copper, positive-working resist (Bungard standard)
|
||||
### 3. Export multiple layers (e.g. copper + soldermask)
|
||||
|
||||
```bash
|
||||
./export.sh \
|
||||
--layers Front \
|
||||
--invert Front \
|
||||
--mirror Front \
|
||||
./export_for_msla.sh \
|
||||
--layers Front,Back,F.Mask,B.Mask,F.SilkS,B.SilkS \
|
||||
--invert Front,Back,F.Mask,B.Mask,F.SilkS,B.SilkS \
|
||||
--mirror Front,F.Mask,F.SilkS \
|
||||
--exposure 60 \
|
||||
panel/Flow_Controller_Panel.kicad_pcb
|
||||
```
|
||||
|
||||
`--invert`: Bungard presensitized is positive-working — UV removes resist, so the background must be exposed (white) and traces must block UV (dark). The Gerber is positive (copper=white), so inversion is needed.
|
||||
|
||||
`--mirror`: the board sits copper-side-down on the FEP, so the image must be flipped so the pattern reads correctly through the board.
|
||||
|
||||
### Multiple layers (e.g. copper + soldermask)
|
||||
|
||||
```bash
|
||||
./export.sh \
|
||||
--layers Front,F.Mask \
|
||||
--invert Front,F.Mask \
|
||||
--mirror Front,F.Mask \
|
||||
--exposure 60 \
|
||||
panel/Flow_Controller_Panel.kicad_pcb
|
||||
```
|
||||
|
||||
### Quick test at lower resolution (faster render)
|
||||
|
||||
```bash
|
||||
./export.sh --dpmm 30 --layers Front --invert Front --mirror Front panel/Flow_Controller_Panel.kicad_pcb
|
||||
```
|
||||
|
||||
### Using gerber_to_pm4n.py directly
|
||||
#### Using gerber_to_pm4n.py directly
|
||||
|
||||
```bash
|
||||
python3 gerber_to_pm4n.py Dummy.pm4n output/gerbers/Flow_Controller_Panel-Front.gbr \
|
||||
@@ -195,29 +134,6 @@ output/
|
||||
|
||||
---
|
||||
|
||||
## Invert and mirror logic
|
||||
|
||||
| Setting | When to use |
|
||||
|---|---|
|
||||
| `--invert` | Positive-working resist (standard Bungard): UV removes resist → background must be white (exposed), traces black (masked) |
|
||||
| no `--invert` | Negative-working resist: UV hardens resist → traces must be white |
|
||||
| `--mirror` | Board placed **copper-side down** on FEP (normal for this workflow) |
|
||||
| no `--mirror` | Board placed copper-side up |
|
||||
|
||||
When in doubt: check the `.preview.png` before printing. Traces should appear **dark** on a white background for standard Bungard positive-working boards.
|
||||
|
||||
---
|
||||
|
||||
## Exposure calibration
|
||||
|
||||
Start at **60 s** and bracket in ±15 s steps. Typical range for Bungard presensitized at 405 nm is 30–120 s depending on board age and storage conditions.
|
||||
|
||||
A correctly exposed board after development will show:
|
||||
- Clear copper traces (resist intact, blue/green tint)
|
||||
- Bare copper in etched areas (resist removed, shiny copper)
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**`kicad-cli: command not found`** — add KiCad to PATH:
|
||||
@@ -239,14 +155,10 @@ alias kicad-cli='flatpak run --command=kicad-cli org.kicad.KiCad'
|
||||
| `B.Mask` | `B_Mask` |
|
||||
| `F.SilkS` | `F_Silkscreen` |
|
||||
|
||||
**Image looks wrong in preview** — check invert/mirror flags. Open `.preview.png`: for positive-working resist, traces = dark, background = white.
|
||||
|
||||
**UVtools PCB Exposure freezes on per-item invert checkbox** — known v6 bug at 46 MP. Use the global invert checkbox at the bottom of the dialog instead, or use this script pipeline entirely.
|
||||
|
||||
---
|
||||
First print checklist
|
||||
|
||||
Open the `.pm4n` in Chitubox to visually verify before printing.
|
||||
Open the `.pm4n` in `Chitubox Basic` slicer to visually verify before printing.
|
||||
Check the `.preview.png` — traces should appear black on white background (background = UV exposed = resist removed = etched away; traces = dark = resist kept = copper stays)
|
||||
Start with `--exposure 60` and bracket from there — Bungard presensitized at 405nm typically lands between 30–120s depending on board vintage and storage.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user