0

Following this question

I am dealing with the same. I am trying to to retrive the type and type parameters, instances and instance parameters of all elements in a 3D view using Model Derivative API, but the data coming from GET/{urn}/metadata/{modelGuid} and GET/{urn}/metadata/{modelGuid}/properties is incomplete.

I.E. You can't get the Revit ID from Categories and Types.

The thing is that in the forge viewer this information appears and you can see the Revit IDs of Categories and Types and their parameters.

I am missing anything? I don't want to go through Design Automation if is not necessary.

Cheers.

1 Answers1

0

What is your Revit ID? Element Id or Unique Id?

If it's element id, you can find it in the object name in Forge Viewer, or decode it from the external id like this thread: Missing revit ID in instance elements

Note. For the worksharing Revit models, the element id decoded from the external id is different from its actual value, since the final element id is determined after the element is synced to the central model.

For Revit unique id, you can find it in the external id of the object properties in Forge viewer.

So, you can find the similarities in the response of GET {urn}/metadata/{modelGuid}/properties, but it's a flattened data structure. To get the relationship of instance, type, and category, we need to iterate the object tree from the GET {urn}/metadata/{modelGuid}.

Note. SVF2 model will remove element id from the object name. If you don't see that, that means your model was translated to SVF2. You can use the request header x-ads-derivative-format: fallback to get SVF properties if the model is stored on BIM360 Docs/Autodesk Docs, or if you request SVF translation for the same model.

Here is another explanation of the difference between Revit Element Id and unique id: https://stackoverflow.com/a/48720285/7745569

Lastly, here is the JavaScript code snippet of extracting element id from the object name using regex:

const name = 'Floors [123456]'

const elementIdRegx = new RegExp(/\[(.*?)\]/gm);
const result = elementIdRegx.exec( name );

const elementId = result[1]; //!<<< 123456
Eason Kang
  • 6,155
  • 1
  • 7
  • 24