mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-16 13:46:54 +00:00
Update geometry_processing.rst
Add an usage example of the parameter include for the Geometry Iterator
This commit is contained in:
@@ -240,6 +240,30 @@ Here is a simple example in Python:
|
|||||||
if not iterator.next():
|
if not iterator.next():
|
||||||
break
|
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::
|
.. note::
|
||||||
|
|
||||||
The iterator can only be used to process whole elements, not individual
|
The iterator can only be used to process whole elements, not individual
|
||||||
|
|||||||
Reference in New Issue
Block a user