0

我的目标是将 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 调用的。

4

1 回答 1

1

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

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

于 2016-07-20T16:13:26.793 回答