Skip to content

BIM Controller

Building Information Modeling (BIM) workflows.

Covers the IFC ecosystem and the building-structural metadata that goes with it: IFC import/export in its supported schema versions, configuration of IFC export options (properties, project data, aggregation, element combination), and assignment of building and storey information to elements. The module to use whenever the model needs to interoperate with IFC-based BIM tooling.

convert_exchange_objects(exchange_objects: list[ElementId]) -> list[ElementId]

Converts a list of Exchange Objects to Cadwork Elements.

Parameters:

Name Type Description Default
exchange_objects list[ElementId]

A list of Exchange Object id to convert.

required

Returns:

Type Description
list[ElementId]

The list of Cadwork Element ids.

export_bcf(file_path: str) -> bool

Exports a BCF file.

Parameters:

Name Type Description Default
file_path str

The path where the BCF file will be exported.

required

Examples:

1
>>> import bim_controller as bc
1
2
3
4
>>> bcf_output_path = r"C:/exports/project_issues.bcf"
>>> success = bc.export_bcf(bcf_output_path)
>>> if success:
>>>     print("BCF file exported successfully")

Returns:

Type Description
bool

True if the export was successful, false otherwise.

export_ifc(element_id_list: list[ElementId], file_path: str) -> bool

Export IFC file.

Parameters:

Name Type Description Default
element_id_list list[ElementId]

The list of element ids.

required
file_path str

The path where the IFC file will be exported.

required

Examples:

1
2
>>> import element_controller as ec
>>> import bim_controller as bc
1
2
3
4
5
>>> selected_elements = ec.get_all_identifiable_element_ids()
>>> ifc_output_path = r"C:/exports/building_model.ifc"
>>> success = bc.export_ifc(selected_elements, ifc_output_path)
>>> if success:
>>>     print("IFC file exported successfully")

Returns:

Type Description
bool

True if the export was successful, false otherwise.

export_ifc2x3_silently(element_id_list: list[ElementId], file_path: str) -> bool

Export IFC2x3 silently.

Parameters:

Name Type Description Default
element_id_list list[ElementId]

The list of element ids.

required
file_path str

The path where the IFC file will be exported.

required

Returns:

Type Description
bool

True if the export was successful, false otherwise.

export_ifc2x3_silently_with_options(element_id_list: list[ElementId], file_path: str, options: ifc_options) -> bool

Exports IFC2x3 silently with options.

Parameters:

Name Type Description Default
element_id_list list[ElementId]

The list of element ids.

required
file_path str

The path where the IFC file will be exported.

required
options ifc_options

The export options.

required

Returns:

Type Description
bool

True if the export was successful, false otherwise.

export_ifc4_silently(element_id_list: list[ElementId], file_path: str) -> bool

Exports IFC4 silently.

Parameters:

Name Type Description Default
element_id_list list[ElementId]

The list of element ids.

required
file_path str

The path where the IFC file will be exported.

required

Returns:

Type Description
bool

True if the export was successful, false otherwise.

export_ifc4_silently_with_options(element_id_list: list[ElementId], file_path: str, options: ifc_options) -> bool

Exports IFC4 silently with options.

Parameters:

Name Type Description Default
element_id_list list[ElementId]

The list of element ids.

required
file_path str

The path where the IFC file will be exported.

required
options ifc_options

The export options.

required

Returns:

Type Description
bool

True if the export was successful, false otherwise.

get_all_buildings() -> list[str]

Get all buildings.

Returns:

Type Description
list[str]

A list of all building.

get_all_storeys(building: str) -> list[str]

Get all storeys.

Parameters:

Name Type Description Default
building str

The building name.

required

Returns:

Type Description
list[str]

A list of all storeys in the building.

get_building(element_id: ElementId) -> str

Get building name for a given element.

Parameters:

Name Type Description Default
element_id ElementId

The element id.

required

Returns:

Type Description
str

The name of the building.

