# Arm fabricator

An articulated fabricator that has to reach for its work. The turret yaws toward the cell being laid and the shoulder and elbow are solved with the analytic two-link elbow, in the arm's own vertical plane.

> 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/arm-fabricator.json
```

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

## Notes

- Solved: the yaw, the shoulder and the elbow. Illustrated: the wrist, which holds the nozzle vertical because that is how a deposition head works rather than being solved for an orientation.
- The goal is clamped onto the reachable sphere before the elbow is solved, so both links always hold the lengths they claim. A cell the arm cannot get to shows as a longer beam, never as a stretched forearm — and the arm is placed so that, at the shipped link lengths, no cell in the volume is out of reach.
- Same field, same deposition order and same build line as the rest of the family: only the body carrying the nozzle is different.

## Usage

```tsx
import { ArmFabricator } from "@/components/ui/arm-fabricator"

<ArmFabricator shape="gear" behavior="build" elbow="up" />

// Controlled, or a control:
<ArmFabricator progress={0.45} resolution={7} view="profile" />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `shape` | `"sphere" | "block" | "pyramid" | "gear" | "vessel" | "lattice"` | `"gear"` | Which occupancy field to sample. |
| `resolution` | `number` | `6` | Voxels along one edge, rounded and clamped to 2–14. |
| `progress` | `number` | — | Controlled build fraction, clamped to 0–1. |
| `behavior` | `"build" | "layer" | "refine" | "idle" | "static"` | `"build"` | The shared fabricator cycle. |
| `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. |
| `onProgressChange` | `(progress: number) => void` | — | The commanded build fraction. |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"iso"` | Where the camera stands. |
| `elbow` | `"up" | "down"` | `"up"` | Which way the elbow breaks. Both are valid solutions for the same tip position. |
| `showPlate` | `boolean` | `true` | The build plate and the volume printed on it. |
| `showReadout` | `boolean` | `true` | Build percentage and voxel resolution. |
| `showGround` | `boolean` | `true` | Contact shadow under the cell. |
| `signal` | `"idle" | "ready" | "warning"` | — | Shoulder 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/arm-fabricator.tsx`
