如何将Autodesk Model Derivative API元数据中的objectid与Forge Viewer模型dbid相匹配? [英] How to match objectids from Autodesk Model Derivative API metadata with Forge Viewer model dbids?

查看:141
本文介绍了如何将Autodesk Model Derivative API元数据中的objectid与Forge Viewer模型dbid相匹配?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在围绕Autodesk Forge Viewer构建一个应用程序,在其中我将根据客户端数据使用Viewer的基本功能(着色,隔离等)添加其他功能.

此应用程序还允许您上传新模型.在上载和转换过程之后,使用此模型衍生API https://forge.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-metadata-guid-GET/,基本上会返回对象树及其ID/名称.

在查看器端,所有基本交互功能(例如setThemingColor,show,hide,isolate等)都需要dbIds作为参数.为了避免多次搜索请求来查找某项的dbId,这会在模型大小高于平均水平时导致巨大的性能问题,因此从BE端的元数据中检索dbId,并将其提供给FE以进行着色或类似操作仅需要执行dbid的操作.

但是,最近我发现Model Derivative API元数据中的 objectid 与Viewer函数中所需的 dbId 不匹配.这两个字段之间是如何相互关联的?如果没有,是否有办法将其转换为另一种?

我找不到与此有关的任何官方/非官方文档,我们将为您提供任何帮助.

解决方案

模型衍生API的 objectid s和查看器中的 dbid s(来自SVF文件格式)应该始终匹配.唯一的例外是新的SVF2格式(只有进入公共Beta版),其中以不同的方式计算 dbid ,以便稳定",例如在同一设计的不同版本中保持一致"./p>

为了安全起见,您可以使用外部ID"链接设计元素和元数据.保证是一致的.在客户端,您可以使用 viewer.model.getExternalIdMapping(onSuccessCallback,onErrorCallback)方法来获取从外部ID到 dbid s的字典映射.

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.

解决方案

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.

这篇关于如何将Autodesk Model Derivative API元数据中的objectid与Forge Viewer模型dbid相匹配?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