BuildingInformationModel.extract
- BuildingInformationModel.extract(elements, path=None, load_geometries=True, export_materials=True, export_properties=True, export_styles=True, export_types=True, export_relationships=True)
Extract elements into a new standalone BuildingInformationModel.
Collects the given elements and all their descendants, exports them to a new IFC file preserving all linked information (geometry, placements, properties, materials, styles, type definitions), then loads the result as a new model.
Ancestor spatial containers (IfcProject, IfcSite, IfcBuilding, IfcBuildingStorey) are included automatically so the extracted file is a valid, self-contained IFC file.
Non-spatial IFC relationships (connections, space boundaries) are preserved when both endpoints of the relationship are in the exported set. This ensures the interaction graph is maintained in the extracted model.
- Parameters:
- elementsGenericElement or list[GenericElement]
Element(s) to extract. All descendants are included automatically.
- pathstr, optional
If given, the extracted IFC file is saved to this path. If None, a temporary file is used and cleaned up after loading.
- load_geometriesbool, optional
Whether to pre-load geometries in the extracted model. Default True.
- export_materialsbool, optional
Whether to export material associations. Default True.
- export_propertiesbool, optional
Whether to export property sets. Default True.
- export_stylesbool, optional
Whether to export visual styles. Default True.
- export_typesbool, optional
Whether to export type definitions (IfcRelDefinesByType). Default True.
- export_relationshipsbool, optional
Whether to export non-spatial relationships (connections, space boundaries) where both endpoints are in the exported set. Default True.
- Returns:
- BuildingInformationModel
A new standalone model containing only the extracted elements.