skip to Main Content

I have been following along with the Translate a Revit File, Generating Room and Space Information tutorial. Right now I’m stuck on task 3 trying to translate a Revit source file to SVF2.

Using the provided Revit file and the following request POST https://developer.api.autodesk.com/modelderivative/v2/regions/eu/designdata/job:

// Headers
[
 'Authorization' => ...,
 'Content-Type'  => 'application/json',
 'x-ads-force'   => true,
]
// Body
[
  "input" => [
    "urn" => "<some urn>",
    "compressedUrn" => false
  ],
  "output" => [
    "destination" => [
      "region" => "EMEA"
    ],
    "formats" => [
      [
        "type" => "svf2",
        "views" => [
          "2d",
          "3d"
        ],
        "advanced" => [
          "generateMasterViews" => true
        ]
      ]
    ]
  ]
]

I always get the following messages:

Revit-UnsupportedFileType
The file is not a Revit file or is not a supported version. TranslationWorker-RecoverableInternalFailure
Possibly recoverable warning exit code from extractor: -536870935

I hope someone can tell what is wrong with the POST request. I found a similar question but the answer doesn’t seem apply to this issue.

3

Answers


  1. Chosen as BEST ANSWER

    When asking the question I was using the following code to upload the file to Autodesk using Laravel's http client:

    $response = Http::attach( 'file', $file->getContent(), $file->getClientOriginalName() )
    ->put( $signed_url );
    

    This did upload the files and everything worked for zipped models. But as explained in the question plain source files like .ipt or .rvt did not translate.

    I guess Laravel is adding something to that request that somehow corrupts files for Autodesk. Using the following request:

    $response = Http::withHeaders( [
         'Content-Disposition' => 'attachment; filename='.$file->getClientOriginalName(),
          'Content-Length'      => $file->getSize(),
    ] )
        ->send(
            'PUT',
             $signed_url,
             [
                  'body' => $file->getContent(),
              ]
         );
    

    it does work. I guess using send, sends a "raw"/ binary request.

    In Symfony it would look something like:

    $response = HttpClient::create()->request(
       'PUT',
        $signed_url,
        [
           'body' => $file->getContent(),
            'headers' => [
                  'Content-Disposition' => 'attachment; filename='.$file->getClientOriginalName(),
                   'Content-Length' => $file->getSize()
              ]
          ]
    );
    

  2. I actually tried this same tutorial myself and it works perfectly on my end. As long as you follow every step, you are supposed to get the desired result.

    If you’re running into an error in the third task, it shows there might be something you didn’t do correctly in Task 2.

    There are a few steps you should check in Task 2 that Task 3 is dependent upon. Please check the following:

    • Make sure your file is fully uploaded. Look at "Upload the file" section in Task 2 of the tutorial.
    • You must inform OSS (Object Storage Service) that the upload operation is complete. Look at "Finalize Upload" section in Task 2.

    These actions should ensure that your file is fully uploaded and ready to be translated to SVF2

    NOTE: When doing all these processes, make sure your Access Token is valid as it only remains valid for one hour. If the token expires, you must obtain a fresh token by sending an authenticate request to Forge once again.

    Login or Signup to reply.
  3. I’m not familiar with Lavarel so I might not offer much help on that part.

    However, you could try and use another framework like Nodejs or even .NET to try and see if you can achieve your desired results.

    You can follow this tutorial that will help you get started in creating your application on top of the Autodesk platform using either Nodejs or .NET framework: https://forge-tutorials.autodesk.io/

    You will get to use the Model Derivative API and you can then try and convert the model as intended.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search