get_element_id_from_base64_ifc_guid(base_64_ifc_guid: str) -> ElementId

Get element id from base64 ifc guid.

Parameters:

Name Type Description Default
base_64_ifc_guid str

The base64 IFC GUID.

required

Returns:

Type Description
ElementId

The element id corresponding to the base64 IFC GUID.

get_ifc2x3_element_type(element_id: ElementId) -> ifc_2x3_element_type

Get ifc2x3 element type.

Parameters:

Name Type Description Default
element_id ElementId

The element id.

required

Examples:

1
2
3
>>> import element_controller as ec
>>> import bim_controller as bc
>>> import cadwork # needed for ifc_2x3_element_type
1
2
3
>>> selected_elements = ec.get_all_identifiable_element_ids()
>>> element = selected_elements[0]
>>> ifc_type = bc.get_ifc2x3_element_type(element)

Returns:

Type Description
ifc_2x3_element_type

The ifc_2x3_element_type of the element.

get_ifc2x3_element_type_display_string(entity_type: ifc_2x3_element_type) -> str

Get IFC2x3 element type display string.

Parameters:

Name Type Description Default
entity_type ifc_2x3_element_type

The entity type.

required

Returns:

Type Description
str

The display string representation of the IFC2x3 element type.

get_ifc2x3_element_type_string(entity_type: ifc_2x3_element_type) -> str

Get IFC2x3 element type string.

Parameters:

Name Type Description Default
entity_type ifc_2x3_element_type

The entity type.

required

Returns:

Type Description
str

The string representation of the IFC2x3 element type.

get_ifc_base64_guid(element_id: ElementId) -> str

Get IFC base64 Guid from element id.

Parameters:

Name Type Description Default
element_id ElementId

The element id.

required

Returns:

Type Description
str

The IFC GUID in base64 string format ("28kif20KPEuBjk2m1N3ep$").

get_ifc_guid(element_id: ElementId) -> str

Get the IFC GUID of an element.

Parameters:

Name Type Description Default
element_id ElementId

The element id.

required

Examples:

1
2
>>> import element_controller as ec
>>> import bim_controller as bc
1
2
3
4
>>> selected_elements = ec.get_all_identifiable_element_ids()
>>> element = selected_elements[0]
>>> ifc_guid = bc.get_ifc_guid(element)
>>> print(f"IFC GUID: {ifc_guid}")

Returns:

Type Description
str

A string representing the IFC GUID.

get_ifc_options() -> ifc_options

Get the IfcOptions with the settings used in the document.

Returns:

Type Description
ifc_options

The IfcOptions object containing the current settings.

get_ifc_predefined_type(element_id: ElementId) -> ifc_predefined_type

Get the IfcPredefinedType of an element.

Parameters:

Name Type Description Default
element_id ElementId

The element id.

required

Returns:

Type Description
ifc_predefined_type

The IfcPredefinedType of the element.

get_storey(element_id: ElementId) -> str

Get storey name for a given element.

Parameters:

Name Type Description Default
element_id ElementId

The element id.

required

Returns:

Type Description
str

The name of the storey.

get_storey_height(building: str, storey: str) -> float

Get storey height for a given building and storey.

Parameters:

Name Type Description Default
building str

The building name.

required
storey str

The storey name.

required

Returns:

Type Description
float

The height of the storey.

import_bcf(file_path: str) -> bool

Imports a BCF file.

Parameters:

Name Type Description Default
file_path str

The path to the BCF file.

required

Examples:

1
>>> import bim_controller as bc
1
2
3
4
>>> bcf_file_path = r"C:/imports/issues.bcf"
>>> success = bc.import_bcf(bcf_file_path)
>>> if success:
>>>     print("BCF file imported successfully")

Returns:

Type Description
bool

True if the import was successful, false otherwise.

import_ifc_as_graphical_object(file_path: str) -> bool

Imports ifc as graphical object.

Parameters:

