Devin
Devin

Reputation: 505

How to retrieve filename from Forge Viewer?

I have a Revit file within BIM360, and I've been able to successfully load this file into the Forge Viewer by extracting the urn and using Autodesk.Viewing.Document.load. Once in the viewer, I would like to retrieve the original name of this file. I've been unable to find a property in the model with the filename. Is this property available in the model or the viewer?

Upvotes: 2

Views: 501

Answers (1)

Jeremy Tammik
Jeremy Tammik

Reputation: 8304

When displaying a model from BIM360, you usually start with item & file version. From there, you get access to the derivative urn. So, you should already know either the id of item or the file version. You can get the original name from that using the DM API.

Another option could be to check loadOptions.bubbleNode and iterate through the parent nodes until you find the right node, i.e.,

  NOP_VIEWER.model.getData().loadOptions.bubbleNode.getRootNode().children[0].name()

Upvotes: 4

Related Questions