# WisBlock Case Generator

A parametric OpenSCAD enclosure for the **RAK19007 WisBlock Base Board + RAK4631 Core** (the Meshtastic starter kit). One `.scad` file produces a base tray and a choice of lids, all tunable from the variables at the top of the file. No CAD skills needed: change a few numbers, hit render, export.

![The default WisBlock case in OpenSCAD: base tray and lid in the exploded "both" preview, with the Customizer panel exposing every adjustable group](Overview.png)

<img src="WisblockBoard.jpg" width="320" alt="A RAK19007 WisBlock base board with a RAK4631 core module — the hardware this case is built for">

*The hardware it's built for: a RAK4631 core on a RAK19007 WisBlock base.*

**Source / latest version:** https://github.com/magikh0e/wisblock-case-generator

**Also on Cults3D:** https://cults3d.com/en/users/magikh0e/3d-models

> Designed and verified against the RAK19007 datasheet. Tolerances vary by board batch and by printer, so always test-fit before a long print (see [section 5](#5-verify-these-before-a-long-print)).

---

## 1. What you need

- **OpenSCAD** (free): https://openscad.org. Install the regular release.
- The file **`Wisblock_Case_Generator.scad`**.
- A slicer for the exported STLs (PrusaSlicer, OrcaSlicer, Cura, Bambu Studio, etc.).
- Optional but strongly recommended: **calipers**, to verify a couple of board dimensions before committing.

Pre-exported STLs are bundled in [`stls/`](stls): `wisblock_base.stl`, `wisblock_lid_snap.stl`, `wisblock_lid_screw.stl`, and `wisblock_both_lids.stl`, ready to slice as-is for the default design. The rest of this guide is for when you want to change something.

---

## 2. Open and preview

1. Open `Wisblock_Case_Generator.scad` in OpenSCAD.
2. Press **F5** for a fast preview, **F6** for a full (slower) render.
3. Open the **Customizer** (Window menu -> Customizer, or the toolbar) and the variables appear as labeled sliders and toggles, grouped under headings like `[Board]`, `[Lid fit]`, and so on. No code editing required.
4. Export the rendered part with **File -> Export -> Export as STL** (or `F7`).

---

## 3. Choosing what to render

The very first variable controls which part you get:

```
part = "both";
```

| Value         | What it renders                                          |
|---------------|----------------------------------------------------------|
| `"base"`      | The base tray only                                       |
| `"lid"`       | A lid following your `use_snaps` / `use_screws` toggles  |
| `"lid_snap"`  | Lid with **snaps only** (no screw holes)                 |
| `"lid_screw"` | Lid with **screw holes only** (no snaps)                 |
| `"all_lids"`  | Both lid versions side by side on one print plate        |
| `"both"`      | Base + lid stacked and exploded (for on-screen preview)  |

> **Customizer note:** the dropdown only lists `base`, `lid`, and `both`. The other three values (`lid_snap`, `lid_screw`, `all_lids`) are fully supported, but to use them either type the value straight into the `part` variable in the editor, or set `part` in code. They are real render targets, just not exposed as dropdown entries.

> `"both"` is for **looking**, not printing. It floats the lid above the base so you can inspect the fit. Export `base` and a lid **separately** to print.

**The base is shared.** It always carries both the snap recesses and the screw posts, so either lid drops onto the same base. Print one base, then whichever lid(s) you want.

---

## 4. The print workflow (default design)

1. Set `part = "base";` -> F6 -> export `wisblock_base.stl`.
2. Set `part = "lid_snap";` (or `lid_screw`) -> F6 -> export the lid.
3. Slice both. The base prints flat, open side up, no supports. The lid prints lip and bumps up; the chamfered snaps stay under ~45 degrees so no supports are needed on most printers.
4. Assemble (see [section 8](#8-assembly)).

---

## 5. Verify these before a long print

The defaults come from the RAK19007 datasheet, but three things are worth a caliper check for a tight fit:

- **Mounting-hole inset** (`hole_inset_x`, `hole_inset_y`, default 2.5 mm). The datasheet shows these as drawings; measure your board if you want the posts to line up perfectly.
- **USB-C cutout** (`usbc_w` 9.5, `usbc_h` 3.6). If your cable has a chunky overmold, bump these up 1 to 2 mm.
- **Reset / pigtail side.** They sit on the same short end as USB-C. If your board's reset button is mirrored from the default, flip the sign on `reset_offset` and `pigtail_offset`.

**Fit-checker tip:** set `comp_clear = 1;` temporarily to make a shallow tray that confirms the board footprint and cutouts without wasting filament on the full-height walls. Set it back to 14 afterward. A throwaway fit-checker costs a few minutes and saves hours.

---

## 6. Variable reference

### `[Board]` — match these to your hardware
| Variable | Default | Meaning |
|---|---|---|
| `board_x`, `board_y` | 60, 30 | PCB footprint (mm). Verified for RAK19007. |
| `board_thick` | 1.6 | PCB thickness. |
| `standoff_h` | 4 | Height of the PCB above the floor. Leaves room for bottom-side JST connectors. |
| `hole_inset_x/y` | 2.5 | Mounting-hole center inset from each PCB edge. |
| `screw_hole_d` | 2.2 | Pilot bore in the posts for M2.5 self-tapping. |
| `post_d` | 5.5 | Outer diameter of the standoff posts. |

### `[Clearances]` — fit and wall thickness
| Variable | Default | Meaning |
|---|---|---|
| `wall` | 2.0 | Side wall thickness. |
| `floor_t`, `lid_t` | 2.0 | Floor / lid-top thickness. |
| `clr` | 0.4 | Gap around the PCB on all sides. Increase if the board is a tight squeeze. |
| `comp_clear` | 14 | Headroom above the PCB. Sized for the RAK4631 plus two IPEX antenna flags stuck to the lid. |

### `[Cutouts]`
| Variable | Default | Meaning |
|---|---|---|
| `usbc_w`, `usbc_h` | 9.5, 3.6 | USB-C opening size. |
| `usbc_y_center` | board_y/2 | Where along the edge the port sits. |
| `usbc_edge` | `"x0"` | Which wall the port faces (`x0`/`x1` = short ends, `y0`/`y1` = long sides). |
| `ant_d` | 0 | SMA bulkhead hole diameter. **0 = off**, correct for the stock IPEX-antenna kit. Set ~6.5 only if you swap to an SMA pigtail. |

### `[Lid fit]`
| Variable | Default | Meaning |
|---|---|---|
| `use_screws` | true | Adds M2.5 screw holes and uses the corner posts. |
| `use_snaps` | true | Adds cantilever snap catches on the long walls. |
| `lip_h` | 4 | How deep the lid lip drops into the base. |

Enable either, or **both**: snaps hold it shut for quick access, screws clamp it down for weather sealing.

### `[Snap-fit]` (when `use_snaps = true`)
| Variable | Default | Meaning |
|---|---|---|
| `snap_count` | 2 | Snaps per long wall. |
| `snap_w` | 6 | Bump width along the wall. |
| `snap_depth` | 0.9 | **Click strength.** Lower (0.6) = easier open; higher (1.2) = firmer lock. |
| `snap_h` | 1.6 | Bump height. |
| `snap_lead` | 0.6 | Chamfer lead-in for easy insertion. |
| `snap_relief` | true | Thin flex slots beside each catch. Keep **on** for PLA/PETG. |

### `[Lanyard loop]`
| Variable | Default | Meaning |
|---|---|---|
| `lanyard` | true | External tab with a cord hole. |
| `lanyard_edge` | `"x1"` | Which wall it sticks out from. |
| `lanyard_pos` | 0.5 | Position along that edge (0 to 1). |
| `lanyard_hole_d` | 4 | Cord / keyring hole diameter. |

### `[LED light pipe]`
| Variable | Default | Meaning |
|---|---|---|
| `ledpipe` | false | Hole in the lid over a status LED. Off because the RAK4631 has no user LED. |
| `led_x`, `led_y` | 6, 4 | LED location on the PCB. **Set these** if you enable it. |
| `led_pipe_d` | 3.0 | Hole diameter. |

### `[Battery shelf]`
| Variable | Default | Meaning |
|---|---|---|
| `battery` | false | Raised retaining pocket in the base floor for a LiPo. |
| `bat_x`, `bat_y` | 35, 20 | Battery footprint. |
| `bat_pos_x/y` | 2, 5 | Pocket position. Make sure it does not collide with the PCB footprint. |

### `[Reset button access]`
| Variable | Default | Meaning |
|---|---|---|
| `reset_hole` | true | Paperclip-poke hole (not a full button). |
| `reset_d` | 3.5 | Hole diameter. |
| `reset_offset` | 9 | Distance along the edge from USB-C center. Flip the sign to mirror. |

### `[Battery / solar pigtail exit]`
| Variable | Default | Meaning |
|---|---|---|
| `pigtail_slot` | true | Rounded slot for JST battery/solar wires to exit. |
| `pigtail_w`, `pigtail_h` | 6, 3 | Slot size. Widen if running battery + solar leads together. |
| `pigtail_offset` | -9 | Distance along the edge from USB-C center (negative = opposite side from reset). |

---

## 7. Common changes — quick recipes

**Tighter board fit:** lower `clr` to 0.3. Too tight to seat? Raise to 0.5.

**Snaps too hard to open:** `snap_depth = 0.6;` and confirm `snap_relief = true;`.

**Bigger antenna headroom (taller stack):** raise `comp_clear`.

**Move USB-C to a long side:** `usbc_edge = "y0";` then set `usbc_y_center` to the position along that side. Remember reset and pigtail default to the short end, so move them too if you want them grouped.

**SMA antenna instead of stock IPEX:** `ant_d = 6.5;` and set `ant_edge` / `ant_pos`.

**Screw-only weather build:** `use_snaps = false;` and add heat-set inserts (below).

---

## 8. Assembly

1. Seat the RAK19007 onto the four standoff posts.
2. Route the LoRa and BLE IPEX/u.FL antennas: peel the adhesive and stick the flat antenna flags to the **inside of the lid** (or a side wall). Keep the two flags apart, and ideally against a non-metallic wall for range.
3. If using a battery, route its JST lead out through the pigtail slot.
4. Close the lid:
   - **Snap lid:** press until the catches click.
   - **Screw lid:** align and drive four **M2.5 x 6 to 8 mm** self-tapping screws into the posts.
   - **Both:** click the snaps for alignment, then drive the screws to clamp.

For frequent opening, melt **M2.5 heat-set inserts** into the posts and use machine screws instead of self-tappers. Far more durable than repeatedly self-tapping plastic.

---

## 9. Material notes (outdoor / hot climates)

- **PLA** prints easiest but softens in heat. A hot car or direct sun will relax the snap click and can sag the case over time. Fine for indoor / bench use.
- **PETG** is the sweet spot: better heat tolerance, flexes well for repeated snap cycles, decent UV resistance.
- **ASA** is best for sustained sun and outdoor exposure.

If this lives outside, the screw lid (optionally with a gasket) holds up far better than snaps alone.

---

## 10. Disclaimer

Dimensions are built from the published RAK19007 datasheet and verified for manifold geometry, but **tolerances vary by board batch and by printer**. Always test-fit before committing to a long or multi-color print.
