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.

If you’re new to IFC authoring, start by looking at the following APIs:

Also see how to create a simple model from scratch.

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.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.renamed_arguments_deprecation(usecase_path: str, settings: dict, arguments_remapped: dict[str, str]) tuple[str, dict]
ifcopenshell.api.run(usecase_path: str, ifc_file: ifcopenshell.file | None = None, should_run_listeners: bool = True, **settings: Any) Any
ifcopenshell.api.serialise_settings(settings)
ifcopenshell.api.wrap_usecase(usecase_path, usecase)

Wraps an API function in pre/post listeners.

ifcopenshell.api.wrap_usecases(path, name)

This developer feature wraps an API module’s usecases with listeners.

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