Search code examples
autodesk-forgeautodesk-model-derivative

Forge ModelDerivativeAPI: can't convert to obj format


I'm trying to convert .nwc file uploaded on my A360 account with ModelDerivativeAPI with this method. While converting to svf and some other formats works for me perfectly I have troubles with converting to obj format. I keep getting the following 400 error:

{ "diagnostic": "Failed to trigger translation for this file." }

Here is the body of my POST request:

{

    "input": {
      "urn": "dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLjJFZWM1RzZsU1NXMXNnVmFUSW93Zmc_dmVyc2lvbj0x"
    },
    "output": {
      "formats": [
        {
         "type": "obj"
        }
      ]
    }

}

What am I doing wrong?


Solution

  • Try to add the advanced field as follow:

    {
     "input": {
      "urn": "dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLjJFZWM1RzZsU1NXMXNnVmFUSW93Zmc_dmVyc2lvbj0x"
     },
     "output": {
      "formats": [
        {
         "type": "obj",
         "advanced": {
          "objectIds": [-1], // -1 means all nodes, otherwise specify an array of valid dbIds
          "modelGuid": "ab2fb5b0-9101-0d3e-28c9-e61f9f0c15c5" // Get this one from the GET :urn/metadata call - https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-metadata-GET/
         }
        }
      ]
     }
    }
    

    You can use my sample https://oss.autodesk.io which exposes a UI to help you test and format the payloads:

    enter image description here

    Hope that helps