本文介绍了Autodesk Forge Viewer - 从“viewer.model.search"获取不同的值 dbId;和“viewer.getSelection()"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试隔离我使用 viewer.model.search 方法搜索的一些元素,但是当我使用 viewer.isolate 方法时,我将所有内容都隐藏起来.

我已经使用 getSelection 来隔离元素,我注意到它们为同一元素提供了不同的 dbId 值.使用 getSelection dbId 有效,但使用 search 无效

有人有同样的错误吗?

2019 年 3 月 11 日更新:
当我试图弄清楚发生了什么时,我意识到 search 方法给你的数字减一,例如:如果你用 getSelection 得到数字 2302,search 给你 2301.

这是一个错误吗?

解决方案

差异可能是由那些 dbId's 在层次结构中的不同级别代表相同元素造成的.当您通过点击在 UI 中选择某物时,然后是叶子(层次树中的最低元素,通常是 bodysolid) 被选中.

您可以在层次结构浏览器面板中查看正在选择的确切节点:

也说到这个现象,这里有一篇关于覆盖一个元素在哪个层级被选中的文章:

I'm trying to isolate some elements that I search with the method viewer.model.search but when I use the viewer.isolate method I get everything to hide.

I already use the getSelection to isolate elements and I notice that they give me different dbId values for the same element. With getSelection dbId works but with the search doesn't

Does that anyone have this same error?

UPDATE 3/11/2019:
While I was trying to figure out what happened, I realized that the search method gives you the number minus one, for example: if you get with the getSelection the number 2302, the search gives you 2301.

Is this a bug?

解决方案

The difference might be caused by those dbId's representing the same element at a different level in the hierarchy. When you select something in the UI by clicking on it, then the leaf (the lowest element in the hierarchy tree, usually a body or solid) is selected.

You can check in the Hierarchy Browser panel which exact node is being selected:

Also talking about this phenomenon, here is an article on overriding at which level an element is selected:Selection override

Edit: the dbId number of the parents of Body and Solid leaf entities tend to be one less than the dbId of the leaf itself as shown in this picture:

这篇关于Autodesk Forge Viewer - 从“viewer.model.search"获取不同的值 dbId;和“viewer.getSelection()"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 13:59