How can I create a rectangle shape within the IFC schema by using C# or Python?

Just curious. Is there a way to create a rectangle shape within the IFC schma by using C# or Python?

Absolutely, you can use the free and open-source IfcOpenShell library for Python. It works cross-platform. It’s also very easy, and is only three lines of code:

import ifcopenshell
f = ifcopenshell.file()
f.createIfcRectangleProfileDef('AREA', None, None, 2, 4)

Actually assigning that rectangle profile to a shape representation and finally to an IFC object is a little bit more involved, but if you need help, we can help guide you with that :slight_smile:

If you need more complex geometry easily generated, you can use BlenderBIM, a free and open source software that uses IfcOpenShell and can generate very complex shapes. It is open-source, so you can see how BlenderBIM generates and manipulates geometry too! All in Python.

1 Like

Thanks Moult. Will definitely check out.