BIM-Tools / SketchUp-IFC-Manager

IFC data manager and exporter for SketchUp.
GNU General Public License v3.0
59 stars 20 forks source link

How to maintain GUID consistency when exporting IFC #62

Closed a7231645 closed 2 months ago

a7231645 commented 3 months ago

Hello! I encountered a problem when exporting an IFC file. Specifically, I’m interested in knowing how to ensure that the GUID of an unchanged model remains consistent every time it is generated. This is important because when I reload the link in Revit, if the GUID is not consistent, it can lead to the loss of dimension annotations. Could you please advise on how to resolve this issue? Thank you!

janbrouwer commented 3 months ago

Persistent GUID's is not easy in Sketchup because component instances can be themselves nested in components resulting in multiple copies of the same instance (something which does not exist in IFC). The way GUIDs are stored has changed since 4.3.1, models made with an older version will get completely new GUID's. Currently the GUID's are stored using the "persistant-id-path" of the component, which is also added in the IFC "Tag" attribute (by some known as BATID I believe). The persistant-id of a component instance remains the same when saving and reloading a model, and editing of a component definition. But to get truely unique ID's we have to use a combination of all ID's in the component hierarchy. Like the ID of the IfcSite object, then the ID of the IfcBuilding object and so on. These are concatenated with a "." and the combined string is used to store the GUID. So when an object gets moved from the first building storey to the second, the paths ar not the same and the instance object will get a new GUID.

Looking at the "tag" attribute you can see if the hierarchy is still the same, if that's the case the GUID should also remain unchanged.

So changing the content of components and just moving them around, should not give you new GUID's, moving them to another component should.