Skip to main content


Showing posts from 2021

IfcOpenShell: Minimal Console Application in Python

This is a first, very basic example of a minimal console IFC application, written in Python and using the ifcopenshell library. First steps - preparation Create a file called . Let's start with importing the necessary Python libraries and provide a main function, so we can run a program from a terminal. The only thing this does right now is reading a file from the arguments and open it using ifcopenshell. There is no error catching, so you best provide it with a valid file and format. python IfcOpenHouse.ifc This is the starting point of the source code in the Python file. import sys import ifcopenshell # Our Main function def main (): ifc_file = ifcopenshell . open ( sys . argv [ 1 ]) if __name__ == "__main__" : main () Print the Spatial Hierarchy We will ask for the one and only  IfcProject , which returns a list of items, but it should actually only contain a single item. Nonetheless, we prefer to write this as such so wh