Revit supports two types of external application plugins: external commands and external applications. The IExternalCommand interface defines external commands, with Excel functionality uniquely related to this interface. Before implementing functional code, the Excel-related features must be loaded and temporarily suspended. On the other hand, the IExternalApplication interface manages external applications, operating similarly to the external command interface. However, it includes two specific callback functions: OnStartup and OnShutdown. Developers can customize Revit’s behavior by implementing these functions after completing the IExternalApplication development.
Revit Secondary Development Process
The secondary development process in Revit involves two main stages: code compilation and code debugging.
First, set up the development environment. This requires three key components: the development target, programming software, and programming language. Using the Revit model as the development target, launch Visual Studio 2019 and select C# as the programming language. Create a new library project within Visual Studio. Next, add references to the project, including RevitAPI.dll and RevitAPIUI.dll. Since the project involves generating Excel spreadsheets, also include references to Microsoft Excel libraries. Make sure to set the target framework to one compatible with your operating system to avoid errors during compilation.
Second, write the code based on the desired functionality. You can explore the Revit Lookup tool to understand the methods and properties available. By leveraging the extensive classes, methods, and properties provided by the Revit API, write the specific code to implement your features.
Third, debug the code within Visual Studio 2019. Before running the plugin in Revit, it’s essential to ensure the code compiles and runs correctly. After successful debugging, copy the generated .dll file into the Revit directory. If errors occur during debugging, review the error messages, correct the code accordingly, and repeat the debugging process until successful.
Finally, run the plugin. After compilation, launch Revit and navigate to the “Add-Ins” tab. Click on “External Tools” in the dropdown menu, which opens a command selection dialog. Select “AddinManager” to open the plugin manager window. Paste the full path of the .dll file into the dialog box and click “Run” to execute the plugin. This process activates the programmed functions within Revit.















Must log in before commenting!
Sign Up