Autodesk / update Geometry

2019-08-28 01:11发布

问题:

I have successfully uploaded a geometry to Autodesk Forge via the model derivative API. What I'm trying to do is overwrite the existing geometry with different data and have the new geometry displayed when reloading the viewer.

I have deleted the manifest via the DELETE :urn/manifest endpoint (doc: https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-manifest-DELETE/). After deleting the manifest translating the new geometry works fine but after all the old geometry is still displayed in the viewer. This is the case even if I delete the old geometry prior to uploading the new one.

This is the supposed solution for the issue: https://forums.autodesk.com/t5/view-and-data-api/bucket-object-has-overwritten-how-to-register-again/m-p/5428709/highlight/true

But setting the parameter x-ads-force to true in the HTTP header does not work for me.

This is my code for requesting the translation via the POST job endpoint of the model derivative API (https://developer.autodesk.com/en/docs/model-derivative/v2/reference/http/job-POST/):

import requests

url = self.api.base_url + "/modelderivative/v2/designdata/job"

header = {
        'Content-Type': 'application/json; charset=utf-8',
        'x-ads-force': 'true', # this is supposed to solve the issue
        'Authorization': 'Bearer ' + access_token,
    }

#prepare data
data = {
    "input": {
        "urn": base64_urn.decode()
    },
    "output": {

        "formats": [
            {
                "type": "svf",
                "views": ["2d", "3d"]
            }]
    }
}

#make request
r = requests.post(url, headers=header, data=json.dumps(data))

回答1:

There is no need to delete the manifest, you can simply submit a new translation job by setting the x-ads-force=true header.

However you would also need to clear your browser cache or run in incognito mode to see the changes as the viewer is caching the data upon loading of the model.

Take a look at that article which may be useful as well: I Make Changes and Nothing Happens.

Hope that helps.