ifcopenshell.api

High level IFC authoring and editing functions

Authoring, editing, and deleting IFC data requires a detailed understanding of the rules of the IFC schema. This API module provides simple to use authoring functions that hide this complexity from you. Things like managing differences between IFC versions, tracking owernship changes, or cleaning up after orphaned relationships are all handled automatically.

Subpackages

Package Contents

ifcopenshell.api.add_post_listener(usecase_path: str, name: str, callback: Callable[[str, ifcopenshell.file, dict], None]) None

Add a post listener

Parameters:
  • usecase_path – string, ifcopenshell api use case path

  • name – string, name of listener

  • callback – callback function with 3 arguments: usecase_path, ifc_file, settings

ifcopenshell.api.add_pre_listener(usecase_path: str, name: str, callback: Callable[[str, ifcopenshell.file, dict], None]) None

Add a pre listener

Parameters:
  • usecase_path – string, ifcopenshell api use case path

  • name – string, name of listener

  • callback – callback function with 3 arguments: usecase_path, ifc_file, settings

ifcopenshell.api.batching_argument_deprecation(usecase_path: str, settings: dict, prev_argument: str, new_argument: str, replace_usecase: str | None = None) tuple[str, dict]
ifcopenshell.api.extract_docs(module, usecase)
ifcopenshell.api.remove_all_listeners()
ifcopenshell.api.remove_post_listener(usecase_path: str, name: str, callback: Callable[[str, ifcopenshell.file, dict], None]) None

Remove a post listener

Parameters:
  • usecase_path – string, ifcopenshell api use case path

  • name – string, name of listener

  • callback – callback function with 3 arguments: usecase_path, ifc_file, settings

ifcopenshell.api.remove_pre_listener(usecase_path: str, name: str, callback: Callable[[str, ifcopenshell.file, dict], None]) None

Remove a pre listener

Parameters:
  • usecase_path – string, ifcopenshell api use case path

  • name – string, name of listener

  • callback – callback function with 3 arguments: usecase_path, ifc_file, settings

ifcopenshell.api.run(usecase_path: str, ifc_file: ifcopenshell.file | None = None, should_run_listeners: bool = True, **settings: Any) Any
ifcopenshell.api.wrap_usecase(usecase_path, usecase)

Wraps an API function in pre/post listeners.

ifcopenshell.api.ARGUMENTS_DEPRECATION
ifcopenshell.api.CACHED_USECASES: dict[str, Callable]
ifcopenshell.api.CACHED_USECASE_CLASSES: dict[str, Callable]
ifcopenshell.api.module_name
ifcopenshell.api.post_listeners: dict[str, dict]
ifcopenshell.api.pre_listeners: dict[str, dict]