Search code examples
autodesk-forgerevitautodesk-viewer

Forge Viewer: Unique IDs for clickable objects


I am experimenting with Revit and the Forge Viewer and I noticed that Forge already has unique IDs for every thing you can click on in the Revit model, so I used those instead of assembly id in Revit.

As an example the door of my building has id: "3003".

My question is, where is this data stored and how can I change "3003" into "Door 1" (?)


Solution

  • The Viewer gives access to 3 types of IDs when dealing with Revit files:

    1. dbId: this is Viewer specific and used to manipulate elements on Viewer, such as for .getProperties() method.
    2. Revit ElementID: actually exposed as part of the Name property on Viewer. When you select something, on the Property panel, the title is in the form of "Name [12345]", so you can parse this name string and extract the name.
    3. Revit Unique ID: exposed as externalId property on the .getProperty() response.

    This sample app exports properties into a spreadsheet, it may be relevant for you.