Reputation: 1208
I've built an APS Revit plugin that successfully processes Revit file URLs from S3 and GCS. My goal is to extend its functionality to handle URLs pointing to Revit files stored within ACC.
I've granted the necessary permissions to my APS plugin on the ACC project. I'm using following tutorial to access ACC cloud model from APS: https://aps.autodesk.com/blog/design-automation-api-supports-revit-cloud-model
But, when I try to access the file, I'm getting following error:
[04/25/2024 08:02:18] Autodesk.Revit.Exceptions.RevitServerUnauthenticatedUserException: You must sign in to Autodesk 360 in order to complete this action. [04/25/2024 08:02:18] at Autodesk.Revit.DB.ModelPathUtils.ConvertCloudGUIDsToCloudPath(String region, Guid projectGuid, Guid modelGuid) [04/25/2024 08:02:18] at SwappDesignAutomationPlugin.SwappExternalDBApplication.Execute(DesignAutomationData data) [04/25/2024 08:02:18] at SwappDesignAutomationPlugin.SwappExternalDBApplication.HandleDesignAutomationReadyEvent(Object sender, DesignAutomationReadyEventArgs e) [04/25/2024 08:02:18] at DesignAutomationFramework.DesignAutomationBridge.RaiseDesignAutomationReadyEvent(DesignAutomationReadyEventArgs e) [04/25/2024 08:02:18] at RevitCoreEngineTest.RceConsoleApplication.Program.UserMain(CommandLineArgs cl)
I'm using two-legged token for the APS plugin. From documettation, it seemed that if I only want to access the model, without modifying it, it would be enough.
Do I have to switch to three-legged token to access ACC? Am I missing something else?
Upvotes: 1
Views: 360
Reputation: 4451
Do I have to switch to three-legged token to access ACC? Am I missing something else?
Currently live cloud models in Design Automation for Revit are only supported with 3 legged token. Refer blog announcement for documentation and samples.
In short, you will provide the user context with the special argument adsk3LeggedToken
. We will setup the context and then your Revit API can function similar to how it functions for that user when they login on Desktop.
There is no plans to support 2 legged token with user impersonation.
Upvotes: 1
Reputation: 7070
If your ACC File URL looks like the below one, we can extract project id and item item from it, and then call Data Management API.
https://acc.autodesk.com/docs/files/projects/e976d832-93f7-44d3-9051-625bf228d216?folderUrn=urn%3Aadsk.wipprod%3Afs.folder%3Aco.j0erY7apSNGl6hJHUTHhOQ&entityId=urn%3Aadsk.wipprod%3Adm.lineage%3AmgJecIvQQ2OfqTbZSH8zxg&viewModel=detail&moduleId=folders&viewableGuid=250a6ce5-ee70-fdca-bfc9-4111f54e9baa
The project id from above is e976d832-93f7-44d3-9051-625bf228d216
. For using Data Management API, we must append b.
to this guid. i.e. b.e976d832-93f7-44d3-9051-625bf228d216
.
The item id of the Revit from the above is urn%3Aadsk.wipprod%3Adm.lineage%3AmgJecIvQQ2OfqTbZSH8zxg
, which URL encoded. We can System.Web.HttpUtility.UrlDecode to decode it to urn:adsk.wipprod:dm.lineage:mgJecIvQQ2OfqTbZSH8zxg
.
And then follow this tutorial to download the Revit file stored on ACC: https://aps.autodesk.com/en/docs/bim360/v1/tutorials/document-management/download-document-s3/, if your Revit model is not Revit cloud models or cloud worksharing models.
Upvotes: 0