问题
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 objectid
s from the Model Derivative APIs and the dbid
s 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 dbid
s 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 dbid
s.
来源:https://stackoverflow.com/questions/64486866/how-to-match-objectids-from-autodesk-model-derivative-api-metadata-with-forge-vi