It's been on my to-do list to write a free software equivalent of something like Solibri Optimiser. I'm not sure what the secret sauce is, but the logical approach towards IFC optimisation seems to simply recycle non-rooted elements.
It turns out you can do this in 10 lines of code (excluding IfcPatch boilerplate): https://github.com/IfcOpenShell/IfcOpenShell/commit/61f6ecbf179bae1eca6baef378c246a35100d414
I tested it on an IFC from the electrical engineering discipline (arbitrary, had it lying around) and it was 119,372kb prior to optimisation (direct from Revit), and it became 89,960kb after lossless optimisation.
In short, 25% of the file size could be safely removed.
Importing the unoptimised one in Blender took 103.26 seconds, and the optimised import took 94.76 seconds.
I know that FreeCAD has a recycler on export-time (BlenderBIM Add-on does not, so I expect IFCs from Blender to be rather inefficient too), so it'd be interesting to run this on a large FreeCAD IFC.
Just for fun, I zipped it (for .ifczip
) and it ended up being 19MB. Not too shabby for a large project. Tiny filesizes indeed!