# Enigma Witness Vault CAD

Parametric enclosure assets for the Raspberry Pi Zero 2 W witness appliance. The CAD is sized for commodity parts and for printing on a Bambu X1 Carbon.

## Files

- `enigma_witness_vault.scad` — primary parametric OpenSCAD model.
- `generate_witness_vault_stl.py` — dependency-free ASCII STL fallback generator.
- `bambu_profile_notes.md` — print profile, orientation, and material notes.

## Hardware envelopes used

- Raspberry Pi Zero 2 W: 65 × 30 mm board, mounted in the upper/rear electronics bay.
- Pi mounting holes: offsets from Pi origin `[3.5,3.5]`, `[61.5,3.5]`, `[3.5,26.5]`, `[61.5,26.5]`.
- ATECC608A secure element breakout: 25.5 × 17.7 × 4.7 mm sidecar shelf.
- SSD1306 OLED: 0.96 in 128 × 64 I2C display, lid window sized as a 27.5 × 14.5 mm viewing cutout.
- Optional compact PN532 NFC module: 43.6 × 41 × 3.9 mm bay in the front half of the NFC variant.

## Variants

The model exposes two top-level controls:

```openscad
include_nfc = true;   // true: 86 W × 102 L × 28 H mm; false: 86 W × 78 L × 28 H mm
part = "assembly";   // assembly, base, lid, cable_clamp, buttons, nfc_blank
```

- NFC variant: 86 × 102 × 28 mm. Pi origin is `[10.5, 64]`. Includes the PN532 bay and a thin NFC read land in the lid.
- No-NFC variant: 86 × 78 × 28 mm. Pi origin is `[10.5, 40]`. Removes the front PN532 bay to shorten the enclosure.

The OpenSCAD file defines modules for:

- `base_tub()`
- `lid()`
- `cable_clamp()`
- `button_plungers()`
- `nfc_blank()`
- `pi_standoffs()`
- `oled_window()`
- `button_holes()`
- `optional_pn532_bay()`
- `vents()`
- `rear_connector_slots()`
- `heat_set_insert_bosses()`

## Export with OpenSCAD

Open `enigma_witness_vault.scad`, choose `include_nfc` and `part`, render, then export STL.

Example command-line exports:

```sh
openscad -o stl/enigma_witness_vault_base_nfc.stl -D 'include_nfc=true' -D 'part="base"' enigma_witness_vault.scad
openscad -o stl/enigma_witness_vault_lid_nfc.stl -D 'include_nfc=true' -D 'part="lid"' enigma_witness_vault.scad
openscad -o stl/enigma_witness_vault_cable_clamp.stl -D 'part="cable_clamp"' enigma_witness_vault.scad
openscad -o stl/enigma_witness_vault_buttons.stl -D 'part="buttons"' enigma_witness_vault.scad
```

For the no-NFC body, set `include_nfc=false` and export `base` and `lid` again.

## Python STL fallback

If OpenSCAD is unavailable, the Python script creates simple valid ASCII STL approximations using only the standard library. It generates printable box/cylinder approximations for the base, lid, cable clamp, and two separate button plunger files by default.

```sh
python generate_witness_vault_stl.py --out stl
python generate_witness_vault_stl.py --no-nfc --out stl
python generate_witness_vault_stl.py --all-variants --out stl
python generate_witness_vault_stl.py --part base --include-nfc --out stl
python generate_witness_vault_stl.py --part button_1 --out stl
python generate_witness_vault_stl.py --part button_2 --out stl
```

The fallback is intentionally less detailed than the OpenSCAD model: roundovers, true boolean holes, and small relief features are approximated. Use it for build orchestration and fit checks, then use the OpenSCAD STL for final enclosure iterations.

## Import into Bambu Studio

1. Export or generate STL files for the selected variant.
2. Open Bambu Studio and create a Bambu X1 Carbon project.
3. Import each STL as a separate part: base, lid, cable clamp, button_1, and button_2.
4. Confirm units are millimeters.
5. Orient the base open-side up, the lid outside face up, the clamp flat on its broad face, and the buttons with caps up.
6. Apply the PETG or ASA profile notes from `bambu_profile_notes.md`.
7. Slice and inspect connector slots, OLED window, button holes, standoff bores, and PN532 bay clearance before printing production pieces.

## Assembly fit notes

- Use M2.5 hardware for Pi standoffs unless your board kit expects another standard.
- Heat-set insert bosses are modeled for approximately 3.2 mm bores and 4.8 mm OD inserts; adjust `insert_bore` and `insert_od` to match your exact inserts.
- Rear connector slots are intentionally conservative. Widen the `power_slot`, `hdmi_slot`, or `usb_slot` values if your cable shells are oversized.
- Keep conductive or carbon-filled filament away from the NFC and radio regions. The enclosure improves witness custody and operator assurance; it does not prove provider deletion, model forgetting, truth of memories, tamper-proof storage, or complete side-channel absence.
