To my knowledge, there is no robust conversion utility available in both the proprietary and FOSS worlds that do IFC2X3<->IFC4. You could theoretically pass it through an authoring app, but that's a data loss nightmare for proprietary apps, and tools like the BlenderBIM Add-on aren't there yet, though they are much closer. With a utility like this, apart from the obvious usecase of upgrading / downgrading for compatibility, it can also help in partial data exchange and IFC-roundtripping, which is underway in the BlenderBIM Add-on.
I've started an attempt here: https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.6.0/src/ifcopenshell-python/ifcopenshell/util/schema.py
It's still incomplete, and it works through a two step process. The first step attempts to convert the IFC class. The second step attempts to convert the attributes in the IFC class. I expect this tool to mature over time and turn into a robust utility.
The class mapping is derived from the IFC4 changelog. However, a human needs to go through and make a decision on how to map classes, or if they can even be mapped. buildingSMART does not seem to have any documents regarding this. E.g. IfcExternalSpatialElement
- should we discard it, or can we gracefully downgrade to IfcSpace
? More complex mappings are also not yet supported, like polygonal face sets vs faceted breps.
The attribute mapping is also derived from the IFC4 changelog. However, sometimes things aren't so straightforward. E.g. if both a class mapping and an attribute mapping applies, there is no official document which describes the migration path. I think we'll just come across these from experience over time.