Table of Contents

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 RvtDocument

Inheritance

Inherited Members

Properties

ElementCount

Number of elements in the document.

public int ElementCount { get; }

Property Value

int

Elements

All elements in the document.

public IReadOnlyList<Element> Elements { get; }

Property Value

IReadOnlyList<Element>

Metadata

Project metadata (Revit version, build, file path).

public FileMetadata Metadata { get; }

Property Value

FileMetadata

ProjectInformation

Project information (name, number, client, address, etc.).

public ProjectInfo ProjectInformation { get; }

Property Value

ProjectInfo

RawData

The underlying raw data model (for JSON serialization or advanced access).

public RevitFileInfo RawData { get; }

Property Value

RevitFileInfo

TransmissionData

Transmission data with external file references.

public TransmissionInfo? TransmissionData { get; }

Property Value

TransmissionInfo?

TypeElementIds

Set of element IDs that are known type definitions (referenced by ELEM_TYPE_PARAM).

public IReadOnlySet<int> TypeElementIds { get; }

Property Value

IReadOnlySet<int>

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

FilteredElementCollector

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

elementIds IEnumerable<int>

Returns

FilteredElementCollector

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

info RevitFileInfo

Returns

RvtDocument

GetCategories()

Get all distinct category IDs present in the document.

public IReadOnlyList<int> GetCategories()

Returns

IReadOnlyList<int>

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

elementId int

Returns

Element?

GetElement(string)

Get element by UniqueId string. Returns null if not found.

public Element? GetElement(string uniqueId)

Parameters

uniqueId string

Returns

Element?

GetElements(BuiltInCategory)

Get all elements of a given BuiltInCategory.

public IList<Element> GetElements(BuiltInCategory category)

Parameters

category BuiltInCategory

Returns

IList<Element>

GetElements(int)

Get all elements of a given category ID.

public IList<Element> GetElements(int categoryId)

Parameters

categoryId int

Returns

IList<Element>

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

instance Element

Returns

Element?

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

rvtPath string
options RvtReaderOptions?

Returns

RvtDocument