Get Element Unique Id in Exported IFC

Get Element Unique Id in Exported IFC

Anonymous
Not applicable
2,738 Views
7 Replies
Message 1 of 8

Get Element Unique Id in Exported IFC

Anonymous
Not applicable

How we can get Elelment Unique ID in the Exported IFC file?

0 Likes
2,739 Views
7 Replies
Replies (7)
Message 2 of 8

TripleM-Dev.net
Advisor
Advisor

Hi,

 

Do you want to modify the exporter code?

Otherwise just push the UniqueId value to a Instance project parameter before exporting to IFC.

 

- Michel

0 Likes
Message 3 of 8

Anonymous
Not applicable

Yes  We need to modify Export Option to include Unique Id in th IFC in API. How can we include that option?

0 Likes
Message 4 of 8

TripleM-Dev.net
Advisor
Advisor

I'm not familiar with the IFC exporter code, but don't think there's something simple as setting a Option.

 

Why not just add a Parameter to the project and copy the UniqueId to it. (this can easy be done from the api)

And then Export the IFC as usual?

 

So each time you need to export to IFC first run the addin and then Export to IFC.

Would that be enough?

 

- Michel

 

ps.  You do know the ElementId itself already gets exported, where do you need the UniqueId for?

0 Likes
Message 5 of 8

RPTHOMAS108
Mentor
Mentor

Exporting the Revit UID may seem like a good idea because they tell me it is unique and never changes. However I once stored Revit UIDs externally for a model and then only about 50% matched up a week later in that same model. Had I changed 50% of the model in less than a week, no.

 

You may also notice that for Revit UIDs the majority of the UID is the same for many items (with only the very last part being unique). I'm thinking UIDs are partly related to initial workset assignment within a model and I'm thinking the reason only 50% of my externally stored UID's were found is because I detached and discarded the worksets!

 

There is a feature of the IFC exporter noted below. If you use this it will add a UID instance parameter to the element being exported in Revit and populate it with the UID used for that element in the IFC. If an IFC is subsequently exported it will use this UID from the parameter in Revit for the UID in the IFC file i.e. it can be used to track the same element between IFC issues. This to me seems like a better option.

 

You can access these exporter options via the API but it is not straightforward since you need to get objects from the custom exporter dll (depending on Revit version this is located in different places). You then use these exporter objects to update the DB.IFCExportOptions. The exporter objects use IFCExportOptions.AddOption to add the options that the custom exporter will then refer to when you call ultimately call Document.Export(String,String,IFCOptions).

 

CaptureZZ.PNG

 

ElementIDs  uniqueness is even worse since it is just a count of Elements being added to the database which then get consolidated during synchronisation.

 

 

Message 6 of 8

TripleM-Dev.net
Advisor
Advisor

Yes, correct forgot about that one.

 

There is however a issue with it, I had to turn it off because it never updated the value for copied items.

In a new version it does, but the Parameter wasn't set by "VaryByGroup" so now if the setting is on I get errors with Fix Groups. Issue is known I think, don't know if it also gives error for newly created projects with the latest exporter.

 

The ElementId stays persistent between session, but can change due to syncronization, that's why every user has to sync and release all before we do a Ifc Export. But the ElementId is only persistent  PER project file.

 

- Michel

0 Likes
Message 7 of 8

RPTHOMAS108
Mentor
Mentor

No I didn't know about those issues. Seems there is no perfect solution for us wanting to track the same element between model issues. Probably a dynamic model updater that adds a GUID  upon element addition is an approach.  Occasionally DMU's go wrong and the user is presented with a 'disable this updater' question and the only answer to that is yes.

 

I noticed that with Revit 2021 there is now a .VersionGUID property for each element but the description of that is a bit confusing and I'm not entirely sure what it is intended for:

 

"If element version Guid is the same for a certain element in two instances of the saved file then we guarantee that the two elements are identical. One element version covers a period of time that is larger than a single transaction: it is a period between two saves, synchronize to central and reload latest. Thus, in an opened document in-between saves or synchronize actions, this version cannot be used to determine if any particular element has changed. To watch for element changes happening in-session, use event."

 

Kind of wonder, couldn't they have just added a version date instead of a version GUID? 

0 Likes
Message 8 of 8

TripleM-Dev.net
Advisor
Advisor

I thought the new .VersionGUID was a means comparing model version, to keep track of changes of thesame model!

 

So if you have 2 version of a model, and a specific element has identical ElementId BUT different VersionGUID then the elemens is changed. (a Value or Geometry.). Could be interesting.

 

- Michel

0 Likes