Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for multiprocessing #6

Open
romanarust opened this issue May 5, 2023 · 0 comments
Open

Support for multiprocessing #6

romanarust opened this issue May 5, 2023 · 0 comments

Comments

@romanarust
Copy link
Member

romanarust commented May 5, 2023

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

  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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant