From 034df852b22cb0efa5a586c121b99fff5d1dd79b Mon Sep 17 00:00:00 2001 From: sennhvi Date: Tue, 2 Jan 2024 16:38:00 +0800 Subject: [PATCH] Update geometry_processing.rst Add an usage example of the parameter include for the Geometry Iterator --- .../geometry_processing.rst | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/ifcopenshell-python/docs/ifcopenshell-python/geometry_processing.rst b/src/ifcopenshell-python/docs/ifcopenshell-python/geometry_processing.rst index f319dabe25..6aea0c6d23 100644 --- a/src/ifcopenshell-python/docs/ifcopenshell-python/geometry_processing.rst +++ b/src/ifcopenshell-python/docs/ifcopenshell-python/geometry_processing.rst @@ -240,6 +240,30 @@ Here is a simple example in Python: if not iterator.next(): break + +The geometry iterator can process specific elements' geometry by using parameter ``include`` and ``exclude``, ``include`` and ``exclude`` cannot be specified simultaneously. Code below shows how to get specific wall's geometry (e.g. walls[1]): + +.. code-block:: python + + import ifcopenshell + import ifcopenshell.geom + import multiprocessing + import ifcopenshell.util.shape + + ifc = ifcopenshell.open('model.ifc') + walls = ifc.by_type('ifcwall') + settings = ifcopenshell.geom.settings() + iterator = ifcopenshell.geom.iterator(settings, ifc, multiprocessing.cpu_count(), include=[walls[1]]) + valid_file = iterator.initialize() + while True: + shape = iterator.get() + element = ifc.by_id(shape.id) + geometry = shape.geometry + verts = geometry.verts + print(verts) + if not iterator.next(): + break + .. note:: The iterator can only be used to process whole elements, not individual