Loading geometry of large IFC models takes a lot of time.
There is a magic function in ifcopenshell : ifcopenshell.geom.iterator that takes care of the brep creation and serialisation and is super fast.
import multiprocessing
import ifcopenshell
from compas_occ.brep import BRep
from compas_ifc.model import Model
model = Model(input_ifc_model)
settings = ifcopenshell.geom.settings()
settings.set(settings.USE_PYTHON_OPENCASCADE, True)
def yield_from_iterator(it):
while True:
yield it.get()
if not it.next():
break
it = ifcopenshell.geom.iterator(settings, model.reader._file, multiprocessing.cpu_count())
it.initialize()
for serialized_element in yield_from_iterator(it):
data = serialized_element.data
geometry = BRep.from_shape(serialized_element.geometry)
Feature Request
Loading geometry of large IFC models takes a lot of time. There is a magic function in ifcopenshell :
ifcopenshell.geom.iterator
that takes care of the brep creation and serialisation and is super fast.see on this page or below a code example : https://wiki.osarch.org/index.php?title=IfcOpenShell_code_examples