SONA
SONA

Reputation: 11

Open files located in the ACCDocs

I've developed a plugin project in Visual Studio with RevitAPI to open batch Revit files to export data. I can add many files which are on the networks and the plugin automatically opens all the files. Is it possible to open files that are in the ACC Docs cloud?

I know I can open AccDocs which were be already downloaded with searching in collaboration cache folder, but how to open files which are not yet downloaded?

Thanks

Upvotes: 0

Views: 643

Answers (1)

Eason Kang
Eason Kang

Reputation: 7070

Since you mentioned the collaboration cache folder, I suppose your Revit model is the Revit Cloud Worksharing model (a.k.a C4R model, model of Autodesk Collaboration for Revit).

If so, we can call APS Data Management to obtain the projectGuid and modelGuid in the model's version tip like below.

{  
   "type":"versions",
   "id":"urn:adsk.wipprod:fs.file:vf.abcd1234?version=1",
   "attributes":{  
      "name":"fileName.rvt",
      "displayName":"fileName.rvt",
      ...
      "mimeType":"application/vnd.autodesk.r360",
      "storageSize":123456,
      "fileType":"rvt",
      "extension":{  
         "type":"versions:autodesk.bim360:C4RModel",
         ....
         "data":{  
            ...
            "projectGuid":"48da72af-3aa6-4b76-866b-c11bb3d53883",
            ....
            "modelGuid":"e666fa30-9808-42f4-a05b-8cb8da576fe9",
            ....
         }
      }
   },
   ....
}

Afterward, open the C4R model using Revit API like below:

var region = ModelPathUtils.CloudRegionUS; //!<<< depends on where your BIM360/ACC account is based, US or EU.
var projectGuid = new Guid("48da72af-3aa6-4b76-866b-c11bb3d53883");
var modelGuid = new Guid("e666fa30-9808-42f4-a05b-8cb8da576fe9");

var modelPath = ModelPathUtils.ConvertCloudGUIDsToCloudPath( region, projectGuid, modelGuid ); //!<<< For Revit 2023 and newer.
//var modelPath = ModelPathUtils.ConvertCloudGUIDsToCloudPath( projectGuid, modelGuid ); //!<<< For Revit 2019 ~ 2022

var openOptions = new OpenOptions();
app.OpenAndActivateDocument( modelPath, openOptions ); //!<<< on desktop
// app.OpenDocumentFile( modelPath, openOptions ); //!<<< on Design Automation for Revit or don't want to activate the model on Revit desktop.

References:

Upvotes: 1

Related Questions