Bulk-edit Revit parameters from the command line

Most teams do this one of two ways: a per-seat add-in that needs Revit open and someone clicking through it, or a visual scripting environment that assumes you've built the graph yourself. This page is the third path: open the spreadsheet, ask your assistant to push it back into the model, walk away.

bim-cli reads and writes Revit element parameters from a terminal. Any parameter readable or writable via the Revit API is accessible through bim revit exec or the Excel pipe.

How it works today

bim revit exec runs arbitrary C# against the live Revit API and returns JSON. The Revit API's FilteredElementCollector and Element.get_Parameter give full read/write access to any parameter in the open model — instance, type, shared, or project.

Revit must be running with the bim-revit add-in loaded. See headless revit for setup.

Read parameters

count walls in the model
bim revit exec "return new FilteredElementCollector(doc).OfClass(typeof(Wall)).Count();"
{"ok":true,"data":847}
read the Mark parameter for all doors
bim revit exec "
  return new FilteredElementCollector(doc)
    .OfCategory(BuiltInCategory.OST_Doors)
    .WhereElementIsNotElementType()
    .Select(e => new { id = e.Id.IntegerValue, mark = e.get_Parameter(BuiltInParameter.ALL_MODEL_MARK)?.AsString() })
    .ToList();
"
{"ok":true,"data":[{"id":1234567,"mark":"D-01"},{"id":1234568,"mark":"D-02"}]}
read a shared parameter by name across all rooms
bim revit exec "
  return new FilteredElementCollector(doc)
    .OfCategory(BuiltInCategory.OST_Rooms)
    .WhereElementIsNotElementType()
    .Select(e => new { id = e.Id.IntegerValue, name = e.Name, area = e.get_Parameter(BuiltInParameter.ROOM_AREA)?.AsDouble() })
    .ToList();
"

Write parameters

set the Mark parameter on a specific element by ID
bim revit exec "
  using (var tx = new Transaction(doc, \"set mark\")) {
    tx.Start();
    var el = doc.GetElement(new ElementId(1234567));
    el.get_Parameter(BuiltInParameter.ALL_MODEL_MARK).Set(\"D-01-REVISED\");
    tx.Commit();
  }
  return true;
"
bulk-rename all sheets matching a prefix
bim revit exec "
  var sheets = new FilteredElementCollector(doc)
    .OfClass(typeof(ViewSheet))
    .Cast<ViewSheet>()
    .Where(s => s.SheetNumber.StartsWith(\"A\"))
    .ToList();
  using (var tx = new Transaction(doc, \"renumber\")) {
    tx.Start();
    foreach (var s in sheets)
      s.SheetNumber = \"X\" + s.SheetNumber;
    tx.Commit();
  }
  return sheets.Count;
"
{"ok":true,"data":34}

Export a schedule to JSON

Named schedules can be exported directly without writing C#:

export a schedule as NDJSON rows
bim revit schedule export "Door Schedule"
{"number":"101","type":"Single Flush","mark":"D-01","width":914,"height":2134}
{"number":"102","type":"Double Flush","mark":"D-02","width":1828,"height":2134}

The Excel pipe

In v0.1, bim-excel adds a bidirectional Excel driver. An agent can read a parameter spreadsheet and write it back to the model in one pipe — no manual copy-paste, no open Revit window interaction required.

read params from Excel, write to Revit (v0.1)
bim excel read params.xlsx | bim revit param set --by Mark
export a schedule to Excel (v0.1)
bim revit schedule export "Door Schedule" | bim excel write doors.xlsx
audit warnings to a spreadsheet (v0.1)
bim revit warnings list | bim excel write audit.xlsx