Revit efficiently creates 3D models by utilizing its integrated relational database, which stores extensive parameter information. The software can also generate 2D drawings from various viewpoints to satisfy project requirements. Additionally, developers have designed API interfaces, allowing Revit’s functionality to extend beyond the default operations defined by professional development teams. This enables designers to customize and implement personalized workflows based on their own needs.
Fundamental Concepts in Revit Secondary Development
(1) External Commands
Developers can introduce custom applications using IExternalCommand. This external interface acts as a bridge between Revit and developers for creating plugins. All code implementations must be done through external commands, which Revit recognizes and loads via .addin files. You can think of external commands as containers holding the executable program code. When a plugin is selected, Revit creates and instantiates the external command object. During this process, the constructor of the base class is called, and the Execute() method runs automatically. Once execution is complete, the external command object is destroyed, and its instance is removed from memory.
The entire program, including parameter modules, should be packaged as Revit external commands, ready to be invoked by external applications.
(2) Elements
Elements are a core concept within Revit, representing most visible objects such as walls, families, family types, family instances, elevations, grids, and views. Nearly all classes in Revit’s API inherit from the Element class. When designing parameter extraction programs, data acquisition must be based on elements. Every component and its subcomponents are instances of elements, with their data stored within each element. By leveraging the properties and methods provided by the Revit API’s Element class, developers can access component data effectively.
(3) Element Collector and Filter
The Revit API offers three types of element filters to traverse and classify elements and their IDs, providing flexible and practical filtering options for various applications. The main tool for iterating and filtering elements is the collector, which can be constructed in three ways depending on the scenario (see Table 4.1).
The FilteredElementCollector() class offers a range of methods to specify the set of elements for queries and filters:
- Passes() applies a single
ElementFilterto the collector, allowing further filtering on the results. - Quick methods such as
OfClass(),OfCategoryId(), andOwnedByView()provide shortcuts without requiring explicit filter objects. - Set operations like
UnionWith()andIntersectWith()enable combining or intersecting filter results.
(4) Point-Line Model
Although Revit is 3D modeling software, its model data is simplified into spatial models composed of multiple points for storage. The models discussed here—such as walls, openings, and grooves—are constructed from sets of spatial point coordinates. When extracting parameters, the visual model can be conceptualized as a spatial structure made up of points and lines. For example, a wall component is simplified to a line segment defined by two points (start and end). Openings and grooves, which are perpendicular to the XY plane, are represented as points in space. Combining these points with element parameters like base and top heights allows us to derive a spatial line segment model.
Xue Lei, Shenyang University of Technology
For educational and communication purposes only. Copyright belongs to the original author.
















Must log in before commenting!
Sign Up