bim-revit

Drive a running Revit session from the command line. Export sheets to PDF with BIM sidecars, read schedules, write parameters across hundreds of elements, list model warnings, run arbitrary code against the open document. The kind of work that takes a half-hour for someone fluent in visual scripting, and a full afternoon by hand.

Revit automation via an in-process add-in. Every command is a JSON request over localhost — no keyboard, no mouse, no Revit window in focus required.

Requires: Revit 2024, 2025, or 2026 running with the revit-cli add-in loaded. Run bim revit install once to register the add-in, then restart Revit.

How it works

The revit-cli add-in binds to a dynamic port at startup and writes it to %LOCALAPPDATA%\bim-cli\instances\revit-<pid>.json. bim-revit reads that file, sends JSON requests, and the add-in executes them in Revit's main thread. Multiple Revit instances are supported — use bim revit instances to list them and --pid to target one.

exec globals

These variables are pre-injected into every bim revit exec snippet:

Variable Type Available when
uiApp Autodesk.Revit.UI.UIApplication always
app Autodesk.Revit.ApplicationServices.Application always
doc Autodesk.Revit.DB.Document when a document is open
uiDoc Autodesk.Revit.UI.UIDocument when a document is open
linkedDocs IEnumerable<Document> when a document is open
allDocs IEnumerable<Document> when a document is open (active + linked)

Common namespaces available without import: Autodesk.Revit.DB, Autodesk.Revit.UI, System.Linq, System.Collections.Generic. See namespace reference for the full list.

Verbs

Verb What it does
bim revit export [--sheet N] [--all-sheets] [--bim] [--output DIR] export sheets to PDF; --bim writes 6 JSON sidecars (elements, marks, rooms, levels, properties, views)
bim revit instances list all live sessions with pid, port, active document
bim revit status [--detailed] running instance, model, port, add-in state; --detailed adds installation and version checks
bim revit launch [--path MODEL] start Revit and wait for add-in; streams NDJSON progress
bim revit kill [--pid PID] [--all] terminate one or all Revit instances and clean up registry entries
bim revit open --path FILE open a .rvt in the running session
bim revit install install the add-in DLL and manifest
bim revit rvt-version <file> sniff saved-by version (no Revit needed)
bim revit exec --code "C#" run C# against the live Revit API
bim revit exec --file script.cs run a .cs file
bim revit sheets list all sheets with number, name, and discipline
bim revit schedule export <name> export a named schedule as NDJSON rows
bim revit warnings list all model warnings with element IDs and descriptions
bim revit families list all loaded families and types
bim revit param set --by Mark write parameters from stdin NDJSON
bim revit purge [--dry-run] remove unused families, types, and views
bim revit api search "query" search Revit API XML docs
bim revit api type "Namespace.Class" all members of a type
bim revit api describe "M:..." full docs for one member ID

For agent use: /revit/llms.txt