Projet Unique Id

Hi all,

I’m looking to make a python script to retrieve information from a Revit project, I’m stuck on the uniqueid of the project. Is there a guid of the Revit project?
From my research, maybe there is also a guid for shared projects, but I can’t find the methods to retrieve them.

Thanks in advance

Stored under the Project Information:

But may not be so unique…
https://forums.autodesk.com/t5/revit-api-forum/how-do-you-access-a-model-s-guid-or-uniqueid-using-the-revit-api/m-p/3571712#M2917

Thanks for your reply,

This is the information I’m looking for, but I couldn’t find the right method with python.

ok I succeeded


It’s so easy :sweat_smile:

1 Like

doc.ProjectInformation.UniqueId should get you what you requested.
However, I don’t think it is going to give you what you need.
I’m sitting here with two projects open. They both have exacly the same UniqueId.

Using the IFC seems more common. Or your own guid. But that will have to be generated.
ifcproject = ExporterIFCUtils.CreateProjectLevelGUID(doc, Autodesk.Revit.DB.IFC.IFCProjectLevelGUIDType.Project)

doc.ProjectInformation.UniqueId` should get you what you requested.
However, I don’t think it is going to give you what you need.
I’m sitting here with two projects open. They both have exacly the same UniqueId.

it’s bad news

1 Like

By any chance did the two models start as one model and then get ‘split out’ into two separate models? In this case I believe the ‘unique’ ID is not actually unique and both models will have the same ID.

Yes, each as a save as from the last. Now I have 3 with the same Id.

I came across this issue while working in Rhino Inside Revit. I don’t believe there is a fix yet for RIR:

But this might work (but I haven’t tried):

1 Like

Thanks all,
I will look at what is shared by jeremmy.
It looks like he has studied the subject well, challenge replicating this with Dynamo as he is basically talking about Revit