In our solution we need a reference between a Revit model and its presence in the cloud (BIM 360/Autodesk Construction Cloud).
In Revit we open a cloud model or save a model to the cloud (Save As cloud model). The rvt-file obviously "knows" where it is placed in the cloud but I see no way to extract that information from the file. The challenge is therefore to find the files Item id in the cloud.
Currently we do the following:
From the Revit document we get
- CloudProjectName (extracted from Revit api Document.GetCloudModelPath())
- ModelGuid (Revit api Document.GetModelGUID())
Then...
- Get the accounts for the user (Forge Datamanagement API https://developer.api.autodesk.com/project/v1/hubs)
- For each account: Iterate through projects to find project with the specified name. (Forge Datamanagement API https://developer.api.autodesk.com/project/v1/hubs/:hub_id/projects)
- If project found: Search root folder in project to find files with the specified ModelGuid (Forge Datamanagement API https://developer.api.autodesk.com/data/v1/projects/:project_id/folders/:folder_id/search?filter[attributes.extension.data.modelGuid]={ModelGuid})
- If 1 or more files found: Pick out the 'original' file. (relationships.item.data.id == attributes.extension.data.originalItemUrn)
(We do not care about the cloud model version).
This actually works, except step 3 can be a bit tricky. It takes several minutes, maybe hours, from the model is uploaded to the cloud until a search is possible which is quite annoying.
So here is two questions:
- Is there a better/easier way to find the cloud Item id of the file?
- Is there an alternative to the 'search' call (step 3) or at least some kind of documentation saying when a result can be expected to be available?