[IfcOpenShell-Python] Method to close a file is missing?

When opening a ifc file in Python, i didn't find a method to close it.
This is the method to open a ifc file written hear https://wiki.osarch.org/index.php?title=IfcOpenShell_code_examples

import ifcopenshell
file = ifcopenshell.open('/path/to/your/file.ifc')

However there is no method to close the file?

And should we generally open files with the "with" statement ?


  • @Martin156131 I don't think you need to worry about that. When you run ifcopenshell.open(), what you get back is the base class for handling ifc files. There's nothing you need to close, and there's not really a need for 'with' in this case.

  • AFAIK it's not keeping the file open, it's reading its content, recreating it in memory, and then closing the file, all in ifcopenshell.open. When you save the blend file down the line the ifc file is overwritten with new information.

Sign In or Register to comment.