### ===================================================================================================================
### FUNCTION: Get the gutter height
### ===================================================================================================================
# Copyright ©VIIA 2024
### ===================================================================================================================
### 1. Import modules
### ===================================================================================================================
# General imports
from __future__ import annotations
from typing import TYPE_CHECKING, Optional
# References for functions and classes in the viiaPackage
if TYPE_CHECKING:
from viiapackage.viiaStatus import ViiaProject
### ===================================================================================================================
### 2. Function to calculate the gutter height
### ===================================================================================================================
[docs]def viia_get_gutter_height(project: ViiaProject) -> Optional[float]:
"""
This function will calculate the gutter height that is obtained based on the z-coordinates of horizontal
floors. The gutter height is taken as the highest horizontal floor present in the fem-model.
Input
- project (obj): VIIA project object containing collections of fem objects and project variables.
Output:
- Returns the gutter height as float, in [m]. Returns None for non-NLTH analysis.
"""
gutter_height = None
if project.analysis_type == 'NLTH':
floors_z_coordinates = []
for _floor in project.collections.floors:
# Only include horizontal floors
if _floor.is_horizontal():
floors_z_coordinates.append(_floor.get_nodes()[0].coordinates[2])
if floors_z_coordinates:
gutter_height = round(max(floors_z_coordinates), 1)
return gutter_height
### ===================================================================================================================
### 3. End of script
### ===================================================================================================================