# Brick-built X-ray microscope — revised designs

All three designs from the supplied “Brick X-ray Microscope package” have been revised to address the digital buildability findings.

| Design | Builder | Approximate scale | Listed items | Part/color combinations |
| --- | --- | --- | ---: | ---: |
| Easy | xrm-easy-model.js | 1:8 | 93 | 39 |
| Standard | xrm-model.js | 1:4 | 268 | 53 |
| Advanced | xrm-advanced-model.js | 1:2 | 631 | 78 |

The three wrappers share `revised-model.js`. Parts use locally stored official LDraw geometry, including studs, underside cavities and connector holes. `original-models/` preserves the original builders and audit. The full original supplied package remains under `original-package/` in the ZIP.

## Explore

Open `/build/lego-xray` or `/models/lego-xray/index.html?level=standard`. The level links switch complete models. Open cabinet reveals the interior; component and part selection highlight matching pieces. Parts support search, color filters, bounded pagination and catalog links. Phones switch between 3D model, Parts and Components with the bottom navigation.

Advanced uses Medium Angular Motor 88018, its specified Technic Large Hub 88016, a pinned cradle, 4L axle and retaining bush. Its preview rotates the motor output and sample together at 1:1. Motion starts only after Run motor, pauses when hidden, and stops when reduced-motion preferences change. The website does not control physical hardware.

Read [BUILDABILITY.md](BUILDABILITY.md) for the exact fixes, checks and remaining physical test requirements. All revisions pass the declared connection and body-envelope checks, the catalog color check and sampled non-mating mesh checks. None has been physically built or motor-tested.

## Downloads

- `parts-{level}.csv`: revised inventories, generated from the model. Motor and hub rows refer to complete LEGO products. 4032 uses the axle-hole variant **4032a**.
- `model-{level}.ldr`: exact-variant, editable LDraw rest-pose models. The included `ldraw/` subset contains every reference and the original authors' license notices. Configure an LDraw-compatible editor to use this subset if its installed library lacks a reference.
- `lego-xray-microscope.zip`: all revised levels, original package, viewer, source, validation data, LDraw subset, shared interface tokens and local Three.js runtime.
- Viewer: GLB or OBJ + MTL mesh exports. Exports restore materials, cabinet pieces and both motor/stage angles before saving. They are not brick instructions.

## Serve the extracted ZIP

Keep the bundle's directory structure:

    python3 -m http.server 8000

Open `http://localhost:8000/models/lego-xray/index.html`. Geometry and Three.js load locally without a CDN. Home/build/design-note navigation expects the full Next.js website; the viewer and its downloads work independently.

## Reproduce

From the project root, run `node scripts/audit-lego-xray.mjs`. This regenerates inventories, LDraw files and the connection report and fails on its geometric assertions. Add `--solids` to generate temporary reference-mesh input for `scripts/check-lego-xray-solids.py` (NumPy, SciPy, trimesh and rtree required). The latter is a bounded sampling check, not an exhaustive collision solver.

`prepare-lego-xray-parts.py` converts an extracted official LDraw library into the attributed local subset and runtime geometry (NumPy required). No reference meshes were manually stretched to fit the model.

Advanced counts the motor and complete hub/battery product as one inventory item each: 631 listed items correspond to 632 physical pieces.

The source includes a LEGO display model, not an operational X-ray microscope. LEGO is a trademark of the LEGO Group; this independent project is not affiliated with or endorsed by it. LDraw geometry retains its CC BY license notices in `ldraw/CAreadme.txt`; Three.js retains its MIT license in the shared vendor folder.
