Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How do you access a model's GUID or UniqueId using the Revit API?

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
gimpert
2280 Views, 2 Replies

How do you access a model's GUID or UniqueId using the Revit API?

I'm trying to uniquely identify a Revit model (get a project's GUID), which I presume would mean using a Document's UniqueId. The following returns the same string, regardless of what model is active:

 

uiApp.ActiveUIDocument.Document.ProjectInformation.UniqueId;

 ... where uiApp is the UIApplication from ExternalCommandData.Application. I've also noticed that the string returned is the same even between Revit sessions and creating new projects from scratch.

 

Any help would be appreciated!

2 REPLIES 2
Message 2 of 3
Joe.Ye
in reply to: gimpert

 

Yes, I can confirm that the UniqueId property for some Revit documents are identical, I also found that some Revit documents have different GUID.

 

So you may need to add a shared parameter , and store the newly generated GUID for that project.

 

Hope this helps.



Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network
Message 3 of 3
gimpert
in reply to: Joe.Ye

Joe,

 

Thanks for confirming. I ended up adding my own GUID to the document element using the Revit extensible storage tools. I'd imagine a shared parameter would certainly work, too.

 

Regards,

Adam

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community