### ===================================================================================================================
### Create fixedbase shallow foundations
### ===================================================================================================================
# Copyright ©VIIA 2024
### ===================================================================================================================
### 1. Import modules
### ===================================================================================================================
# General imports
from __future__ import annotations
from typing import TYPE_CHECKING, List
# References for functions and classes in the rhdhv_fem package
from rhdhv_fem.shapes import Shapes, Surfaces, Floor, Wall, Column, Beam, Points
from rhdhv_fem.fem_math import fem_compare_coordinates
# References for functions and classes in the viiaPackage
if TYPE_CHECKING:
from viiapackage.viiaStatus import ViiaProject
### ===================================================================================================================
### 2. Helper-functions
### ===================================================================================================================
def _get_rotational_support_dof_for_shells(surface: Surfaces):
normal_vector = surface.contour.get_normal_vector()
if fem_compare_coordinates(coordinate1=normal_vector, coordinate2=[1, 0, 0]) or \
fem_compare_coordinates(coordinate1=normal_vector, coordinate2=[-1, 0, 0]):
return [0, 1, 1]
elif fem_compare_coordinates(coordinate1=normal_vector, coordinate2=[0, 1, 0]) or \
fem_compare_coordinates(coordinate1=normal_vector, coordinate2=[0, -1, 0]):
return [1, 0, 1]
elif fem_compare_coordinates(coordinate1=normal_vector, coordinate2=[0, 0, 1]) or \
fem_compare_coordinates(coordinate1=normal_vector, coordinate2=[0, 0, -1]):
return [1, 1, 0]
else:
return [1, 1, 1]
### ===================================================================================================================
### 3. Function to create shallow foundation fixedbase
### ===================================================================================================================
[docs]def viia_create_shallow_foundation_fixedbase(project: ViiaProject, supported_shapes: List[Shapes]):
"""
Function to create the fixedbase shallow foundation.
Input:
- project (obj): VIIA project object containing collections of fem objects and project variables.
- supported_shapes (list with obj): List with object references of shapes that are supported.
Output:
- Returns list of created surface supports.
"""
# Create the supportset
support_set = project.create_supportset('FixedBase')
axes = [project.create_direction(name='X'), project.create_direction(name='Y'), project.create_direction(name='Z')]
# Create supports for the provided shapes
counter = 1
created_supports = []
for shape in supported_shapes:
# Create surface supports for surface shapes
if isinstance(shape, Floor) or isinstance(shape, Wall):
created_supports.append(project.create_surfacesupport(
name=f'FixedBaseSupport-{str(counter).zfill(3)}',
support_set=support_set,
axes=axes,
degrees_of_freedom=[[1, 1, 1], _get_rotational_support_dof_for_shells(surface=shape)],
connecting_shapes=[{
'connecting_shape': shape,
'shape_geometry': shape.contour}]))
counter += 1
# First the surface-supports are counted, then the line-supports
for shape in supported_shapes:
# Create line support for beams and columns, if present
if isinstance(shape, Beam) or isinstance(shape, Column):
created_supports.append(project.create_linesupport(
name=f'FixedBaseSupport-{str(counter).zfill(3)}',
support_set=support_set,
axes=axes,
degrees_of_freedom=[[1, 1, 1], [1, 1, 1]],
connecting_shapes=[{
'connecting_shape': shape,
'shape_geometry': shape.contour}]))
counter += 1
# After surface- and line-supports the point-supports are counted
for shape in supported_shapes:
# Create point support
if isinstance(shape, Points):
created_supports.append(project.create_pointsupport(
name=f'FixedBaseSupport-{str(counter).zfill(3)}',
support_set=support_set,
axes=axes,
degrees_of_freedom=[[1, 1, 1], [1, 1, 1]],
connecting_shapes=[{
'connecting_shape': shape,
'shape_geometry': shape.contour}]))
counter += 1
return created_supports
### ===================================================================================================================
### 4. End of script
### ===================================================================================================================