awesome-bim

A curated collection of useful BIM (Building Information Modeling) resources, libraries, software and frameworks for AEC research, application development, data analysis, and general computation.

View the Project on GitHub mitevpi/awesome-bim

Back

C# Revit Resources

Developer Essentials

Revit API Documentation NEW

NEW! / BETA - Documentation for all public classes and members.

Revit API Documentation

Documentation for all public classes and members.

2019 My First Revit Plug-in

Comprehensive tutorial for C# Revit development. This should be one’s first stop.

Add-In Manager

The add-in manager is used for rebuilding assemblies in Visual Studio and running them live without having to restart the Revit instance. Very useful for saving time when testing. Not a replacement for Visual Studio’s native debugger.

Debugging Options

Visual Studio Native Debug Settings

How to configure project properties to use Visual Studio’s integrated debugging.

Visual Studio Debug Native Troubleshooting

Sometimes debugging inexplicably fails when using the Visual Studio native debugger. This is typically due to assemblies being looked for in the wrong places. We can find the source of the problem using FUSLOGVW.exe which is included with the Windows SDK. It logs assembly binding failures, and lets you find the true source of errors.

Debugging via Revit Python Shell

Since Revit uses IronPython as opposed to CPython (Python 3.X), we can use the RevitPythonShell to import .NET compiled assemblies. We can interrogate the public members and/or trigger breakpoints set from within Visual Studio, as long as the Revit instance hosting the Python Shell is also launched through Visual Studio’s native debugger.

Debugging via Revit Macro Editor

Normally, Revit will lock a file (.dll) which it has referenced. This makes debugging challenging, as Revit constantly has to be restarted in order to actualize a change in the code. Using the Revit Macro Editor can be a way around this, as the Macro Editor lets you reference a compiled .dll, but it does not lock it - instead it copies it to another location, and overwrites on top of that copy when there are changes. This works best for modular code - class libraries, functions, methods, etc. For full add-in/application debugging, the Add-In Manager is optimal.

Community Resources

Jeremy Tammik

Blog full of Revit API examples/tutorials.

Danny Bentley

Large collection of Revit API videos.

Archi-Lab

Revit API tutorials.

Code Snippets & Examples

Revit API TutorialBook Snippets

Revit API snippets translated from a tutorial book originally in Chinese.

RevitAPI Docs Snippets

Revit API Docs also houses code samples as well as documentation.