# Exterior candidate geometry toolchain R01

`tools/crown_exterior_batch.py` generates real editable exterior geometry and views from the same mesh. This batch is proposed design preparation under Building Protocol R05, not a measured reconstruction, accepted shell, coordinated interior or tested engine asset. Original catalog art and issued IDs stay unchanged.

Generation needs Python 3 and NumPy; verification needs only Python's standard library. No Blender, bpy, texture baker, renderer service or engine has been executed by this adapter. The local toolchain investigation found no Blender executable and no available bpy distribution. No `.blend` file is claimed.

```sh
python tools/crown_exterior_batch.py --input path/to/candidate-input.json --out docs/crown-key-production/exterior-batch/R01/assets
python tools/crown_exterior_batch.py --check --out docs/crown-key-production/exterior-batch/R01/assets
```

Input is one asset object, or `{ "schema": "crown-exterior-candidate/1", "assets": [objects] }`. Each asset has `id`, `name`, `family`, `width_m`, `depth_m`, `height_m`, `floors` and `source_refs`. Declared dimensions are author proposals; QA reports actual generated mesh bounds separately. The local pivot has no district placement authority. Geometry uses metres, Z up and front −Y. glTF/GLB rotates to Y up / front +Z with `(x,y,z) → (x,z,−y)`.

Custom `components` replace family defaults. `extras` supplement them:

- `box`: `name`, `location` or `center`, `size`, optional `rotation_z_deg`.
- `beam`: `name`, `start`, `end`, `width_m`, optional `depth_m`.
- `cylinder`: `name`, `location`, `size: [radius_x,radius_y,height]`, optional `sides`.
- `extrusion`: `name`, `polygon: [[x,y],...]`, `z_min`, `z_max`. Do not repeat the first vertex at the end or provide collinear/duplicate boundaries.
- `mesh`: `name`, `vertices`, `faces`, zero-based vertex indices.

All primitives accept `material`. Supported semantic palette keys are `stone`, `glass`, `metal`, `wood`, `green`, `amber`, `white`, `dark` and `water`. These are flat PBR color/roughness proxies, not textured finish production. Unrecognized material keys fall back to stone. Concave polygon caps use ear-clipping triangulation shared by OBJ and glTF. Invalid polygon boundaries fail rather than silently filling a courtyard with a triangle fan. Authors remain responsible for surface winding, nonplanar face construction and interpenetration checks.

Four camera names are fixed: `hero`, `rear`, `entry`, `detail`. Hero/rear frame the full mesh; entry/detail crop the same mesh with explicit saved targets. Inputs may specify `entry_target_m`, `entry_view_width_m`, `detail_target_m`, `detail_view_width_m`, or `camera_overrides` keyed by camera name, containing azimuth/elevation/target/framing/width. `cameras.json` records actual positions and targets. SVG views are deterministic polygon projections with approximate centroid painter sorting, not ray-traced images; narrow overlapping structural members need independent visual review. They are model views, not AI-generated reference replacements.

`plans/ground.svg` is an exact mesh intersection with horizontal plane Z=1.2 m (override `ground_plan_cut_z_m`). `plans/section.svg` intersects X=0. Front/side are orthographic elevations; roof is a complete top projection. These show exterior candidate geometry, not accepted internal enclosures or room fit. No usable doors, routes, shafts, stairs, collision or interior clearances are inferred from them.

Per asset, outputs are `model.json` (compact canonical input), `model.obj`, `model.mtl`, `model.gltf` (embedded buffer), `model.glb`, four `views/*.svg`, five `plans/*.svg`, `cameras.json`, `QA.json`, `MANIFEST.json` and `blender_import.py`. Handwritten asset documents are preserved and included in the manifest. Re-run after adding/changing any asset file. Compact a source input with the same `json.dumps(..., separators=(',',':'), ensure_ascii=False)+'\n'` representation to share its Git blob with canonical `model.json` instead of storing duplicate expanded component lists.

`--check` is read-only. It verifies manifest coverage/size/SHA-256, actual finite OBJ vertices/bounds/part/triangle counts, source-model and canonical-input hashes, GLB magic/version/declared length, and false acceptance gates. It is not a collision, self-intersection, architectural, material, engine or aesthetic acceptance test.

In Blender, run the delivered adapter to create a new editable file and register the four source-model cameras plus neutral review lighting:

```sh
blender --background --python /absolute/path/blender_import.py -- /absolute/path/exterior-candidate.blend --render
```

The optional render flag writes four PNGs beside the imported model; these are future developer outputs, not files claimed in this batch. Validate the adapter in the actual Blender version before treating the resulting file as accepted. Original proposed layout, source art, and runtime acceptance remain separate.
