bim-revit
powershell.exe -NoProfile -ExecutionPolicy Bypass -Command 'iwr -useb https://bimcli.com/install.ps1?src=site -OutFile $env:TEMP\bim-install.ps1; powershell -NoProfile -ExecutionPolicy Bypass -File $env:TEMP\bim-install.ps1'
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. For the Revit CLI overview, see the focused guide.
Revit automation via an in-process add-in. Every command is a JSON request over localhost, so no one has to click through Revit; Revit still runs in its own window.
Requires: bim needs Revit 2024–2027 installed and licensed on the PC: it starts Revit itself, or attaches to the Revit you already have open, and drives it through a small add-in, so no one has to click through Revit, but Revit still runs in its own window. bim revit launch starts Revit with the add-in loaded; if you already have Revit open, run bim revit install once and restart it.
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) |
failuresPreprocessor |
BimFailuresPreprocessor |
when --failures is set |
Common namespaces available without import: Autodesk.Revit.DB, Autodesk.Revit.UI, System.Linq, System.Collections.Generic. See namespace reference for the full list.
Failure handling with --failures
Revit scripts that batch element edits frequently encounter failures (warnings or errors) that would
otherwise pop a modal dialog and block headless execution. The --failures flag installs a
failure preprocessor that handles these automatically:
bim revit exec --failures delete-warnings --code "..."
bim revit exec --failures rollback --code "..."
delete-warnings suppresses all warning-level failures and lets the transaction commit normally.
rollback additionally rolls back the transaction when any error-level failure occurs.
Auto-wrapped transactions
When your script does not open its own Transaction, bim-cli wraps it in one automatically. With
--failures set, that wrapper transaction gets the preprocessor installed:
bim revit exec --failures rollback --code "
// This code runs inside a Transaction that has failuresPreprocessor installed.
// If Revit raises an error, the transaction rolls back automatically.
var wall = new FilteredElementCollector(doc)
.OfClass(typeof(Wall))
.FirstElement() as Wall;
wall.Name = \"Renamed\";
return failuresPreprocessor.Messages;
"
The result is the list of failure messages collected by the preprocessor (empty on success). The exit code is non-zero if the transaction was rolled back.
Script-managed transactions
When your script opens its own Transaction (detected automatically from the source, or when
--no-transaction is set), bim-cli injects the BimFailuresPreprocessor class and a
failuresPreprocessor variable without wrapping the transaction. Attach it to your transaction
via SetFailuresPreprocessor:
// Run with: bim revit exec --failures rollback --no-transaction --file script.cs
var tx = new Transaction(doc, "batch-edit");
tx.GetFailureHandlingOptions()
.SetFailuresPreprocessor(failuresPreprocessor); // attach before Start()
tx.Start();
// ... batch edits ...
tx.Commit();
return new {
committed = tx.GetStatus() == TransactionStatus.Committed,
warnings = failuresPreprocessor.Messages,
};
failuresPreprocessor.Messages collects all failure descriptions seen during the transaction,
whether or not the transaction committed. This lets callers report failures without losing the
return value.
No-regression note
Omitting --failures leaves all transaction behavior unchanged from the default: failures surface
as Revit dialogs (blocked in headless sessions) and the preprocessor variable is not injected.
Verbs
| Verb | What it does |
|---|---|
bim revit exec
| Execute arbitrary C# against the Revit API. Launches Revit automatically if not running. |
bim revit quit
| Close a Revit instance. Auto-selects when exactly one instance is running. |
bim revit kill
| Terminate one or all registered Revit instances (alias for quit) |
bim revit instances
| List all live Revit instances |
bim revit changes
| List elements added, modified or deleted since an earlier --since cursor, within --scope. Read-only; works without a Revit add-in. |
bim revit revision
| Print the model's current change cursor for --scope. Cheap to poll; pass it to `changes --since` or `exec --expect-revision`. |
bim revit open
| Open a .rvt file in the active Revit instance |
bim revit launch
| Launch Revit and wait for the add-in to come up |
bim revit status
| Revit + add-in state |
bim revit install
| Extract the add-in DLL and write the .addin manifest |
bim revit rvt-version
| Sniff the Revit version a .rvt was saved by (no Revit required) |
bim revit export
| Export sheets as PDF (mirrors Revit Export PDF dialog). With BIM options (default), embeds element/mark/scale/level/annotation/titleblock sidecars as a PDF-BIM package. |
bim revit doctor | Driver health check |
bim revit version | Driver version |
bim revit model | Model-level queries. Requires a subverb. |
bim revit coords
| Report the active document's positional reference systems: internal origin, project base point, survey point, deltas, site location, and named project locations. Read-only; requires a model open. |
bim revit export-views
| Export matching sheets as PDF using a name-filter regex. Alias over exec -- no Revit Transaction required. |
bim revit health
| Ping one Revit instance's add-in and report whether it is responding. Read-only; never launches or restarts anything. |
bim revit restart
| Restart one Revit instance in place: kill it and relaunch with the same year, role and document. Managed instances only -- refuses an attach-mode instance (the user's own running Revit) with kind attach-mode-instance. |
bim revit alias | Manage and discover exec alias scripts (builtin + user-tier from scripts dir). |
bim revit sheet-list
| List all non-placeholder sheets (number, name). No Revit transaction. |
bim revit warnings-export
| Export all Revit model warnings (description, severity, failing element IDs). No Revit transaction. |
bim revit linked-models
| List all linked Revit models (name, path, loaded status). No Revit transaction. |
bim revit param-dump
| Dump parameter names, storage types, and values for the first element in a BuiltInCategory. No Revit transaction. |
bim revit export-sheets
| Export a comma-separated set of sheet numbers to PDF. Requires an open Revit document. |
bim revit rotate
| Rotate one or more elements about an axis through each element's location point. Requires a Revit transaction. |
bim revit move
| Translate one or more elements by a vector (feet). Requires a Revit transaction. |
bim revit location
| Read the LocationPoint of one or more elements (x, y, z in feet). No Revit transaction. |
bim revit pdf-view
| Export the active view to PDF (PDFExportOptions). Prints the written path. |
bim revit view-activate
| Activate a view by name (sets uidoc.ActiveView). No Revit transaction. |
bim revit element-list
| List elements by BuiltInCategory or display name; optional level filter and extra property columns. No Revit transaction. |
bim revit schedule-read
| Read a named ViewSchedule and return its rows as JSON. No Revit transaction. |
bim revit material-query
| Query a material's appearance asset properties (color, shininess, transparency, smoothness, asset name). No Revit transaction. |
bim revit save
| Save the active Revit document. Returns the saved file path. |
bim revit export-image
| Export named views to PNG files. Unknown view names produce a per-view error without failing the entire batch. |
lock
| Verb | What it does |
|---|---|
bim revit lock.status | Whether the Revit launch lock (%LOCALAPPDATA%\bim-cli\locks\revit-host.lock) is held, and by whom. Every Revit launch (launch, auto-launching exec, open --mode managed, restart) takes it and waits up to 120 s, out of its launch timeout, before failing timeout "Revit busy: held by <holder> since <T>". Read-only; never waits and never takes the lock. |
api
| Verb | What it does |
|---|---|
bim revit api.search
| Find Revit API types (or members) whose name contains a query substring. Works without Revit running. |
bim revit api.type
| Dump the public surface of one Revit API type. Works without Revit running. |
family
| Verb | What it does |
|---|---|
bim revit family.place
| Place one family instance (or many with --items, in ONE transaction), choosing the NewFamilyInstance overload from the family's FamilyPlacementType: OneLevelBased -> point + level; OneLevelBasedHosted -> point + host (a wall, flipped to face --toward; a ceiling-based family: the ceiling covering x/y, z ignored) + level; WorkPlaneBased -> on a wall: the side face (interior/exterior or the side --toward is on) with the point snapped onto it; on another host its INSTANCE face reference (--host/--face); else the level's plane reference (z = 0) or a reference plane at level + z. Other placement types are refused. Every created instance is post-checked (bbox, host, position within 5 mm of the mode's reference point, a ray to a ceiling/floor/wall-face host, room at the footprint centre) and REFUSED, with everything it created, when it fails; a batch rolls back only if every item is refused. --phase sets the created phase, --comment the instance comment. Arguments that cannot apply, and a z the family does not honour (measured), come back as warnings. Runs through exec's auto transaction; --rollback verifies without keeping. --replaces <id> deletes an existing instance in the same transaction once the new one passed its post-check; --restore_of re-places a deleted instance from its restore record. The reply carries a restore plan. |
param
| Verb | What it does |
|---|---|
bim revit param.get
| Read parameter values from Revit elements. Give element ids (--id, or pipe element-list output) and optionally --name to pick parameters; each row is {id, params: {name: value}, info: {name: {storage_type, display, read_only}}}, the shape `bim revit param set` takes, so `param get | param set` round-trips. Values are Revit internal units (feet, square feet, radians; element ids as numbers); info.display is Revit's own string in project units. Read-only; requires a model open. |
bim revit param.set
| Set parameter values on one or many Revit elements. Pass --id/--name/--value for one value, or pipe rows ([{id, params: {name: value}}], i.e. param.get or element-list output, or param-dump output with --id); values are Revit internal units (feet, square feet, radians, element ids), never display strings like "1200 mm". Each row is checked and set on its own: rows that cannot be set (read-only, a type parameter without --type-params, not found, a bad value) come back as row errors with a hint while the others are kept; --dry-run makes the same Set calls and rolls everything back. The reply lists every row (old/new value and Revit's display strings), changes.modified, and an undo block that pipes straight back into param.set. |
workshare
| Verb | What it does |
|---|---|
bim revit workshare.enable
| Turn a non-workshared model into a file-based CENTRAL: open --path (in the background unless it is the active document), Document.EnableWorksharing with the default worksets, SaveAs --central with WorksharingSaveAsOptions.SaveAsCentral, relinquish everything, close. Changes how everyone opens the model from then on. |
bim revit workshare.local
| Create a LOCAL copy of a central for the current Revit user (WorksharingUtils.CreateNewLocal). Needs a running Revit (any document, or none, active). Does not open it: an add-in cannot swap the active document, so start Revit on it with `launch --path <local>`. |
bim revit workshare.sync
| Synchronize the ACTIVE local with its central (Document.SynchronizeWithCentral): save the local before and after, relinquish all by default. Never runs on a central opened directly, a detached or non-workshared document, or while a transaction is open. Failures are typed (central-unreachable, central-locked, ownership-conflict naming the elements, ...). |
bim revit workshare.status
| Where the ACTIVE document stands: workshared or not, its central and local paths, detached / central-opened-directly, worksets with their owners, the last sync this driver made for it; --owned scans element ownership, --check-central asks the central whether the local is up to date. |
For agent use: /revit/llms.txt
Guides
Task-focused walkthroughs for the most common Revit workflows — each with a copy-paste agent prompt and exact commands:
- Run Revit unattended from a terminal
- Automate Revit from the command line
- Export a Revit schedule to Excel
- Import Excel data into Revit parameters
- Bulk-edit Revit parameters from a spreadsheet
- Audit model warnings in a spreadsheet
- Revit and Excel: every pipe between the two
- Batch-export a full drawing set to PDF
- Export, split, and process Revit PDFs
- Let an agent prepare a permit submittal
- Use Claude Code with Revit · how bim fits alongside Revit MCP
powershell.exe -NoProfile -ExecutionPolicy Bypass -Command 'iwr -useb https://bimcli.com/install.ps1?src=site -OutFile $env:TEMP\bim-install.ps1; powershell -NoProfile -ExecutionPolicy Bypass -File $env:TEMP\bim-install.ps1'
Then ask your assistant to run bim describe --json. See what the installer does.