使用 Autocad api TranslationWorker 从 dwg 转换为 svf 失败
Failed conversion from dwg to svf with the Autocad api TranslationWorker
我无法上传简单的 dwg 并使用来自 forge API 的 TranslationWorker 将其转换为 svf。我正在使用 autocad 2014 并创建一个带圆圈的简单绘图并将其保存为 .dwg。
我正在使用 windows 中的命令行和以下 curl 命令:
curl -v "https://developer.api.autodesk.com/oss/v2/buckets/kumkortbucket/objects/sirkel.dwg" -X "PUT" -H "Authorization: Bearer OAUTH_TOKEN" -H "Content-Type: application/octet-stream" -T "C:\Users\DAN\Documents\Testfiler\sirkel.dwg"
产生以下结果:
HTTP/1.1 100 Continue
* We are completely uploaded and fine
< HTTP/1.1 200 OK
< Access-Control-Allow-Credentials: true
< Access-Control-Allow-Headers: Authorization, Accept-Encoding, Range,Content-Type
< Access-Control-Allow-Methods: GET
< Access-Control-Allow-Origin: *
< Content-Type: application/json; charset=utf-8
< Date: Tue, 14 Feb 2017 12:56:38 GMT
< Server: Apigee Router
< Content-Length: 355
< Connection: keep-alive
<
{
"bucketKey" : "kumkortbucket",
"objectId" : "urn:adsk.objects:os.object:kumkortbucket/sirkel.dwg",
"objectKey" : "sirkel.dwg",
"sha1" : "78f92dc0a364814756cfa9392d7fa95aecf0916b",
"size" : 31548,
"contentType" : "application/octet-stream",
"location" : "https://developer.api.autodesk.com/oss/v2/buckets/kumkortbucket/objects/sirkel.dwg"
}* Connection #0 to host developer.api.autodesk.com left intact
然后我使用 POST 作业命令转换它
curl -X "POST" -H "Authorization: Bearer OAUTH_TOKEN" -H "Content-Type: application/json" -v "https://developer.api.autodesk.com/modelderivative/v2/designdata/job" -d "{\"input\": {\"urn\": \"dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6a3Vta29ydGJ1Y2tldC9zaXJrZWwuZHdn\"},\"output\": {\"formats\": [{\"type\": \"svf\",\"views\": [\"2d\",\"3d\"]}]}}"
使用 GET 命令检查结果我得到以下结果:
{"type":"manifest","hasThumbnail":"false","status":"failed","progress":"complete","region":"US","urn":"dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6a3Vta29ydGJ1Y2tldC9zaXJrZWwuZHdn","version":"1.0","derivatives":[{"name":"sirkel.dwg","hasThumbnail":"false","status":"failed","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"}]}* 连接 #0 到主机 developer.api.autodesk.com 完好无损
我不知道我做错了什么。我可以在 autocad 和在线查看器中查看文件。
干杯。
编辑:
这是一个上传有问题的文件
http://www.filedropper.com/ekbsroplain
这是我所做的(整个过程):
curl -v 'https://developer.api.autodesk.com/authentication/v1/authenticate' -X 'POST' -H 'Content-Type: application/x-www-form-urlencoded' -d 'client_id=****&client_secret=****&grant_type=client_credentials&scope=data:read data:write data:create bucket:create bucket:read'
curl -v 'https://developer.api.autodesk.com/oss/v2/buckets' -X 'POST' -H 'Content-Type: application/json' -H 'Authorization: Bearer TOKEN' -d '{"bucketKey":"kumkortbucket170214","policyKey":"transient"}'
注意我上传时没有 content-type 和 content-length,实际上不需要:
curl -v 'https://developer.api.autodesk.com/oss/v2/buckets/kumkortbucket170214/objects/drawing1.dwg' -X 'PUT' -H 'Authorization: Bearer TOKEN' -T '/Users/augustogoncalves/Desktop/Drawing1.dwg'
最后 POST 工作:
curl -X 'POST' -H 'Authorization: Bearer TOKEN' -H 'Content-Type: application/json' -v 'https://developer.api.autodesk.com/modelderivative/v2/designdata/job' -d '{"input":{"urn":"dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6a3Vta29ydGJ1Y2tldDE3MDIxNC9kcmF3aW5nMS5kd2c="},"output":{"formats":[{"type": "svf","views": ["2d","3d"]}]}}'
而且工作得很好
{
"result":"success",
"urn":"dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6a3Vta29ydGJ1Y2tldDE3MDIxNC9kcmF3aW5nMS5kd2c",
"acceptedJobs":{
"output":{
"formats":[
{
"type":"svf",
"views":[
"2d",
"3d"
]
}
]
}
}
}
我无法上传简单的 dwg 并使用来自 forge API 的 TranslationWorker 将其转换为 svf。我正在使用 autocad 2014 并创建一个带圆圈的简单绘图并将其保存为 .dwg。
我正在使用 windows 中的命令行和以下 curl 命令:
curl -v "https://developer.api.autodesk.com/oss/v2/buckets/kumkortbucket/objects/sirkel.dwg" -X "PUT" -H "Authorization: Bearer OAUTH_TOKEN" -H "Content-Type: application/octet-stream" -T "C:\Users\DAN\Documents\Testfiler\sirkel.dwg"
产生以下结果:
HTTP/1.1 100 Continue
* We are completely uploaded and fine
< HTTP/1.1 200 OK
< Access-Control-Allow-Credentials: true
< Access-Control-Allow-Headers: Authorization, Accept-Encoding, Range,Content-Type
< Access-Control-Allow-Methods: GET
< Access-Control-Allow-Origin: *
< Content-Type: application/json; charset=utf-8
< Date: Tue, 14 Feb 2017 12:56:38 GMT
< Server: Apigee Router
< Content-Length: 355
< Connection: keep-alive
<
{
"bucketKey" : "kumkortbucket",
"objectId" : "urn:adsk.objects:os.object:kumkortbucket/sirkel.dwg",
"objectKey" : "sirkel.dwg",
"sha1" : "78f92dc0a364814756cfa9392d7fa95aecf0916b",
"size" : 31548,
"contentType" : "application/octet-stream",
"location" : "https://developer.api.autodesk.com/oss/v2/buckets/kumkortbucket/objects/sirkel.dwg"
}* Connection #0 to host developer.api.autodesk.com left intact
然后我使用 POST 作业命令转换它
curl -X "POST" -H "Authorization: Bearer OAUTH_TOKEN" -H "Content-Type: application/json" -v "https://developer.api.autodesk.com/modelderivative/v2/designdata/job" -d "{\"input\": {\"urn\": \"dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6a3Vta29ydGJ1Y2tldC9zaXJrZWwuZHdn\"},\"output\": {\"formats\": [{\"type\": \"svf\",\"views\": [\"2d\",\"3d\"]}]}}"
使用 GET 命令检查结果我得到以下结果:
{"type":"manifest","hasThumbnail":"false","status":"failed","progress":"complete","region":"US","urn":"dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6a3Vta29ydGJ1Y2tldC9zaXJrZWwuZHdn","version":"1.0","derivatives":[{"name":"sirkel.dwg","hasThumbnail":"false","status":"failed","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"}]}* 连接 #0 到主机 developer.api.autodesk.com 完好无损
我不知道我做错了什么。我可以在 autocad 和在线查看器中查看文件。
干杯。
编辑:
这是一个上传有问题的文件 http://www.filedropper.com/ekbsroplain
这是我所做的(整个过程):
curl -v 'https://developer.api.autodesk.com/authentication/v1/authenticate' -X 'POST' -H 'Content-Type: application/x-www-form-urlencoded' -d 'client_id=****&client_secret=****&grant_type=client_credentials&scope=data:read data:write data:create bucket:create bucket:read'
curl -v 'https://developer.api.autodesk.com/oss/v2/buckets' -X 'POST' -H 'Content-Type: application/json' -H 'Authorization: Bearer TOKEN' -d '{"bucketKey":"kumkortbucket170214","policyKey":"transient"}'
注意我上传时没有 content-type 和 content-length,实际上不需要:
curl -v 'https://developer.api.autodesk.com/oss/v2/buckets/kumkortbucket170214/objects/drawing1.dwg' -X 'PUT' -H 'Authorization: Bearer TOKEN' -T '/Users/augustogoncalves/Desktop/Drawing1.dwg'
最后 POST 工作:
curl -X 'POST' -H 'Authorization: Bearer TOKEN' -H 'Content-Type: application/json' -v 'https://developer.api.autodesk.com/modelderivative/v2/designdata/job' -d '{"input":{"urn":"dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6a3Vta29ydGJ1Y2tldDE3MDIxNC9kcmF3aW5nMS5kd2c="},"output":{"formats":[{"type": "svf","views": ["2d","3d"]}]}}'
而且工作得很好
{
"result":"success",
"urn":"dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6a3Vta29ydGJ1Y2tldDE3MDIxNC9kcmF3aW5nMS5kd2c",
"acceptedJobs":{
"output":{
"formats":[
{
"type":"svf",
"views":[
"2d",
"3d"
]
}
]
}
}
}