How to match objectids from Autodesk Model Derivative API metadata with Forge Viewer model dbids?

假如想象 提交于 2021-01-06 07:32:11

问题


I am building an application around Autodesk Forge Viewer, where I add extra functionalities using basic functions from Viewer (coloring, isolating etc.) depending on client data.

This application also allows you to upload a new model. After the upload and conversion process, metadata is extracted from the model using this Model Derivative API https://forge.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-metadata-guid-GET/, which basically returns the tree of objects and their ids/names.

On the viewer side, all the basic interaction functions like setThemingColor, show, hide, isolate etc. requires dbIds as a parameter. To avoid multiple search requests to find out the dbId of an item, which would cause a huge performance problem as the model size is above average, dbIds are retrieved from the metadata on the BE side and provided to FE to for the coloring or a similar operation requiring only dbids to execute.

However, recently I discovered that objectid from Model Derivative API metadata and dbId required in the Viewer functions are not matching. How does these two fields correlate to each other, are they supposed to be the same or not? If not, is there a way of converting one into another?

I couldn't find any official/unofficial documentation about this, any help is appreciated.


回答1:


The objectids from the Model Derivative APIs and the dbids in the viewer (coming from the SVF file format) should always match. The only exception is the new SVF2 format (which has just entered public beta) where the dbids are computed in a different way in order to be "stable", as in, "consistent across different versions of the same design".

To be on the safe side, you could link the design elements with your metadata using the "external ID" which is guaranteed to be consistent. On the client side you can use the viewer.model.getExternalIdMapping(onSuccessCallback, onErrorCallback) method to get a dictionary mapping from external IDs to dbids.



来源:https://stackoverflow.com/questions/64486866/how-to-match-objectids-from-autodesk-model-derivative-api-metadata-with-forge-vi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!