Class RvtDocument
- Namespace
- RvtIO
- Assembly
- RvtIO.dll
Main entry point for reading Revit files, mirrors the Revit API Document class. Provides indexed element access, filtering, and metadata queries.
public class RvtDocumentInheritance
Inherited Members
Properties
ElementCount
Number of elements in the document.
public int ElementCount { get; }Property Value
Elements
All elements in the document.
public IReadOnlyList<Element> Elements { get; }Property Value
Metadata
Project metadata (Revit version, build, file path).
public FileMetadata Metadata { get; }Property Value
ProjectInformation
Project information (name, number, client, address, etc.).
public ProjectInfo ProjectInformation { get; }Property Value
RawData
The underlying raw data model (for JSON serialization or advanced access).
public RevitFileInfo RawData { get; }Property Value
TransmissionData
Transmission data with external file references.
public TransmissionInfo? TransmissionData { get; }Property Value
TypeElementIds
Set of element IDs that are known type definitions (referenced by ELEM_TYPE_PARAM).
public IReadOnlySet<int> TypeElementIds { get; }Property Value
Methods
Collector()
Create a filtered element collector for all elements. Mirrors Revit API: new FilteredElementCollector(doc).
var walls = doc.Collector()
.OfCategory(BuiltInCategory.OST_Walls)
.WhereElementIsNotElementType()
.ToElements();
public FilteredElementCollector Collector()Returns
Collector(IEnumerable<int>)
Create a filtered element collector for a subset of element IDs. Mirrors Revit API: new FilteredElementCollector(doc, elementIds).
public FilteredElementCollector Collector(IEnumerable<int> elementIds)Parameters
elementIdsIEnumerable<int>
Returns
FromInfo(RevitFileInfo)
Wrap an existing RevitFileInfo as a queryable Document. Useful when you already have the data from RvtFileReader.Read().
public static RvtDocument FromInfo(RevitFileInfo info)Parameters
infoRevitFileInfo
Returns
GetCategories()
Get all distinct category IDs present in the document.
public IReadOnlyList<int> GetCategories()Returns
GetCategorySummary()
Get a summary of categories and their element counts. Returns list of (CategoryId, CategoryName, Count).
public IReadOnlyList<(int CategoryId, string? Name, int Count)> GetCategorySummary()Returns
- IReadOnlyList<(int CategoryId, string? Name, int Count)>
GetElement(int)
Get element by ID. Returns null if not found.
public Element? GetElement(int elementId)Parameters
elementIdint
Returns
GetElement(string)
Get element by UniqueId string. Returns null if not found.
public Element? GetElement(string uniqueId)Parameters
uniqueIdstring
Returns
GetElements(BuiltInCategory)
Get all elements of a given BuiltInCategory.
public IList<Element> GetElements(BuiltInCategory category)Parameters
categoryBuiltInCategory
Returns
GetElements(int)
Get all elements of a given category ID.
public IList<Element> GetElements(int categoryId)Parameters
categoryIdint
Returns
GetTypeElement(Element)
Get the type element for a given instance. Looks up ELEM_TYPE_PARAM to find the type element ID, then resolves it.
public Element? GetTypeElement(Element instance)Parameters
instanceElement
Returns
Open(string, RvtReaderOptions?)
Open a Revit file and return a queryable Document.
var doc = RvtDocument.Open("project.rvt");
public static RvtDocument Open(string rvtPath, RvtReaderOptions? options = null)Parameters
rvtPathstringoptionsRvtReaderOptions?