1

I was following the steps from this tutorial to convert a file to svf format in order to be able to view it using the autodesk viewer. https://forge.autodesk.com/en/docs/model-derivative/v2/tutorials/prep-file4viewer/

I was trying to convert a dwg file to svf. I got to task 3 step 1 with no problem, but in step 2, when I make the request, I get the following response :

{"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"}

I tried to view the file using their online viewer and was able to view it perfectly so I know that there's nothing wrong with the file. What could be the possible reason for this error?

Edit :

After I obtained access token and created bucket, I used this request to upload file to the bucket (Step 2 of Task 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'

The response to this is 200OK.

Then I used the online tool given in the tutorial to convert urn to base 64 encoded urn.

Here's the job post request (Step 1 of task 3) I sent :

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} } ] } }'

the response to this is "success"

and the get request to check the status of the translation :

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

the response to this is what I included above.

The file is actually uploaded to the bucket and I was able to view it at https://oss-manager.autodesk.io/# but even there, it shows translation failed.

Edit 2: Here's an image of the response from https://oss-manager.autodesk.io/ get manifest request (used dev tools to get this)

enter image description here

2 Answers2

2

Based on the comments added to the previous answer it seems like the issue is with the upload part. As you can see in the tutorial it's using

--data-binary '@PATH_TO_DOWNLOADED_ZIP_FILE'

The @ symbol is important, without it you'll get a reply like this

{
"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
}

Look at the size: 27 - that's definitely not right. And so when I try to translate the file I get the same error messages that you got.

However, if I add the @ symbol then all is good:

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'

Note: I'm on a Mac, on Windows the path will look a bit different

Reply I got this time:

{
"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
}

And this time when I tried to translate the file, it succeeded.

Adam Nagy
  • 1,700
  • 1
  • 9
  • 14
0

Change the compressedUrn to false if you working with single file or if you working with zip file so, set to true also mention rootFilename file name(root file name) in response body.

  • rootFileName should be just the name of the file right? – user13768823 Jun 18 '20 at 13:44
  • What is your request body? – dhinchak developer Jun 18 '20 at 15:05
  • Are you still having issues with the file? If so, could you please provide the request body for POST Job? Also, could you double check that the upload was successful? You could try something like https://oss-manager.autodesk.io/ to view the uploaded file – Adam Nagy Jun 22 '20 at 19:49
  • @AdamNagy updated the question with the requests. Even tried viewing the uploaded file on the link provided but it says translation failed – user13768823 Jun 23 '20 at 12:31
  • The sample you are using is for a zip file, but you are uploading a dwg directly and not inside a zip. As @dhinchakdeveloper said you would have to set `compressedUrn` to `false` (or just ignore it along with `rootFilename`). Also, I think `generateMasterViews` is only for **Revit** files so you can leave that out as well. So the body would be: '{ "input": { "urn": "{URN}" }, "output": { "destination": { "region": "us" }, "formats": [{ "type": "svf", "views": ["2d", "3d"] } ] } }' – Adam Nagy Jun 23 '20 at 19:08
  • @AdamNagy I tried with compressedUrn set to both true and false, it gave the same result. – user13768823 Jun 24 '20 at 03:21
  • Yes @AdamNagy generatMasterViews is specific to revit model. – dhinchak developer Jun 24 '20 at 08:57
  • try this request: `curl -X POST \ https://developer.api.autodesk.com/modelderivative/v2/designdata/job \ -H 'authorization: Bearer {{AccessToken}}' \ -H 'cache-control: no-cache' \ -H 'content-type: application/json; charset=utf-8' \ -d '{ "input": { "urn": "{{Urn}}", "compressedUrn": false, "rootFilename": "{{RootFileName}}" }, "output": { "destination": { "region": "us" }, "formats": [ { "type": "svf", "views": ["3d", "2d"] }] } }'` – dhinchak developer Jun 24 '20 at 08:58
  • tried with the above request and got the following response : @AdamNagy `{"urn":"dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6YnVja2V0MTJzL3Zpc3VhbGl6YXRpb25fLV9hZXJpYWwuZHdn","derivatives":[{"hasThumbnail":"false","name":"LMV Bubble","progress":"complete","messages":[{"type":"error","message":"Tr worker fail to download.","code":"TranslationWorker-InternalFailure"}],"outputType":"svf","status":"failed"}],"hasThumbnail":"false","progress":"complete","type":"manifest","region":"US","version":"1.0","status":"failed"}` – user13768823 Jun 24 '20 at 12:40
  • @user13768823 mentioned curl call working fine for me – dhinchak developer Jun 24 '20 at 12:59
  • the post job call works fine I get `{"result":"created","urn":"dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6YnVja2V0MTJzL3Zpc3VhbGl6YXRpb25fLV9hZXJpYWwuZHdn","registerKeys":["72277562-63e4-4d8d-ab04-3a33f55a7838"],"acceptedJobs":{"output":{"destination":{"region":"us"},"formats":[{"type":"svf","views":["3d","2d"]}]}}}` but I get "failed" response (above error) when I make the get call to check the translation status. Did you try with a dwg file as well? – user13768823 Jun 24 '20 at 13:18
  • could it have anything to do with scopes? In get token request, i'm setting scopes to `data:write data:read bucket:create bucket:delete` @AdamNagy – user13768823 Jun 24 '20 at 13:29
  • If your scope is not good the POST job would already fail. Could you check your file with oss-manager.autodesk.io to see if it got uploaded OK and can be translated? (it's not forcing translation, so you would have to click the Delete button in the middle section to delete the manifest and all previous translation requests) before selecting the file again to kick off translation to SVF – Adam Nagy Jun 24 '20 at 14:26
  • @AdamNagy it got uploaded but says translation failed. I clicked on the delete button and it started translation again only to fail again. Also, the file seems to be okay as I'm able to view it using the online viewer – user13768823 Jun 24 '20 at 16:08
  • @AdamNagy edited post with an image of the error message from the oss-manager.autodesk.io site. Not sure what the problem is exactly, since I'm able to view this file on the online viewer – user13768823 Jun 24 '20 at 16:52
  • The file you have **locally** may be OK, but is the **uploaded file** in the bucket ok? If you upload it using oss-manager, and then translate it, does the translation succeed? – Adam Nagy Jun 24 '20 at 17:55
  • Yes, uploading the same file using oss-manager works. Translation is successful and I can view the file too @AdamNagy – user13768823 Jun 25 '20 at 02:51
  • I'm having the same exact issue with a .dxf file. However when I upload via the oss manager, the file uploads but fails the translation. What does that mean? – J.E.C. Jul 17 '20 at 09:32