Element's UniqueID is 40 Digits long

Element's UniqueID is 40 Digits long

Anonymous
Not applicable
806 Views
4 Replies
Message 1 of 5

Element's UniqueID is 40 Digits long

Anonymous
Not applicable

 

Hi,

 

I noticed that the Element's UniqueID is "6147e9f6-5731-43cf-902e-b7468eb301e0-0001dd10" which is 40 digits not a proper GUID (32 Digits).

 

Is that right? or is there another proper GUID used to uniquely Identify elements (if I were to save them in an external database) ? Or can I just ignore the last 8 digits ?

 

- And if I do ignore the last 8 digits, will accessing elements using a partial unique ID work ?

 

Thanks

0 Likes
807 Views
4 Replies
Replies (4)
Message 2 of 5

arnostlobel
Alumni
Alumni

Hello walled511,

 

The answer depends on what you plan to use the externally stored IDs for. If you need to locate elements in the model some time later, you indeed need to store the whole UniqueId, for it is the only guaranteed way Revit can locate the exact element. If all you need is uniqueness of elements (but you do not need to locate them back in the model), you can use ExportUtils.GetExportId – which is also unique, but cannot be used for element lookup (not directly, at least). At some scenarios you may be even safe with using Element Ids, however that would not work in worksharing environment and some other situations.

 

Arnošt Löbel

Autodesk Revit R&D

Arnošt Löbel
0 Likes
Message 3 of 5

Anonymous
Not applicable

Hi, waleed511

 

Yes, you were right. The UniqueId is 40 Digits long. When new unique id is genereted as WorksetId (the first 32 digit as GUID) and hex representation of ElementId. So, you cannot 'just ignore the last 8 digits' because the first 32 digigts are not unique.

You should use a whole UniqueId as is.

 

Regards,

Victor. 

0 Likes
Message 4 of 5

Anonymous
Not applicable

 

Hi,

 

Thank you very much guys,

 

@Victor thank you yes I will keep the whole 40 digits.

 

@Arnošt, thank you, and as it turns out I need to get the ifcGuid of the element (even if I am not going to export it as an IFC file in this session) . So about ExportUtils.GetExportId, in the documentation it says it returns the Guid for IFC export. I need to get the ifcGuid for elements, but  the problem is the ifcGuid is Base64 encoding of that Guid, do I have to encode it myself or is there a way to get the exact value of the ifcGuid used when I export the project as IFC ?  

0 Likes
Message 5 of 5

arnostlobel
Alumni
Alumni

Hello walled511,

 

The answer is Yes, and No 🙂 There is no public method in Revit API to convert an Export ID to IFC compressed format; however, the compression method is available in the publicly obtainable code of our IFC exporter, which is an open-source project. (I have not done so myself, but I was told it’s rather easy to find it on the web.). Or, of course, you can write such a method by yourself; it is quite straightforward.

 

Thanks

 

Arnošt Löbel

Autodesk Revit R&D

Arnošt Löbel
0 Likes