有没有办法隐藏模型浏览器树中的某些对象但将它们保留在场景中?

问题描述 投票:0回答:1

我需要在模型浏览器中完全隐藏对象,但保持其在场景中可见。

我尝试了一些方法,包括这个: 隐藏模型树面板上的对象

但它对我不起作用,因为

viewer.modelstructure.createUI()
功能不存在。 此外,
viewer.modelstructure
中的树对象为空。我无法直接访问元素。

setModelStructurePanel 函数现在已标记为已弃用,因此我也无法使用它。

我正在为 Forge Viewer 使用

@contecht/react-adsk-forge-viewer
React Typescript 包装器,也许这就是原因。

autodesk-forge autodesk-viewer
1个回答
0
投票

从检查元素获取 lmv-nodeid。

viewer.addEventListener(Autodesk.Viewing.EXTENSION_ACTIVATED_EVENT,async(e)=>{
    if(e.extensionId == "Autodesk.ModelStructure" && e.type=="extensionActivated"){
       let lmvnodeid = 939;  // change this in your case, for multiple nodes, change this to array and put the below code in for loop
       let node = document.querySelectorAll('[lmv-nodeid="' + lmvnodeid + '"]')[0]
       node.style.display = 'none'
    }
});

© www.soinside.com 2019 - 2024. All rights reserved.