Autodesk Forge 从转换后的 DWG 获取清单和元数据

Posted

技术标签:

【中文标题】Autodesk Forge 从转换后的 DWG 获取清单和元数据【英文标题】:Autodesk Forge getting Manifest and Metadata from converted DWG 【发布时间】:2016-11-23 21:23:35 【问题描述】:

我的目标是将 DWG 文件转换为可在 Forge Viewer 中使用并具有标记。 在获取所有正确文件以使用脱机查看器的过程中,我正在尝试获取文件的清单和元数据。我想要元数据,以便我可以访问多边形 ID 以进行标记。当我调用元数据时,它是空的。我做错了什么?

我已经上传并发送了一个 DWG 文件的 SVF 转换作业请求。

Convert File String
"input":"urn":"dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6Z3JlZ2JpbWJ1Y2tldGZvdXIvRmxvb3JfUGxhbl9TYW1wbGUuZHdn","output":"formats":["type":"svf","views":["2d","3d"]]
HTTP/1.1 201 Created
Result"result":"created","urn":"dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6Z3JlZ2JpbWJ1Y2tldGZvdXIvRmxvb3JfUGxhbl9TYW1wbGUuZHdn","acceptedJobs":"output":"formats":["type":"svf","views":["2d","3d"]]
getManifest
https://developer.api.autodesk.com/modelderivative/v2/designdata/dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6Z3JlZ2JpbWJ1Y2tldGZvdXIvRmxvb3JfUGxhbl9TYW1wbGUuZHdn/manifest
HTTP/1.1 200 OK
Result"type":"manifest","hasThumbnail":"true","status":"success","progress":"complete","region":"US","urn":"dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6Z3JlZ2JpbWJ1Y2tldGZvdXIvRmxvb3JfUGxhbl9TYW1wbGUuZHdn","derivatives":["name":"Floor_Plan_Sample.dwg","hasThumbnail":"true","status":"success","progress":"complete","outputType":"svf","children":["type":"geometry","role":"2d","name":"2D Views","status":"success","progress":"complete","hasThumbnail":"true","children":["type":"resource","mime":"image/png","resolution":[100,56],"role":"thumbnail","status":"success","urn":"urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6Z3JlZ2JpbWJ1Y2tldGZvdXIvRmxvb3JfUGxhbl9TYW1wbGUuZHdn/output/Floor_Plan_Sample-Model_100.png","type":"resource","mime":"image/png","resolution":[200,113],"role":"thumbnail","status":"success","urn":"urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6Z3JlZ2JpbWJ1Y2tldGZvdXIvRmxvb3JfUGxhbl9TYW1wbGUuZHdn/output/Floor_Plan_Sample-Model_200.png","type":"resource","mime":"image/png","resolution":[400,226],"role":"thumbnail","status":"success","urn":"urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6Z3JlZ2JpbWJ1Y2tldGZvdXIvRmxvb3JfUGxhbl9TYW1wbGUuZHdn/output/Floor_Plan_Sample-Model_400.png","type":"resource","mime":"application/autodesk-f2d","role":"graphics","status":"success","urn":"urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6Z3JlZ2JpbWJ1Y2tldGZvdXIvRmxvb3JfUGxhbl9TYW1wbGUuZHdn/output/535e6d00-3822-110e-c53e-4df9301ee4c2_f2d/primaryGraphics.f2d","type":"view","role":"2d","name":"Initial","viewbox":[-0.198947,2.65155,6.826102,5.357447],"type":"view","role":"2d","name":"1","viewbox":[1.753343,4.41829,5.463574,6.340082]],"type":"geometry","role":"2d","name":"Layout1","status":"success","progress":"complete","hasThumbnail":"true","children":["type":"resource","mime":"image/png","resolution":[100,77],"role":"thumbnail","status":"success","urn":"urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6Z3JlZ2JpbWJ1Y2tldGZvdXIvRmxvb3JfUGxhbl9TYW1wbGUuZHdn/output/Floor_Plan_Sample-Layout1_100.png","type":"resource","mime":"image/png","resolution":[200,154],"role":"thumbnail","status":"success","urn":"urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6Z3JlZ2JpbWJ1Y2tldGZvdXIvRmxvb3JfUGxhbl9TYW1wbGUuZHdn/output/Floor_Plan_Sample-Layout1_200.png","type":"resource","mime":"image/png","resolution":[400,308],"role":"thumbnail","status":"success","urn":"urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6Z3JlZ2JpbWJ1Y2tldGZvdXIvRmxvb3JfUGxhbl9TYW1wbGUuZHdn/output/Floor_Plan_Sample-Layout1_400.png","type":"resource","mime":"application/autodesk-f2d","role":"graphics","status":"success","urn":"urn:adsk.viewing:fs.file:dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6Z3JlZ2JpbWJ1Y2tldGZvdXIvRmxvb3JfUGxhbl9TYW1wbGUuZHdn/output/8fcb06e4-ab26-a304-62c0-7cf8f5ef0470_f2d/primaryGraphics.f2d"]]]
getMetadata
https://developer.api.autodesk.com/modelderivative/v2/designdata/dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6Z3JlZ2JpbWJ1Y2tldGZvdXIvRmxvb3JfUGxhbl9TYW1wbGUuZHdn/metadata
HTTP/1.1 200 OK
Result"data":"type":"metadata","metadata":[]

