Harry Mattison
Harry Mattison

Reputation: 31

How to get Project Guid and Model Guid from PathName?

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?

Upvotes: 3

Views: 4077

Answers (3)

Shashwat Bhardwaj
Shashwat Bhardwaj

Reputation: 1

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.

Upvotes: -2

DanTartaglia
DanTartaglia

Reputation: 1

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"

Upvotes: 0

Augusto Goncalves
Augusto Goncalves

Reputation: 8604

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();

Upvotes: 3

Related Questions