pi-revit
v0.2.1
Published
Native Pi connector for Autodesk Revit. Run npx.cmd -y pi-revit for the full Windows install.
Maintainers
Readme
pi-revit
Native Revit tools for Pi — ask about, query, script, and modify the open Autodesk Revit model from your terminal.
You: how many levels in the model?
Pi: calls get_model_overview → "There are 14 levels in the Revit model."
You: select all structural columns
Pi: get_elements → manage_selection → "Selected 222 structural columns."
You: rename level 'L1' to 'Ground Floor'
Pi: calls set_parameters → "Done — Level 'L1' is now 'Ground Floor'."How it works
Pi terminal session
│ native tools (registered by the pi-revit extension)
▼
localhost HTTP bridge ← per-start token; connection info in %APPDATA%\RevitBridge\
│
▼
headless Revit add-in ← no ribbon, no panels; just a bridge
│ ExternalEvent queue (Revit API thread)
▼
Revit API ← reads run directly; writes run in one named transactionThe extension discovers its tools from the bridge at startup (/reload re-discovers), so the
tool list always matches what the add-in serves. Everything between Pi and Revit is
local-machine only; note that Pi sends conversation context and tool results to your selected
LLM provider, like any Pi session.
Requirements
- Windows 10/11
- Autodesk Revit 2025, 2026, or 2027
- .NET SDK matching your Revit: .NET 8 for Revit 2025/2026, .NET 10 for Revit 2027
- Node.js 20.3+
- Pi coding agent:
npm install -g --ignore-scripts @earendil-works/pi-coding-agent
Install
One-command install
Close Revit, then in PowerShell:
npx.cmd -y pi-revitThis installs the Pi package, builds and deploys the Revit bridge add-in, creates the
Documents\pi-revit workspace, and installs the global pi-revit command.
Start Revit (click Always Load on the unsigned add-in prompt once) and open any project. No panel or ribbon appears — the add-in is headless.
Manual npm install
Use this if you prefer to run each step yourself:
# 1. Install the Pi package from npm. This registers the pi-revit extension and skill.
pi install npm:pi-revit
# 2. Go to the installed package folder.
cd "$env:USERPROFILE\.pi\agent\npm\node_modules\pi-revit"
# 3. Build + deploy the Revit add-in (RevitBridge.dll + the Roslyn DLLs for execute_csharp).
npm.cmd run deploy
# 4. Create the workspace and global pi-revit command.
npm.cmd run setupFor a non-default Revit install location, use the PowerShell deploy script directly and pass
-RevitVersion / -RevitApiPath, e.g.:
powershell -ExecutionPolicy Bypass -File scripts\deploy.ps1 -RevitVersion 2027 -RevitApiPath "D:\Autodesk\Revit 2027"Source install
Use this if you want to run directly from the GitHub checkout instead of the npm package:
git clone https://github.com/Triavision-ai/pi-revit.git
cd pi-revit
powershell -ExecutionPolicy Bypass -File scripts\deploy.ps1
pi install ./
powershell -ExecutionPolicy Bypass -File scripts\setup-workspace.ps1Use it
Open any terminal — PowerShell, CMD, or Windows Terminal — and type:
pi-revitThat's all. Pi starts with the Revit tools ready:
> give me a model overview
> how many doors per level?
> select all structural columnsHow this works: the setup step placed a small pi-revit command in the same folder as the
pi command itself. That folder is on your system PATH — which is exactly why every terminal
finds pi-revit, with no extra configuration. When you run it, it switches to your workspace at
Documents\pi-revit and starts Pi there, so your conventions file (AGENTS.md) loads
automatically and all Revit session history lives in one predictable place (pi-revit -c
continues the last session). The Revit tools themselves are installed globally in Pi, and the
extension discovers them live from the bridge inside Revit each time a session starts.
Per model, automatically: files sort themselves. Exports land in
Documents\pi-revit\Models\<model title>\exports — the add-in derives the folder from the
document being exported, so even a session that touches many models files every output under
the right one, with no naming decision from you or the AI. Each model folder carries a
model.txt recording the model's GUID and file path, so two models that share a title stay
distinguishable.
Plain pi from any folder also works; pi-revit just adds the right working folder on top.
Tools
| Tool | What it does |
|---|---|
| ping | Is the bridge reachable? Revit version |
| get_model_overview | Project info, units, levels, grids, category counts — call first |
| get_elements | Query/count elements of any category: parameter filters, pagination |
| get_element_details | Parameter values, location, bounding box, materials per element |
| get_element_types | Element types / family symbols, optional placed-instance counts |
| manage_selection | Get/set/clear the selection, zoom, temporary isolate |
| set_parameters | Bulk parameter writes + rename anything (one transaction per batch) |
| search_api_docs | Search the offline Revit API docs (works with no document open) |
| execute_csharp | Run a C# script in one auto-managed transaction — the escape hatch |
| capture_view | PNG snapshot of a view to a temp file (read the returned path to see it) |
| export_documents | PDF/DWG/PNG/IFC export of sheets and views — auto-sorted into Models\<model>\exports |
| get_model_health | Warnings grouped + worksets, phases, design options audit |
Limitations — read before using on real projects
- Write tools are unrestricted by design.
set_parametersandexecute_csharpmodify the open model directly — there is no confirmation prompt and no sandbox. Writes run in named transactions, undoable with Ctrl+Z in Revit (execute_csharprolls back entirely on any error;set_parameterscommits partial successes and reports each failure), but the model is yours to protect: test on copies, keep backups, read the result'sfailedlists. - The add-in multi-targets .NET 8 (Revit 2025/2026) and .NET 10 (Revit 2027);
deploy.ps1auto-detects the Revit versions you have installed and builds only the matching framework(s), so you only need the SDK for the Revit you run. Verified on Revit 2025 and 2027. - One Revit instance at a time is discoverable (last started wins).
- A tool call that outlives its timeout is abandoned client-side but may still complete inside Revit — verify model state before re-issuing a write.
- Long-running scripts cannot be interrupted mid-execution (Revit's API is single-threaded);
the
execute_csharpbudget is 120s.
Uninstall
npm install
Close Revit, then in PowerShell — from any folder outside the installed package (Windows cannot delete a folder your shell is standing in):
powershell -ExecutionPolicy Bypass -File "$env:USERPROFILE\.pi\agent\npm\node_modules\pi-revit\scripts\uninstall.ps1"Source install
Close Revit, then in PowerShell from the GitHub checkout:
powershell -ExecutionPolicy Bypass -File scripts\uninstall.ps1This removes the Revit bridge add-in (every installed Revit version), the global pi-revit
command, the bridge runtime folder (%APPDATA%\RevitBridge\), and the Pi package registration
(it tries both the npm and the source-install form, so no extra pi remove is needed for
either install kind). Your workspace at Documents\pi-revit (notes + session
history) is preserved — add -RemoveWorkspace to delete it too, or -RevitVersion 2026 to
target a single Revit version. Pi itself is left installed; remove it with
npm uninstall -g @earendil-works/pi-coding-agent if you want.
