'Get file name is open in auto desk forge

In the question : How to retrieve filename from Forge Viewer?

I used this :

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

but this name only return first file rvt i open . I open 2 file , only return first file name open So how to return the name of the 2nd file ?



Solution 1:[1]

the loaded models are managed by NOP_VIEWER.getAllModels(). So you can find specific model such as

  model = NOP_VIEWER.getAllModels()[1]  //the second model

and call

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

There is also another model collection which tells the visible models only.

   NOP_VIEWER.getVisibleModels()
   

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Xiaodong Liang