Search code examples
autodesk-designautomation

Accessing ACC models from Revit Design Automation


  • I am trying to access ACC models from my Revit DesignAutomation plugin.
  • All my testing till now has been done in Postman.
  • Despite following to my best knowledge the guidance in the documentation, and passing in a valid adsk3LeggedToken in the Work Item invocation when running on the DA platform and trying to access an ACC Revit model, my Revit plugin throws an exception saying: Autodesk.Revit.Exceptions.RevitServerUnauthenticatedUserException: You must sign in to Autodesk 360 in order to complete this action.

My Activity definition body is:

 {
   "id": "NVCMActivity{{revitVersion}}",
   "commandLine": [ "$(engine.path)\\\\revitcoreconsole.exe /al \"$(appbundles[NVCMApp{{revitVersion}}].path)\" /nv_models \"$(args[NVCMParams].path)\"" ],
   "parameters": {
        "NVCMParams" : {
           "zip": false,
           "ondemand": false,
           "verb": "get",
           "description": "Input Models Params",
           "required": true,
           "localName": "params.json"
      },
      "result": {
          "zip": false,
          "ondemand": false,
          "verb": "put",
          "description": "Results",
          "required": true,
          "localName": "result.txt"
      }
  },
  "engine": "Autodesk.Revit+{{revitVersion}}",
  "appbundles": [ "{{dasNickName}}.NVCMApp{{revitVersion}}+nvcmapptest{{revitVersion}}" ],
  "description": "Execute Naviate CloudManager DA."
}

The body of the work item submission is:

    {
    "activityId": "NVCloudManagerDA.NVCMActivity2024+test2024",
    "arguments": {
        "NVCMParams" : {
          "url": "data:application/json, [{'Region': 'US', 'ProjectId': '062b8c8b-d33b-473f-9760-xxx', 'ModelGuid': 'c20b5561-4f6b-4eb1-b9b7-xxx'}]",
    },
    "result": {
        "url": "urn:adsk.objects:os.object:nv_cm_bucket/nv_cm_output",
            "verb": "put",
            "headers": {
                "Authorization": "Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IlhrU............7CFT7KL2A"
            }
        }
    },
    "adsk3LeggedToken" : "eyJhbGciOiJSUzI1NiIsImtpZC......7kg"
}

The 3 Legged Token is a valid token that has the code:all scope and I can successfully use it in other ACC api calls. (Get projects/folders/items etc)

Despite of this the Revit Plugin when running on the DA platform throws an exception saying: Autodesk.Revit.Exceptions.RevitServerUnauthenticatedUserException: You must sign in to Autodesk 360 in order to complete this action.

The DA report generated at the end of the run shows that the user has not been logged in

[02/10/2025 13:01:48] Running user application....
[02/10/2025 13:01:48] Found an addIn for registration: NebulaDA.Revit.DB.addin
[02/10/2025 13:01:48] Language not specified, using English-United States(ENU) as default.
[02/10/2025 13:01:53] ****** OnStartup
[02/10/2025 13:01:54] Get RCE: (VersionBuild) 24.2.10.64 (VersionNumber) 2024 (SubVersionNumber) 2024.2.10
[02/10/2025 13:01:54] ****** DesignAutomationReadyEvent
[02/10/2025 13:01:54] ===> Username:      acesuser
[02/10/2025 13:01:55] ===> LoginUserId:
[02/10/2025 13:01:55] ****** Path: T:\Aces\Jobs\1524a4ee662e413aa549a6eab8c5b675\result.txt
[02/10/2025 13:01:55] ***** File write SUCCESS
[02/10/2025 13:01:55] ***** Opening ACC Model
[02/10/2025 13:01:55] Autodesk.Revit.Exceptions.RevitServerUnauthenticatedUserException: You must sign in to Autodesk 360 in order to complete this action.
[02/10/2025 13:01:55] at Autodesk.Revit.DB.ModelPathUtils.ConvertCloudGUIDsToCloudPath(String region, Guid projectGuid, Guid modelGuid)
[02/10/2025 13:01:55] at NebulaDA.Revit.DB.ExternalDBApplication.DesignAutomationReadyEvent(Object sender, DesignAutomationReadyEventArgs e)
[02/10/2025 13:01:55] ****** OnShutdown

Is there anybody who could point me to the cause of my problem? Everything in my application works except for accessing ACC models 🙁

Thanks for your help,


Solution

  • As per your snippet, adsk3LeggedToken is outside the scope of WI arguments object, it should be within arguments scope.

    {
        "activityId": "NVCloudManagerDA.NVCMActivity2024+test2024",
        "arguments": {
            "NVCMParams": {
                "url": "urn:adsk.objects:os.object:nv_cm_bucket/intput",
                "verb": "get",
                "headers": {
                    "Authorization": "Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IlhrU............7CFT7KL2A"
                }
            },
            "result": {
                "url": "urn:adsk.objects:os.object:nv_cm_bucket/nv_cm_output",
                "verb": "put",
                "headers": {
                    "Authorization": "Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IlhrU............7CFT7KL2A"
                }
            },
            "adsk3LeggedToken": "eyJhbGciOiJSUzI1NiIsImtpZC......7kg"
        }
    }
    

    Refer: https://aps.autodesk.com/blog/design-automation-api-supports-revit-cloud-model