Understanding the use of the UniqueId

Understanding the use of the UniqueId

Anonymous
Not applicable
11,270 Views
24 Replies
Message 1 of 25

Understanding the use of the UniqueId

Anonymous
Not applicable

Hi all,

 

in the early days I thought that ElementId was a stable way of finding elements in a document, then I learned that UniqueId was the proper way.
But I havent been able to find enough coherent information about it to really understand it and I've been reading lately that we should use the uniqueId as a identifier in multifile projects (multiple centralfiles), because its only guaranteed to be unique in one centralfile.

This is what I've learned so far (From Jeremy Tammiks Blog among others):
The UniqueId 40 characters long and is made up from 2 parts, the first is internally called the EpisodeId and the second is the hexadecimal representation of the elementId. I've read that people complain about the fact that two revit files from the same template will have the same UniqueIds for the elements that are created in the template. So I guess that the EpisodeId cannot be used as a "file guid".

 

However, its stated by Arnost Lobel that the UniqueIds purpose (one of many?) is to have a stable way of identifying elements in a workshared environment, because the elementId of an element can change.

OK, then, but if the last part of the uniqueid is the elementid in hexadecimal form, wont that change the uniqueid also?

 

I've also found in a forum post that first part is connected to the WorksetId.

 

With all this in mind, is the best way of identifying elemtents in a multifile  to create a guid for each element and store it to them using a locked and hidden parameter (or extensible storage)?

 

Thanks for any help figuring this out!


/Erik

 

0 Likes
Accepted solutions (1)
11,271 Views
24 Replies
Replies (24)
Message 21 of 25

jeremy_tammik
Alumni
Alumni

Afaik, unique id never changes once it has been allocated. Element id can change, however; it is initially set locally and may be modified due to worksharing synchronisation. Does that help explain?

 

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 22 of 25

richard.schaffranek
Enthusiast
Enthusiast
Kind of,

so just assume that A and B work on the same file.
Then A uses the file to export some information for a following process.
Then A and B synchronise with BIM360 cloud
Then A exports again and gets broken ids ?
0 Likes
Message 23 of 25

jeremy_tammik
Alumni
Alumni

I would definitely expect using element id in this scenario to lead to broken ids.

 

Afaik, it should be safe to use the unique id, even in this scenario.

  

I can check with the development team to make sure, if you like.

 

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 24 of 25

richard.schaffranek
Enthusiast
Enthusiast
Yes please, we are having trouble with the id's bim 360 and follow up software programms and we would like to exclude some sources
0 Likes
Message 25 of 25

jeremy_tammik
Alumni
Alumni

We could probably help better if you explain a little bit more precisely what you are doing and what the problem is.

 

For instance, if you said, I am using element ids, we could simply answer, use unique ids instead, and the problem would be resolved.

 

I assume it is slightly more complex?

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes