InsaneKarma
InsaneKarma

Reputation: 75

Forge Viewer: Properties Window

The Properties window does not populate any properties even though the 2D view has properties info for the selected room

enter image description here

Here is the function that loads the model. what am I missing?

  function loadModel() {
        var initialViewable = viewables[indexViewable];
        var svfUrl = lmvDoc.getViewablePath(initialViewable);
        var modelOptions = {
            sharedPropertyDbPath: lmvDoc.getFullPath(lmvDoc.getRoot().findPropertyDbPath())
        };
            
            viewer.loadModel(svfUrl, modelOptions, onLoadModelSuccess, onLoadModelError);
        }

Upvotes: 2

Views: 237

Answers (1)

Eason Kang
Eason Kang

Reputation: 7070

One line missing in your code, please try the following instead:

var sharedDbPath = initialViewable.findPropertyDbPath();
sharedDbPath = lmvDoc.getFullPath( sharedDbPath );

var modelOptions = {
    sharedPropertyDbPath: sharedDbPath
};

However, you should not need to specify the sharedPropertyDbPath manually now. You can take advantage of the Viewer3D#loadDocumentNode to load the model directly. It will automatically determine the path for you. (started from v7 viewer)

const initialViewable = viewables[0];
viewer.loadDocumentNode( lmvDoc, initialViewable, loadOptions )
      .then( onLoadModelSuccess )
      .catch( onLoadModelError );

Upvotes: 4

Related Questions