# Install kikit

Install `kikit`:
```bash
pipx install --system-site-packages kikit
```

![Panel](../images/Flow_Controller_panel.png)


# 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.

---

# Usage

```bash
# Panelize the PCB using the preset defined in `myPreset.json`.
kikit panelize \
    -p myPreset.json \
    ../Flow_Controller.kicad_pcb \
    panel/Flow_Controller_Panel.kicad_pcb
```

Have a look at the new `panel/Flow_Controller_Panel.kicad_pcb` file. It will contain the panel out ot layout specified in `myPreset.json`. E.g.: Grid of 1 x 2 with space 2.1 mm.

```json
    "layout": {
        "type": "grid",
        "rows": 1,
        "cols": 2,
        "hspace": "2.1mm",
        "vspace": "2.1mm"
    }
```

## Exporting gcode files from KiCad

Adapt milling and drilling parameters in `millproject`. Look up [pcb2gcode/wiki](https://github.com/pcb2gcode/pcb2gcode/wiki) for help.
```bash
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
./export.sh -o gcode 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.

## 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.

Set up the entire back side as one big GND pour. Then, increase the thermal spoke width to be larger than 1mm. This avoids small features and gives more room for error if a larger drill is used for the holes.

![Thermal spoke width](../images/spoke_width.png)


