Autodesk Forge Viewer - Getting different values d

2019-08-09 16:45发布

问题:

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?

回答1:

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: