Revit version-specific API quirks
install bim-cli · windows · per-user · no admin
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'
API surface changes across Revit 2022–2026 that affect bim revit exec snippets. Check here before assuming a member exists — and use bim revit api search to verify against your installed version.
ElementId
| Revit version | Access element ID as integer |
|---|---|
| 2022, 2023 | element.Id.IntegerValue |
| 2024+ | element.Id.Value (returns long; IntegerValue removed) |
If your snippet needs to run on both old and new versions, use bim revit api type --name Autodesk.Revit.DB.ElementId --members Value,IntegerValue --revit-version 2026 to check availability.
ProjectPosition (latitude/longitude)
| Revit version | Notes |
|---|---|
| 2022–2024 | doc.ActiveProjectLocation.GetProjectPosition(...).Latitude works |
| 2025 | Latitude and Longitude removed from ProjectPosition; use doc.SiteLocation or the SiteLocation.Latitude/Longitude API instead |
Transaction API
| Pattern | Notes |
|---|---|
| Auto-transaction (default) | bim revit exec wraps your snippet in a Transaction automatically. Safe for write operations. |
--no-transaction | Required when: setting uidoc.ActiveView, calling doc.Regenerate() standalone, or managing your own nested transactions. |
uidoc.ActiveView = view | Throws InvalidOperationException inside the auto-transaction. Fix: add --no-transaction to the exec call. |
PDF export
| Revit version | Notes |
|---|---|
| 2022+ | doc.Export(folder, PDFExportOptions, IList<ElementId> viewIds) available. PDFExportOptions.CombinedFile = false = one PDF per view. |
| All versions | Write the export loop in an exec snippet using doc.Export(folder, options, viewIds), or use --file for longer scripts. |
.NET target by Revit year
| Revit | .NET target | TCP port |
|---|---|---|
| 2022, 2023 | net48 (.NET Framework 4.8) | 14700, 14701 |
| 2024 | net48 (.NET Framework 4.8) | 14702 |
| 2025, 2026 | net8.0-windows (.NET 8) | 14703, 14704 |
| 2027 | net10.0-windows (.NET 10) | 14705 |
The add-in is compiled per year — use bim revit install --revit-version <year> when targeting a specific version. A version mismatch causes the TCP bridge to fail silently at startup; bim revit status --detailed reports it.
Diagnosing version issues
# check add-in version, port state, and installation
bim revit status --detailed
# search API availability for your installed version
bim revit api search --query ProjectPosition
bim revit api type --name Autodesk.Revit.DB.ProjectPosition
related
Revit API reference: namespaces and version quirks
Revit API namespaces & using directives
Revit CLI: run C# and export sheets -- bim-revit
Headless Revit — Run Revit Unattended from the CLI
install bim-cli · windows · per-user · no admin
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.