# split_3d_model: one 3D model into part meshes

**Input:** one `.glb .gltf .obj .ply .stl .off` or `.blend` file. A `.gltf` must be self-contained (embedded buffers
and images). Limits: 200,000 faces, 50 MB. The price follows the face count (`mcpbytes.py tools`, `pricing`). A job takes about 30 to 60 seconds.

**Options**

| Option | Values | Meaning |
|---|---|---|
| `detail` | `low`, `medium` (default), `high` | How finely to split: low = major assemblies, high = sub-parts. |
| `format` | `glb` (default), `obj`, `ply` | File format of the parts and colliders. |
| `max_parts` | 1-64 | Safety ceiling on the part count, which is chosen automatically (capped at 32). |
| `min_part_faces` | integer (default 0) | Merge parts with fewer faces. |
| `min_part_area` | 0-1 | Merge parts below this fraction of the surface area. |
| `preprocess` | `auto` (default), `on`, `off` | Connectivity cleanup of the working mesh. |
| `segmented` | `true` (default), `false` | Also write `segmented.glb`. |
| `density` | number (default 100) | Mass per cubic model unit, for the mass estimates. |

Start with the defaults. If the parts are too coarse, run again with `detail: high`; if there are too many small
parts, use `detail: low` or raise `min_part_area` (each run is charged again, so ask the user first).

**Result summary:** `part_count`, `input_faces`, `exported_faces`, `notes`, `timings_s`.

**Output files**

- `manifest.json`: every part with its file, bounds, contacts with other parts, symmetry, collider, and mass and
  inertia estimates. Read this first (it is text: `read_job_file`, or `mcpbytes.py read`).
- `meshes/part_NNN.glb`: each part's original geometry, materials and textures. Parts are numbered by decreasing
  surface area, so `part_000` is the largest. The names carry no meaning: use the manifest's bounds and contacts.
- `collision/part_NNN.glb`: a convex collider per part, in the same coordinates.
- `segmented.glb`: all parts in one file, color-coded, for a quick visual check.
- `metadata/face_to_part.bin`: the part id of every original triangle.
- `<model>_parts.zip`: all of the above in one archive (left out, with a note, above 100 MB). Download this when the
  user wants the files; download single parts when only some are needed.

All files share the input's coordinate system: place every part and collider at the model's root transform to
rebuild the model.

**Errors:** `invalid_mesh` (corrupt file, or no triangle geometry), `unsupported_feature` (for example Draco
compression, or a `.blend` that links other files), `limit_exceeded` (more faces than the plan allows: decimate the
model first), `segmentation_failed` (no usable parts), `timeout`.
