0

I've been trying to use the forge viewer and I cannot get it to translate the .rvt files with the room info. I read you need to specify: "generateMasterViews": True and in the headers 'x-ads-force: true' What am I doing wrong??? here is my code:

model_url='modelderivative/v2/designdata/job'
urn=json.loads(r_file.text)["objectId"]
print(urn)
urn_b=base64.b64encode(bytes(urn,'ascii'))
urn1=urn_b.decode('ascii')

headers4={
            'content-type': 'application/json',
            "Authorization": 'Bearer ' + access_token,
            "x-ads-force": 'true'
        }
format_type = 'svf';
format_views = ['2d','3d'];
data4={
        'input': {
            'urn': urn1
        },
        'output': {
            'formats': [
                {
                    'type': format_type,
                    'views': format_views
                },
            ],
            "advanced": {
                "generateMasterViews": True
            }

        }
    }
r_model=requests.post(base_url+model_url,headers=headers4,data=json.dumps(data4))
r_model.text
julianf19
  • 51
  • 4
  • May I know what the Revit version of your model is? Could you try other tools (e.g. postman) to submit the REST API call? if your Revit version is not too old, then it's probably that the above code snippet cannot send the correct job configuration in the body. – Eason Kang Mar 15 '22 at 08:09
  • I've tried uploading 2021 and 2022 versions of rvt. – julianf19 Mar 15 '22 at 13:46
  • Could you try the sample models from [Revit Sample Project Files](https://knowledge.autodesk.com/support/revit/getting-started/caas/CloudHelp/cloudhelp/2022/ENU/Revit-GetStarted/files/GUID-61EF2F22-3A1F-4317-B925-1E85F138BE88-htm.html) to test your code? – Eason Kang Mar 17 '22 at 08:23
  • I ended up doing it with the forge-dataviz-iot-reference-app. That worked after making the file a bit lighter. But no, even with the sample project it wouldn't create an svf with room info. – julianf19 Mar 23 '22 at 15:41
  • That's strange ... Could you test with this vscode extension, and submit the master view transition by clicking the `translate object (custom)`? https://marketplace.visualstudio.com/items?itemName=petrbroz.vscode-forge-tools – Eason Kang Mar 24 '22 at 01:24
  • if you want to discuss this online, you may book a meeting here: https://forge.autodesk.com/blog/the-doctor-is-in – Eason Kang Mar 24 '22 at 01:32

0 Answers0