Revit version-specific API quirks

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 versionAccess element ID as integer
2022, 2023element.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 describe "P:Autodesk.Revit.DB.ElementId.Value" to check availability.

ProjectPosition (latitude/longitude)

Revit versionNotes
2022–2024doc.ActiveProjectLocation.GetProjectPosition(...).Latitude works
2025Latitude and Longitude removed from ProjectPosition; use doc.SiteLocation or the SiteLocation.Latitude/Longitude API instead

Transaction API

PatternNotes
Auto-transaction (default)bim revit exec wraps your snippet in a Transaction automatically. Safe for write operations.
--no-transactionRequired when: setting uidoc.ActiveView, calling doc.Regenerate() standalone, or managing your own nested transactions.
uidoc.ActiveView = viewThrows InvalidOperationException inside the auto-transaction. Fix: add --no-transaction to the exec call.

PDF export

Revit versionNotes
2022+doc.Export(folder, PDFExportOptions, IList<ElementId> viewIds) available. PDFExportOptions.CombinedFile = false = one PDF per view.
All versionsWrite 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 targetTCP port
2022, 2023net48 (.NET Framework 4.8)14700, 14701
2024net4814702
2025, 2026net8.0-windows14703, 14704

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 "ProjectPosition"
bim revit api type "Autodesk.Revit.DB.ProjectPosition"