### ===================================================================================================================
### FUNTION: Collect information for the foundation
### ===================================================================================================================
# Copyright ©VIIA 2024
### ===================================================================================================================
### 1. Import modules
### ===================================================================================================================
# General imports
from __future__ import annotations
from typing import TYPE_CHECKING
# References for functions and classes in the viiaPackage
if TYPE_CHECKING:
from viiapackage.viiaStatus import ViiaProject
### ===================================================================================================================
### 2. Function get_foundation_info
### ===================================================================================================================
[docs]def get_foundation_info(project: ViiaProject) -> dict:
"""
This function will generate dictionary keys for foundation information that can later be used as jinja tags for
templating.
Input:
- project (obj): VIIA project object containing collections of fem objects and project variables.
Output
- Returns dictionary of jinja tags assigned to corresponding info.
"""
data_colection = {}
# filter unique
def filt(d):
return sorted([dict(y) for y in set(tuple(x.items()) for x in d)],
key=lambda k: (k['name'], k['thickness'], k.get('eq_thickness', ""), k['material']))
all_layers = project.viia_get_layers()
if all_layers and all_layers[0].name == 'F':
f_layer = all_layers[0]
# check foundation fstrips
fstrip_col = []
for strip in f_layer.fstrips:
strip_geometry = strip.geometry.name.split('-')
mat_name = strip.material.name
if 'MW' in strip.material.name:
mat_name = 'LIN-MW-FUND'
name = 'Foundation strip masonry'
elif 'BETON' in strip.material.name:
name = 'Foundation strip concrete'
else:
name = "UNDEFINED (SPECIFY MANUALY)"
fstrip_col.append({'name': str(name), 'thickness': str(
strip_geometry[1]), 'material': str(mat_name)})
if fstrip_col:
data_colection['strips'] = filt(fstrip_col)
# check foundation walls
# Obtaining the material and thickness properties of all foundation walls including stepped walls
wall_col = []
for wall in f_layer.walls:
wall_geometry = wall.geometry.name.split('-')
wall_geometry = wall_geometry[1]
wall_geometry = wall_geometry.split('.')
material = wall.material.name
if 'DENSIT' in material:
t1 = 'stepped'
t2 = str(wall_geometry[0])
else:
t1 = str(wall_geometry[0])
t2 = 'N/A'
if 'MW-KZS>1960' in material:
material_final = 'MW_KZS>1960'
name = 'Masonry calcium silicate'
elif 'MW-KZS>1985' in material:
material_final = 'MW_KZS>1985'
name = 'Masonry calcium silicate'
elif 'MW-KLEI>1945' in material:
material_final = 'MW_Klei>1945'
name = 'Masonry clay'
elif 'MW-KLEI<1945' in material:
material_final = 'MW_Klei<1945'
name = 'Masonry clay'
elif 'MW-PORISO' in material:
material_final = 'MW_PORISO'
name = 'Masonry poriso'
elif 'BETON' in material:
material_final = 'BETON'
name = 'Concrete'
else:
material_final = 'Other'
name = 'Other'
wall_col.append({'name': name, 'thickness': t1,
'eq_thickness': t2, 'material': material_final})
if wall_col:
data_colection['walls'] = filt(wall_col)
# check foundation piles/beams
foundation_beam_list = []
# find funderingsbalken
for beam in f_layer.beams:
thickness = beam.geometry.name.split('-')[1].split('x')[1]
if 'LIN' in beam.material.name:
if 'KZS' in beam.material.name:
material = 'Linear Calcium silicate masonry'
elif 'BETON' in beam.material.name:
material = 'Linear elastic concrete'
elif 'KLEI' in beam.material.name:
material = 'Linear clay masonry'
elif 'STAAL' in beam.material.name:
material = 'Linear elastic steel'
else:
material = 'Other'
else:
material = 'Other'
name = "Foundation beam"
foundation_beam_list.append(
{'name': name, 'thickness': thickness, 'material': material})
if foundation_beam_list:
data_colection['beams'] = filt(foundation_beam_list)
return {'foundation': data_colection}
### ===================================================================================================================
### 3. End of script
### ===================================================================================================================