Previously, the editor of Architecture Network shared several articles on Revit secondary development. Today, we will continue this discussion by exploring aspects related to the Revit interface.

The RevitAPI offers a robust library, including comprehensive specifications and extensions to enhance Revit’s functionality. Revit primarily provides two key library files: RevitAPI.dll and RevitAPIUI.dll, which encapsulate numerous functions available for developers.
Typically, developers utilize the IExternalCommand interface to implement external applications. When Revit is running, these external commands can be triggered and activated. Upon user invocation, the software automatically accesses the model data.
Developers often integrate their external commands into Revit via the add-ons section on the Revit ribbon or through a custom external menu bar, enabling easy access within the software.
Revit provides the IExternalCommand interface to access model data, which contains only the Execute() function. Developers must override this function, which accepts input parameters such as commandData, and provides output parameters like message and element. These parameters cover most user needs.
When accessing model data, developers use classes within the API. Revit offers two main classes for this purpose: UIDocument and Document. The Document class is used to access model data, including site location and elements like beams, slabs, and columns. The UIDocument class enhances user interaction, for example, by retrieving data on components selected within the Revit model.
For adding external applications, Revit provides the IExternalApplication interface, which includes OnStartup and OnShutdown methods. This interface is useful for customizing the Revit ribbon with new features but does not grant access to model data.
Revit automatically tracks every modification made to the model through transactions. If a modification is incomplete, an exception is thrown during the execution of an external command, causing a transaction rollback.
Transaction modes include manual and automatic, supported by three classes: Transaction, SubTransaction, and TransactionGroup, which provide flexible control over modifications.














Must log in before commenting!
Sign Up