This commit is contained in:
Andrej730
2025-03-11 13:07:54 +05:00
parent c1bc36ab86
commit ed0b1c5009
11 changed files with 253 additions and 173 deletions
@@ -21,6 +21,7 @@ import json
import ifcopenshell
import ifcopenshell.util.element
import ifcopenshell.util.classification
from typing import Union
cwd = os.path.dirname(os.path.realpath(__file__))
@@ -31,7 +32,7 @@ with open(os.path.join(cwd, "ifc4_to_brick.json")) as f:
ifc4_to_brick_map = json.load(f)
def get_brick_type(element):
def get_brick_type(element: ifcopenshell.entity_instance) -> Union[str, None]:
references = ifcopenshell.util.classification.get_references(element)
for reference in references:
system = ifcopenshell.util.classification.get_classification(reference)
@@ -61,10 +62,10 @@ def get_brick_type(element):
return f"https://brickschema.org/schema/Brick#System"
def get_element_feeds(element):
def get_element_feeds(element: ifcopenshell.entity_instance) -> set[ifcopenshell.entity_instance]:
current_element = element
processed_elements = set()
downstream_equipment = set()
downstream_equipment: set[ifcopenshell.entity_instance] = set()
# A queue is a list of branches. A branch is a list of elements in
# sequence, each one connecting to another element. An element in a