# allyhub 3d-model

> Builds a 3D model's TypeScript module (defineModel) into a GLB; --inspect measures it without writing one

Source: https://allyhub.com/docs/reference/cli/3d-model · AllyHub 0.10.0
Index of all docs: https://allyhub.com/llms.txt

## Usage

```bash
allyhub 3d-model [file] [options]
```

## Arguments

| Argument | Type | What it is |
| --- | --- | --- |
| `<file>` | string | The model module, a .ts, .mts, .js or .mjs file whose default export is defineModel(build) |

## Options

| Option | Type | Default | What it does |
| --- | --- | --- | --- |
| `--inspect` | boolean | `false` | Measure it without writing a GLB: each object's parent, matrix, bounds (Blender Z-up metres), triangles, materials as glTF reads them, UV layers, a curve's splines |
| `--args` | string | `"{}"` | What the module's build is given (defineModel's parameters), a JSON object |
| `--out` | string |  | The GLB to write (default .allyhub/out/&lt;module&gt;.glb, named as the module is); one there is replaced only after the build succeeds |
| `--fresh` | boolean | `false` | Build anew instead of reusing the build kept in .allyhub/cache/model (one is reused while the module, the files it read, its parameters, seed and the modelling runtime are unchanged); the new build is kept too |

## Parameters

Each is given as `--param name=value`.

| Name | Type | Default | What it does |
| --- | --- | --- | --- |
| `seed` | integer | `0` | Seed of the build's random generator (bpy.random, 32 bits) |

## Global options

`--dir <value>`: the project's folder; default the one around where it is run. `--json`: print the result as JSON.

## Examples

```bash
allyhub 3d-model models/table.ts
allyhub 3d-model models/table.ts --inspect --args '{"width":1.8}'
```

## Exit codes

`0` when it succeeds; the others are listed in [Exit codes](https://allyhub.com/docs/reference/cli/exit-codes.md).

## In the work

**modeling**: Modelling a prop in code, or adding one from a library

[`add search`](https://allyhub.com/docs/reference/cli/add-search.md) → [`add`](https://allyhub.com/docs/reference/cli/add.md) → `3d-model` → [`3d-model capabilities`](https://allyhub.com/docs/reference/cli/3d-model-capabilities.md)
