autodesk 转换为 svf 失败

autodesk translate to svf failed

我按照本教程中的步骤将文件转换为 svf 格式,以便能够使用 autodesk 查看器查看它。 https://forge.autodesk.com/en/docs/model-derivative/v2/tutorials/prep-file4viewer/

我正在尝试将 dwg 文件转换为 svf。我顺利完成任务 3 第 1 步,但在第 2 步中,当我发出请求时,我得到以下响应:

{"urn":"dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6YnVja2V0MTJzL3Zpc3VhbGl6YXRpb25fLV9hZXJpYWwuZHdn",
"derivatives":[{"hasThumbnail":"false","name":"visualization_-_aerial.dwg","progress":"complete",
"messages":[{"type":"error","code":"AutoCAD-InvalidFile",
"message":"Sorry, the drawing file is invalid and cannot be viewed. 
\n- Please try to recover the file in AutoCAD, and upload it again to view."},
{"type":"error","message":"Unrecoverable exit code from extractor: -1073741831",
"code":"TranslationWorker-InternalFailure"}],
"outputType":"svf","status":"failed"}],
"hasThumbnail":"false","progress":"complete","type":"manifest","region":"US","version":"1.0",
"status":"failed"}

我尝试使用他们的在线查看器查看该文件并且能够完美地查看它,因此我知道该文件没有任何问题。此错误的可能原因是什么?

编辑:

获得访问令牌并创建存储桶后,我使用此请求将文件上传到存储桶(任务 2 的第 2 步):

curl -X PUT -v 'https://developer.api.autodesk.com/oss/v2/buckets/{bucketname}/objects/visualization_-_aerial.dwg' -H 'Authorization: Bearer {TOKEN}' -H 'Accept-Encoding: gzip, deflate' --data-binary '{PATH_TO_FILE}/visualization_-_aerial.dwg'

对此的响应是 200OK。

然后我使用教程中给出的在线工具将urn转换为base 64编码的urn。

这是我发送的作业 post 请求(任务 3 的第 1 步):

curl -X POST  'https://developer.api.autodesk.com/modelderivative/v2/designdata/job' -H 'Authorization: Bearer {TOKEN}' -H 'x-ads-force: true' -H 'Content-Type: application/json' -d '{ "input": { "urn": "{URN}", "compressedUrn": true, "rootFilename": "visualization_-_aerial.dwg" }, "output": { "destination": { "region": "us" }, "formats": [{ "type": "svf", "views": ["2d", "3d"], "advanced": {"generateMasterViews": true} } ] } }'

对此的回应是“成功”

和检查翻译状态的获取请求:

curl -X GET 'https://developer.api.autodesk.com/modelderivative/v2/designdata/{URN}/manifest' -H 'Authorization: Bearer {TOKEN}'

对此的回应是我在上面包含的内容。

文件实际上已上传到存储桶,我可以在 https://oss-manager.autodesk.io/# 查看它,但即使在那里,它也显示翻译失败。

编辑 2: 这是来自 https://oss-manager.autodesk.io/ get manifest 请求的响应图片(使用开发工具获取)

enter image description here

如果您使用单个文件或使用 zip 文件,请将 compressedUrn 更改为 false,因此,设置为 true 还要提及 rootFilename响应体中的文件名(根文件名).

根据添加到先前答案的评论,问题似乎出在上传部分。正如您在教程中看到的那样,它使用

--data-binary '@PATH_TO_DOWNLOADED_ZIP_FILE'

@ 符号很重要,没有它你会得到这样的回复

{
"bucketKey" : "adam",
"objectId" : "urn:adsk.objects:os.object:adam/test.dwg",
"objectKey" : "test.dwg",
"sha1" : "cb54c0750e9201bbfa6da6adad6b496bec11a111",
"size" : 27,
"contentType" : "application/x-www-form-urlencoded",
"location" : "https://developer.api.autodesk.com/oss/v2/buckets/adam/objects/test.dwg"
* Connection #0 to host developer.api.autodesk.com left intact
}

看看尺寸:27 - 这绝对不对。因此,当我尝试翻译该文件时,我收到了与您收到的相同的错误消息。

但是,如果我添加 @ 符号,那么一切都很好:

curl -X PUT -v 'https://developer.api.autodesk.com/oss/v2/buckets/{bucketname}/objects/test.dwg' -H 'Authorization: Bearer {TOKEN}' -H 'Accept-Encoding: gzip, deflate' --data-binary '@/Users/nagyad/Downloads/test.dwg'

注意:我在Mac上,在Windows上,路径看起来会有点不同

这次收到的回复:

{
"bucketKey" : "adam",
"objectId" : "urn:adsk.objects:os.object:adam/test.dwg",
"objectKey" : "test.dwg",
"sha1" : "d17e9156c948caed3a98788836e6c1f3d5fddadc",
"size" : 55727,
"contentType" : "application/x-www-form-urlencoded",
"location" : "https://developer.api.autodesk.com/oss/v2/buckets/adam/objects/test.dwg"
* Connection #0 to host developer.api.autodesk.com left intact
}

而这次我尝试翻译文件时,它成功了。