ifcpatch.recipes.ExtractElements

Module Contents

class ifcpatch.recipes.ExtractElements.Patcher(file: ifcopenshell.file, logger: logging.Logger, query: str = 'IfcWall', assume_asset_uniqueness_by_name: bool = True)

Extract certain elements into a new model

Extract a subset of elements from an existing IFC data set and save it to a new IFC file. For example, you might want to extract only the walls in a model and save it as a new model.

Parameters:
  • query – A query to select the subset of IFC elements.

  • assume_asset_uniqueness_by_name – Avoid adding assets (profiles, materials, styles) with the same name multiple times. Which helps in avoiding duplicated assets. —– Note that it assumes different project assets use different names (you can run IFC Assets Validation to confirm). If they’re not and this option is enabled, it may lead to confusing results (mixed up profiles, materials, styles). So either need to ensure assets naming is unique or disable this option.

Example:

# Extract all walls
ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "ExtractElements", "arguments": ["IfcWall"]})

# Extract all slabs
ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "ExtractElements", "arguments": ["IfcSlab"]})

# Extract all walls and slabs
ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "ExtractElements", "arguments": ["IfcWall, IfcSlab"]})
add_decomposition_parents(element: ifcopenshell.entity_instance, new_element: ifcopenshell.entity_instance) None

element is IfcObjectDefinition

add_element(element: ifcopenshell.entity_instance) None
add_spatial_structures(element: ifcopenshell.entity_instance, new_element: ifcopenshell.entity_instance) None

element is IfcElement

append_asset(element: ifcopenshell.entity_instance) ifcopenshell.entity_instance | None
create_spatial_tree() None
patch()
assume_asset_uniqueness_by_name = True
file
logger
query = 'IfcWall'