请注意,使用 node.js 提取器示例它适用于同一个文件,并且提取器会创建 manifest.json.gz 和 metadata.json.gz 。我只是想了解那些是如何创建的以及使用哪些 REST 调用的。

【问题讨论】:

【参考方案1】:

很遗憾,模型衍生 API 尚不支持 2D 文档的元数据,例如 .dwg。我们正在努力在即将发布的 API 版本中提供此功能。

目前我想唯一的解决方法是下载软件包并“逆向工程”内容。你可以看看我的 NPM 包download method implementation,它仍在使用 v1 API,但可以正常工作。这应该让您了解如何下载 svf 资源。

【讨论】:

谢谢菲利普。当您说“下载软件包”时,您指的是什么?您是在谈论来自提取器的 zip 文件,还是我可以进行单个 REST api 调用,它将为我提供与包(zip)中转换后的文件相关联的所有内容? 不,遗憾的是没有单个 REST 调用,因为该 API 并非旨在提供下载功能,它旨在加载到查看器中,但是我的 NPM 包“下载”方法使在本地下载 zip 非常容易,它是一个方法调用。它基本上反转了查看器在加载 URN 时所做的事情,而不是在浏览器中加载文件,而是保存在磁盘上。我们不提供在本地读取或修改这些文件的 API,但这样做非常好。它只是没有记录,我们不保证 svf 格式在未来永远保持不变...... 菲利普·里夫斯玛。在你的提取程序上,当它获取所有文件时,你能告诉我 .sb 和 bin 文件的来源吗?我不知道你是如何得到它们的。我提取的 rvt 文件的示例位于文件夹 Resource\3D_View_3D_\0.pf...6pf、CameraDefinitions.bin 中。我没有在我得到的清单 json 中看到它们。 您是在谈论github.com/Developer-Autodesk/view-and-data-npm 的 npm 包吗?您可以查看 is 包(1 个文件)的源代码并在其中放置跟踪信息。看看下载方法(github.com/Developer-Autodesk/view-and-data-npm/blob/master/…)。这是一个多步骤的过程:1/ 解析可视数据,2/ 下载第一组项目,3/ 解析我们获得的清单,4/ 下载第二组项目。我不知道确切的时间下载了哪个项目,但是通过放置日志并运行测试,您应该很容易找到。祝你好运 嗨@PhilippeLeefsma,很抱歉再次提出这个话题。 API 是否仍然不支持 .DWG 文件的元数据?我知道这个答案有点老了,但想知道,有什么改变吗?

以上是关于Autodesk Forge 从转换后的 DWG 获取清单和元数据的主要内容,如果未能解决你的问题,请参考以下文章

将点从 DWG 模型坐标转换为 Autodesk Forge 查看器坐标

Autodesk forge viewer api v7.* 对齐多个 2d dwg 模型

爆炸功能不适用于 Autodesk forge 中的几种格式?

Autodesk Forge Viewer 在本地服务器上存储文件?

无法在 Forge Viewer 中检索二维 DWG 文件的地理参考或坐标

Autodesk Forge 自动化