buildingSMART Forums

Merging IFC2*3 Elntities in a IFC4 file

I am not sure if this forum is the proper place to put this question but here it is:
I need to merge bunch of entities from a series of IFC4 files into other files that may be version 4 or 2*3, using ifcopenshell. and receive error message doing that.
Any suggestion or work around to do this?

If you feel the buildingSMART forum is the wrong place to discuss open source IFC tools, you may try https://community.osarch.org/ or the https://github.com/IfcOpenShell/IfcOpenShell issue tracker.

It is possible to do what you’re asking, but you will need to make a call on how to handle the mapping from IFC4 to IFC2X3. Depending on what the entities are, these mappings could be easy, or really hard. To date, there has not yet been a mapping made for this in a computer interpreted format. You will not be able to use the add() function, as you are going between schemas.

This can be a task depending on how many entities and of what type you want to merge. Could you elaborate? I’ve started working on some of these (IfcClassification related entities, and IfcPerson, etc) in the BlenderBIM Add-on, so you may take some inspiration from there.

If there is a lot, one approach might be to convert the entire file to IFC2X3 by simply changing the schema identifier, and then loading it into IfcOpenShell - any errors will be highlighted and those can be fixed quite rapidly even with a text editor. Then, you have two versions of your file, an IFC4 and IFC2X3. You can then use the add() function to add entities from one to any other file easily.

I have IfcTransportElement and IfcDiscreteAccessory entities to be merged into model.
I will try that changing identifier solution that you proposed and check if this will do it in this case!
Thanks

Geometry Gym has developed functionality to upgrade/downgrade IFC files (noting downgrade will use best possible representation where possible, such as a parametric alignment curve might be approximated as a polycurve).

If you’d like to test this, please send me a direct message. Changing the schema identifier will require lots of manual intervention on a significant file. Maybe that’s ok if you need to do it once, but if it needs to be repeated isn’t a practical solution in my opinion.

Cheers,

Jon

1 Like