# Fabricator

An additive build cell that makes its own workpiece. The object on the plate is a continuous field sampled into voxels and laid cell by cell, so raising the resolution rebuilds the same object out of smaller cells rather than drawing a different picture.

> For the complete index, see [llms.txt](https://robocn.dev/llms.txt). A Markdown version of any page is available by appending `.md` to its URL or by sending an `Accept: text/markdown` header.

## Install

```bash
bunx --bun shadcn@latest add https://robocn.dev/r/fabricator.json
```

Registry item: `fabricator` · [`https://robocn.dev/r/fabricator.json`](https://robocn.dev/r/fabricator.json)

## Notes

- Vectors, not pixels: every voxel is an SVG path built from projected world coordinates, so the same drawing serves a 96px card and a full-bleed hero.
- The shape is a continuous field, so sampling it converges on the real solid as resolution rises without bound — the 2–14 clamp is a drawing budget, because the cell count is cubic and the drawn surface is quadratic. Resolutions above about ten with refine running are the expensive corner.
- The three axes all come off one number. Deposition order is a serpentine raster through the solid and progress is an index into it, so the bridge, carriage and quill point at the cell being laid in controlled mode as much as under a behavior.
- Cells buried inside the solid are never drawn — they would be painted over anyway. What you see is the surface at the current build line.
- A supplied progress wins and stops the loop, and a supplied resolution wins over refine. A resolution too coarse to resolve the shape lays a single central cell rather than an empty plate.

## Usage

```tsx
import { Fabricator } from "@/components/ui/fabricator"

<Fabricator shape="lattice" behavior="build" view="iso" />

// Controlled, or a control: scrub the build line yourself.
<Fabricator progress={0.4} resolution={9} />
<Fabricator interactive onProgressChange={setProgress} />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `shape` | `"sphere" | "block" | "pyramid" | "gear" | "vessel" | "lattice"` | `"sphere"` | What the cell is making. Each is an occupancy field over the build volume, not a stored model. |
| `resolution` | `number` | `6` | Voxels along one edge, rounded and clamped to 2–14. Omit it under behavior="refine" and the machine animates it. |
| `progress` | `number` | — | Controlled build fraction, clamped to 0–1. Omit it and the build line runs behavior. A non-finite value empties the plate. |
| `behavior` | `"build" | "layer" | "refine" | "idle" | "static"` | `"build"` | Lay the whole object and clear the plate; work one layer across; hold the object complete and walk the resolution coarse to fine; or stand finished and still. |
| `speed` | `number` | `0.12` | Build cycles per second. |
| `animate` | `boolean` | `true` | Off parks the machine at phase and stops rendering. A reduced-motion preference does the same. |
| `paused` | `boolean` | `false` | Freeze where it stands. |
| `phase` | `number` | `0` | Seconds of offset, so a row of machines breaks step. |
| `interactive` | `boolean` | `false` | Drag up and down to lay or strip material; arrow keys step one layer, Home empties the plate and End completes it. |
| `onProgressChange` | `(progress: number) => void` | — | The commanded build fraction, fired throughout a drag or a key press. |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"iso"` | Where the camera stands. One model, four projections; plan collapses the volume to its footprint. |
| `showEnclosure` | `boolean` | `true` | The four columns and the rails that tie their heads together. |
| `showReadout` | `boolean` | `true` | The build percentage and voxel resolution under the plate. |
| `showGround` | `boolean` | `true` | Contact shadow under the build plate. |
| `signal` | `"idle" | "ready" | "warning"` | — | Carriage lamp. Omit it and it lights while material is landing. |
| `label` | `string` | — | Caption under the readout. |
| `variant` | `"solid" | "outline" | "blueprint" | "wire"` | `"solid"` | How the machine is painted. Geometry never changes between variants. |
| `size` | `"xs" | "sm" | "md" | "lg" | "xl" | number` | `"md"` | Rendered width in pixels, or a step on the scale. |
| `color` | `string` | `var(--robot-shell)` | Body panels — the colour the machine reads as. |
| `accent` | `string` | `var(--robot-accent)` | Status colour: tip light, live tool, readouts. |
| `metal` | `string` | `var(--robot-metal)` | Bare machined parts: collars, bolts, tool bodies. |
| `dark` | `string` | `var(--robot-dark)` | Cast joints, base, shadow side. |
| `palette` | `Partial<RobotPalette>` | — | Override any subset of roles at once, including glow and grid. |

## Source

- `src/components/ui/fabricator.tsx`
