Revit Cloud Models Integration
API Overview
Design Automation for Revit integration with Autodesk Docs enables access and modification to both Revit workshared cloud models and non-workshared cloud models. These cloud models can be accessed from Design Automation appbundles using standard RCM Desktop Revit APIs. Revit 2022, Revit 2023, and Revit 2024 are currently supported for this functionality.
API Additional Details
In order to access cloud models using Design Automation, you need to provide the user context through a special workitem argument adsk3LeggedToken. To obtain a 3-legged token, refer to the existing documentation. In addition to a 3-legged token, scope=code:all needs to be added to your authorization call. When this token is provided in the argument, the user context can be derived and the Revit Cloud Model APIs will be enabled within Design Automation. The job will have access to any models and API operations the specified user has access to. Because user context is required, if the adsk3LeggedToken workitem argument is not included or incorrect, the Revit Cloud Model APIs such as Document.OpenDocumentFile() will not be able to open a cloud model. Additional APIs that do not require user context will continue to work as they do currently within Design Automation for Revit.
The 3-legged token allows the user (resource owner) to give you (developer) access to their resources without providing the credentials. The presence of a valid 3-legged token in your workitem allows Design Automation for Revit to derive and setup the user context necessary to access the resources owned by the user.
Refer to the code Example.
Element Ownership Validation
Validation has been added to check if the user running a Design Automation for Revit job already has elements checked out in the cloud model. For cases where this is true, the validation will post a warning(FailureDefinitionId:’BuiltInFailures.OpeningFailures.ModelAlreadyCheckedOutByUser’) notifying the user has previously modified or checked out elements for the cloud model, and if creating a new local file and making additional modifications, the original changes could be invalidated.
The default failures processor will stop operations on the file after the warning when this is true. If preferred, a custom failures processor can be utilized instead to bypass the warning and continue operations on the file and job regardless of element ownership.
For additional information on modifying the default failure handling, refer to the Handling Revit Failures page.