[How to] Create entity with ifcopenshell
I know there is a way to create an entity using:
file = ifcopenshell.open('/path/to/your/file.ifc')
obj = file.create_entity(name, **kwargs)
Is there another way to create this object without an ifc file that already exists?
That is, automatically create a class with IFC attributes that can become a super class of another python class.
pseudo-code:
entity = ifcopenshell.create_entity(name)
class MyClass(entity):
...
I looked through the documentation and codes on GitHub, but I couldn't find anything that could guide me.
I appreciate any help.
Thanks
Tagged:
Comments
I don't think there's a direct way to create an IFC from scratch, but you can of course create a template yourself, like in this example (2x3, but can easily be adapted to produce valid IFC4 files): http://academy.ifcopenshell.org/creating-a-simple-wall-with-property-set-and-quantity-information/
@anders In this example, a temporary file is created.
More reading: https://wiki.osarch.org/index.php?title=IfcOpenShell_code_examples
Ok, it works!

Thank you very much.