Skip to content

[Bug] InvalidObjectException when dimension references linked model elements #505

@jabergmp

Description

@jabergmp

Affected node

Dimension.ReferencedElements

Problem description

Getting the following error when using the node on dimensions in the host model that reference linked model elements:

InvalidObjectException : Reference contained element ids not found in this document.
   at Autodesk.Revit.DB.Reference.ConvertToStableRepresentation(Document document)

Cause:
In GetDimensionReferences, when a reference points to a linked element, ConvertToStableRepresentation is being passed the linked document instead of the host document:
``
srefs.append(r.ConvertToStableRepresentation(item.Document.GetElement(r.ElementId).GetLinkDocument()))

A Reference object from a host dimension belongs to the host document context. Passing the link document causes the element ID mismatch and throws the exception.

Image

Expected behaviour (optional)

No response

Clockwork version

3.3.0

Revit version

2026

Metadata

Metadata

Assignees

Labels

Projects

Status

In progress

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions