Skip to content

Latest commit

 

History

History

C-Sharp

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Back

C# Revit Resources

Developer Essentials

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

Documentation for all public classes and members.

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

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

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

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.

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.

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

Blog full of Revit API examples/tutorials.

Large collection of Revit API videos.

Revit API tutorials.

Code Snippets & Examples

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

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