Fabien
Fabien

Reputation: 41

What is the best way to persist a reference to an item in forge viewer?

Currently, we are importing into forge viewer some revit models. In the viewer, we want to be able to store into external database some info attached to an element of the model we see in the viewer (for example a door).

We have 3 ways to identify an item:

I would need to be able to reference an item on the model in external database, even if the revit model gets updated and reconverted in the middle.

1-Is Guid, the thing we should use to reference items in revit file (even between updates) ?

2-If this is Guid, how can we directly have a mapping from guid to dbid (since all in viewer is handled by dbid) ?

Thank you

Upvotes: 1

Views: 800

Answers (1)

Augusto Goncalves
Augusto Goncalves

Reputation: 8574

First, to summarize:

  • Revit ID is a sequential numbering used on Revit desktop, it may be reused and it's not uniqu
  • Revit GUID is unique (as any GUID) and maintained between versions and exposed on both Viewer (JavaScript library) and Model Derivative GET Properties endpoint as external id
  • dbId just index used on the model to access geometry, no guarantee will be the same between versions/translations of the model.

Now, the only true identifier you can use to track the same element between versions is the external id (from Revit GUID).

If you want a server-side mapping, use Model Derivative GET Properties on all model views. On the client-side, I would suggest first enumerateLeafNodes and then call getBulkProperties on these nodes to get the external id.

Upvotes: 1

Related Questions