Source code for viiapackage.supports.create_line_supports

### ===================================================================================================================
###   Create line supports for walls (not default procedure in VIIA)
### ===================================================================================================================
# Copyright ©VIIA 2024

### ===================================================================================================================
###   1. Import modules
### ===================================================================================================================

# General imports
from __future__ import annotations
from typing import TYPE_CHECKING, List, Optional
import warnings

# References for functions and classes in the rhdhv_fem package
from rhdhv_fem.shapes import Wall
from rhdhv_fem.supports import LineSupport
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. Function to add line-support underneath the wall
### ===================================================================================================================

[docs]def viia_add_linesupport_to_wall(wall: Wall) -> List[LineSupport]: """ This function applies a line-support to the horizontal bottom side of the wall. Input: - wall (obj): Object reference of wall to apply line-support on. Output: - Function creates a line-support on the bottom horizontal line of the wall shape. """ warnings.warn( "WARNING: Applying line-supports is not the default procedure and will interfere with the result handling. " "Only apply this function if you realy require it. Always discuss with your lead engineer.") # Find the horizontal lines on the contour of the wall lines = wall.contour.get_horizontal() if not lines: raise ValueError(f"ERROR: No line-support could be added to wall {wall.name}.") # Create list of z-coordinates of those lines, and select minimum z_coordinates = [] for line in lines: z_coordinates.append(line.node_start.coordinates[2]) z_min = min(z_coordinates) # Create list with the lines at bottom side of the wall bottom_lines = [] for line in lines: if fem_compare_coordinates([line.node_start.coordinates[2]], [z_min], wall.project.rounding_precision): bottom_lines.append(line) # Create the support-set support_set = wall.project.project_specific['shallow foundation']['name'] axes = [wall.project.create_direction(name='X'), wall.project.create_direction(name='Y')] # Create line-supports for list of bottom lines created_supports = [] for i, line in enumerate(bottom_lines): if len(bottom_lines) == 1: line_support_name = f"{wall.project.project_specific['shallow foundation']['name']}-W{wall.id}" else: line_support_name = f"{wall.project.project_specific['shallow foundation']['name']}-W{wall.id}-{i}" created_supports.append( wall.project.create_linesupport( name=line_support_name, support_set=support_set, axes=axes, degrees_of_freedom=wall.project.project_specific['shallow foundation']['dof'], connecting_shapes=[{'connecting_shape': wall}], spring_stiffnesses=wall.project.project_specific['shallow foundation']['spring_stiffnesses'])) # Return the created supports for the wall return created_supports
### =================================================================================================================== ### 3. Function to create line supports underneath foundation walls ### ===================================================================================================================
[docs]def viia_create_line_supports_for_foundation_walls(project: ViiaProject, walls: Optional[List[Wall]]): """ This function applies line-support to all wall elements with 'FUNDERINGSWANDEN' in name. .. note:: Applying line-supports is not the default procedure and will interfere with the result handling. Only apply this function if you realy require it. Always discuss with your lead engineer. Input: - project (obj): VIIA project object containing collections of fem objects and project variables. - walls (objs): Optional object references to wall shapes to which line supports need to be applied as well. Alternative (strings): Names of the walls to which line-supports need to be applied. Output: - Line-support is created at the bottom side of the foundation walls ('FUNDERINGSWANDEN' in name) and additional given walls. """ warnings.warn( "WARNING: Applying line-supports is not the default procedure and will interfere with the result handling. " "Only apply this function if you realy require it. Always discuss with your lead engineer.") # Start process project.write_log("## Shallow foundations on walls function started, adding line supports ##") # Loop over all walls and check if 'FUNDERINGSWANDEN' is in name or that the wall is given as argument counter = 0 for wall in project.collections.walls: if 'FUNDERINGSWANDEN' in wall.name or wall.name in walls: viia_add_linesupport_to_wall(wall) counter += 1 # End of process project.write_log(f"## Shallow foundations on walls function finished, {str(counter)} line-supports created ##")
### =================================================================================================================== ### 4. End of script ### ===================================================================================================================