Name Type Description Default
file_path str

The path to the IFC file.

required

Examples:

1
>>> import bim_controller as bc
1
2
3
4
>>> ifc_file_path = r"C:/imports/building_model.ifc"
>>> success = bc.import_ifc_as_graphical_object(ifc_file_path)
>>> if success:
>>>     print("IFC imported as graphical object successfully")

Returns:

Type Description
bool

True if the import was successful, false otherwise.

import_ifc_return_exchange_objects(file_path: str) -> list[ElementId]

Imports an IFC File and returns the ids of the Exchange Objects.

Parameters:

Name Type Description Default
file_path str

The path to the IFC file.

required

Returns:

Type Description
list[ElementId]

The ids of the exchange objects.

set_building_and_storey(element_id_list: list[ElementId], building: str, storey: str) -> None

Set building and storey.

Parameters:

Name Type Description Default
element_id_list list[ElementId]

The list of element ids.

required
building str

The building name.

required
storey str

The storey name.

required

Examples:

1
2
>>> import element_controller as ec
>>> import bim_controller as bc
1
2
3
4
>>> selected_elements = ec.get_all_identifiable_element_ids()
>>> building_name = "Building A"
>>> storey_name = "Ground Floor"
>>> bc.set_building_and_storey(selected_elements, building_name, storey_name)

set_ifc2x3_element_type(element_id_list: list[ElementId], ifc_type: ifc_2x3_element_type) -> None

Set ifc2x3 element type.

Parameters:

Name Type Description Default
element_id_list list[ElementId]

The list of element ids.

required
ifc_type ifc_2x3_element_type

The ifc_2x3_element_type to set.

required

Examples:

1
2
3
>>> import element_controller as ec
>>> import bim_controller as bc
>>> import cadwork
1
2
3
4
>>> selected_elements = ec.get_all_identifiable_element_ids()
>>> ifc_entity_type = cadwork.ifc_2x3_element_type()
>>> ifc_entity_type.set_ifc_member()
>>> bc.set_ifc2x3_element_type(selected_elements, ifc_entity_type)

set_ifc_predefined_type(element_id_list: list[ElementId], predefined_type: ifc_predefined_type) -> None

Set a predefined type to elements. Attention, if you change the PredefinedType of the elements, you are responsible for ensuring that valid types are set.

Parameters:

Name Type Description Default
element_id_list list[ElementId]

The list of element ids.

required
predefined_type ifc_predefined_type

The predefined type to set.

required

Examples:

1
2
3
>>> import element_controller as ec
>>> import bim_controller as bc
>>> import cadwork
1
2
3
4
>>> selected_elements = ec.get_all_identifiable_element_ids()
>>> predefined_type = cadwork.ifc_predefined_type()
>>> predefined_type.set_member()
>>> bc.set_ifc_predefined_type(selected_elements, predefined_type)

set_storey_height(building: str, storey: str, height: float) -> None

Set storey height.

Parameters:

Name Type Description Default
building str

The name of the building.

required
storey str

The name of the storey.

required
height float

The height of the storey.

required

Examples:

1
>>> import bim_controller as bc
1
2
3
4
>>> building_name = "Building A"
>>> storey_name = "Ground Floor"
>>> height_millimeters = 3_500
>>> bc.set_storey_height(building_name, storey_name, height_millimeters)

update_bmt_structure_building_storey(element_id_list: list[ElementId]) -> None

This function takes the specified elements and inserts them into the BMT structure and adds them to the assigned Building and Storey.

Parameters:

Name Type Description Default
element_id_list list[ElementId]

The list of element ids to be updated in the BMT structure.

required

update_bmt_structure_created_elements(element_id_list: list[ElementId]) -> None

This function takes the specified elements and inserts them into the BMT structure and adds them to the active building and storey.

Parameters:

Name Type Description Default
element_id_list list[ElementId]

The list of element ids to be updated in the BMT structure.

required