Calculate the IfcGUID by using Revit Element GUID and Revit Element ID

Hi all,
do you know if there is a Dynamo node to calculate with the Revit Element GUID and the Revit Element ID the IfcGUID?
Because if you have exported with Revit an IFC file, the IFC Exporter will write the IfcGUID to the parameter “IfcGUID”. But if the RevitID of a element changes (for example when splitting a wall), the IfcGUID parameter of one wall is wrong and causes problems if you create again an IFC file.
I want to create a script which checks, if the existing value in the parameter IfcGUID is the correct one and if not, replaces it with a correct one.

I have found some code on the building coder website (#1, #2, #3) but it doesn’t help me further. This problem is linked to an Autodesk forum post from someone else and I try to solve it with Dynamo :slight_smile:

Thanks, Thomas

This may be worth reviewing: The Building Coder: Unique Id and IFC GUID Parameter

1 Like

ye, it is the #3 link in my post. But Jeremy does not consider, that the Revit Element ID can change (for example when splitting walls.

Let’s assume you have a wall with Element ID 11111 and export the Revit model to IFC and tick the box in the settings “Store the IFC GUID…” to write the IfcGUID value into the Revit wall family. After the Export process you split the wall. Now you have 2 walls. One wall with Revit ID 11111 und the other wall with Revit ID 22222. But both walls still have the same value stored in the Element parameter “IfcGUID”. Thus during the next IFC export, the IFC Exporter does not write a new IFC GUID to the parameter, by using Revit GUID and Element ID (because there is already a ifc guid value in the element parameter “IfcGUID”) instead the IFC Exporter tries to use the existing value in the “IfcGUID” Parameter for the IFC export. Because for both wall elements, there is now the same IfcGUID value, it will have for each new IFC Export a new random IFC GUID in the ifc file (because identical IfcGUID for different elements are not allowed). Which is really bad for other companies who want to see changes compared to the previous IFC Export. Because they think you have created a new element every time.

A solution with Dynamo would be, to check the IfcGUID parameter in Revit before the IFC Export, if it is the right value. If not delete it / replace it with a correct one. And maybe only for the elements where you have used the split tool.

I think that the IFC GUID should clear out on the 22222 wall when it is split; we may have a Revit bug to address.

What version of Revit have you tested this in?

Just confirmed: When splitting a wall the previous Element ID, Unique ID, DwfID, and IfcID are maintained for the wall which has the same start point as the prior wall, while the wall which has the same end point receives a new ID, GUID, DwfID and IfcID. If you’re seeing something different can you please post a before data set, an after data set, and the journal where the matching GUID came into place?

Also note that IFC GUIDs are not stored natively in the .rvt file, but are generated at creation of the IFC; if you’re seeing walls with these values it’s likely that you’ve put yourself into a loop where you’re editing an imported IFC, which may be the root cause but I cannot confirm.

ok, I have tested it today with Revit 2023 and it seems in Revit 2023 the problem is solved. It creates a new ifcGUID value for the 2nd part of the splitted wall.

Initially I have tested it with Revit 2021.1.6 and IFC Exporter (the latest version without critical bugs) and there it will keep the value for the IfcGUID in the 2nd part of the splitted wall. The latest IFC Exporter still have the problem. I think it needs to be fixed with a Revit Update because it has to be included with the split tool action.

As a workaround, until we have a functional IFC Exporter Version / Revit 2021 Update, a Dynamo node for calculating the IfcGuid would be a solution :slight_smile:

I don’t believe this is so - the issue appears to be associated to the workflow you’re using as I cannot reproduce the issue in 2019 though 2023.

The intent of the IFC GUID is that it is calculated only at export, and not stored in the .rvt. As such the second wall will not have any recollection of the previous IFC value. The only objects which should show this GUID are imported IFCs which need to preserve the GUID they had on import to prevent issues. My guess is that you’re not splitting a native Revit wall, but editing an IFC wall?