单击 Visible/Invisible 图标后从模型浏览器获取对象 Autodesk Forge

Get Object from Model Browser after click Visible/Invisible icon Autodesk Forge

如何获取从模型浏览中筛选出的对象?我用过OBJECT_TREE_CREATED_EVENT,但只在第一次加载模型时使用。

Image

您可以订阅 HIDE_EVENTSHOW_EVENT。您将获得隐藏或显示节点的dbid。

viewer.addEventListener(Autodesk.Viewing.HIDE_EVENT, (nodes, model)=> {   
     
     // nodes returns an object like that :
     // {type: "hide", nodeIdArray: [<dbid>], model: Model, target: GuiViewer3D}

})

viewer.addEventListener(Autodesk.Viewing.SHOW_EVENT, (nodes, model)=> {   
     
     // nodes returns an object like that :
     // {type: "show", nodeIdArray:[<dbid>], model: Model, target: GuiViewer3D}

})

此外,如果您想访问模型的完整隐藏节点列表,您可以使用 viewer.getHiddenNodes(model)