Writting here to clarify my own mind on the subject of Revit element identifiers.
In each Revit file there is an id called
ElementId, a small number as bellow. This number is unique to the
file. This means that if we mix elements from different files we will/may get repeated ids, which is not good.
Then we have the
GUID, or
IFC id, which is (statistically) unique in the whole universe for every element create, ever. This identifier is created only when the Revit file is exported to IFC, and here is a nice trick: When we export an IFC file, we can ask Revit to store the IfcGUID in an element parameter, and then it will become part of the model, since it will not be generated again for that model (found that
here).
We can then see it in the Properties dialog:
What is strange/scary is that we can then change that parameter's value in the Properties, and Revit will keep using that value in future IFC exports. When the parameter is populated we can access it in Dynamo too:
When I convert a model to IFC, send it to Unity using
https://www.tridify.com/ and open it there I can spot the Revit id, and the IFC Id (GUID) there:
I can also find it in the IFC file, and right next to it we can see the Revit Id (the short one)
Finally we have the Revit
UniqueId, which is an Id issued by Revit and which can be converted to the IFC GUID (more on that here:
https://thebuildingcoder.typepad.com/blog/2009/02/uniqueid-dwf-and-ifc-guid.html).
Found also this post that explains what I wrote above in more detail and contains Python code to get all identifiers:
https://wrw.is/the-many-ids-of-a-revit-element-and-how-to-work-with-them-elementid-uniqueid-dwf-guid-ifcguid/.