2

My Revit model has an RVT link with a PathName = "BIM 360://Testing Link Edit in BIM360/ArchitectureBIM360.rvt"

I want to construct a ModelPath and use it to open the cloud-hosted file as follows:

ModelPath mp = ModelPathUtils.ConvertCloudGUIDsToCloudPath(projectId, modelId);
linkDoc = uiapp.OpenAndActivateDocument(mp, new OpenOptions(), false, new cloudCallback()).Document;

How do I get the projectId and modelId GUIDs from the PathName?

Augusto Goncalves
  • 8,493
  • 2
  • 17
  • 44
  • I believe so, just double check that information before my answer. Have you tried already? – Augusto Goncalves Jul 17 '18 at 20:18
  • @AugustoGoncalves the 2019 What's New says "the project Guid and model Guid (which could be obtained from various Forge APIs)." But which Forge APIs should be used to get the GUIDs when all I have is the PathName of the RVT Link? – Harry Mattison Jul 17 '18 at 20:21

3 Answers3

2

Using Forge Data Management API you can list Hubs > Projects > Folders > Items > Versions. An item is essentially a file, but it can have 1+ versions, so that's why you need the specific version. This tutorial guides you on the steps.

Once you list version of an item, it should be an array under .data, each entry on the array should have something like (simplified):

{  
   "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",
            ....
         }
      }
   },
   ....
}

Update

From the comment, on Revit desktop, you can use:

ModelPath path = doc.GetCloudModelPath();
Guid guid1 = path.GetModelGUID();
Guid guid2 = path.GetProjectGUID();
Augusto Goncalves
  • 8,493
  • 2
  • 17
  • 44
  • 1
    The tutorial you suggest requires information that does not seem to be available in the situation I describe. All I have is a RevitLinkInstance from an RVT on BIM360. Considering that RevitLinkType.PathType throws InvalidOperationException (The PathType of the Revit link cannot be determined (or set), because it was not loaded from a local disk drive or from Revit Server), I am wondering if Revit 2019 supports getting this modelGuid and projectGuid from a RevitLinkInstance. Could you confirm if this can or can't be done? – Harry Mattison Jul 20 '18 at 15:14
0

I'm not using the Forge API yet (I really need to go through the tutorial myself). I do not know if this would help in anyway or if you found the answer you were looking for but the cache folder does contain all the file and project GUIDs including links: "C:\Users\username\AppData\Local\Autodesk\Revit\Autodesk Revit 2019\CollaborationCache\2008062704538XX\4680d561-ed69-4a61-b9b2-587582b1627a\LinkedModels\1f96b01e-640e-4e16-93af-edcc11769570.rvt"

  • I can confirm that the first GUID in your example "4680d561-ed69-4a61-b9b2-587582b1627a" is the Project GUID. For the Model GUID, I tested opening models directly within the project folder using the GUID in the .rvt file name with RevitBatchProcessor v1.6 and it works. Not sure about the behavior on files within the LinkedModels folder though.. – Vincent Cadoret Jun 11 '20 at 15:46
-2

In the below path:

C:\Users\username\AppData\Local\Autodesk\Revit\Autodesk Revit 2019\CollaborationCache\2008062704538XX\4680d561-ed69-4a61-b9b2-587582b1627a\LinkedModels\1f96b01e-640e-4e16-93af-edcc11769570.rvt"

2008062704538XX is the oxygen ID which is a unique ID and it is linked to your Autodesk account.

4680d561-ed69-4a61-b9b2-587582b1627a is the GUID of the Project.
1f96b01e-640e-4e16-93af-edcc11769570 is the GUID of the linked model.

Neo Anderson
  • 5,957
  • 2
  • 12
  • 29