Forge 查看器:属性 Window

Forge Viewer: Properties Window

属性 window 不会填充任何属性,即使 2D 视图具有所选房间的属性信息也是如此

这是加载模型的函数。我错过了什么?

  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);
        }

您的代码中缺少一行,请尝试以下操作:

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

var modelOptions = {
    sharedPropertyDbPath: sharedDbPath
};

但是,您现在不需要手动指定 sharedPropertyDbPath。您可以利用 Viewer3D#loadDocumentNode 直接加载模型。它会自动为您确定路径。 (从 v7 查看器开始)

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