pyvista_cad.read_ifc

On this page

pyvista_cad.read_ifc#

read_ifc(path, /, *, include=None, use_world_coords=True, **_)[source]#

Read an IFC file as a pyvista.MultiBlock.

Each IFC product with renderable geometry becomes one block. Block names follow <element name>_<index> so they are unique even when names collide. Per-element cad.guid, cad.ifc_type, cad.label, and cad.material (with optional cad.color) field data are attached.

Parameters:
pathstr or os.PathLike

Path to a .ifc file (IFC2X3 / IFC4 / IFC4X3).

includetuple of str or None, default: None

Restrict to specific IFC classes, e.g. ('IfcWall', 'IfcSlab'). When None, every product with geometry is exported.

use_world_coordsbool, default: True

Apply each element’s local placement so the result is in world coordinates.

**_Any

Forward-compat keyword arguments are accepted and ignored.

Returns:
pyvista.MultiBlock

Tessellated geometry, one block per element.

Parameters:
Return type:

MultiBlock

Examples

Read the bundled small-building IFC fixture:

>>> import pyvista_cad
>>> from pyvista_cad import read_ifc
>>> mb = read_ifc(pyvista_cad.examples.small_building_ifc_path())
>>> type(mb).__name__
'MultiBlock'
>>> str(mb.field_data['cad.source_format'][0])
'ifc'