Source code for viiapackage.strengthening.l5.l5n

### ===================================================================================================================
###   L5-N strengthening measure
### ===================================================================================================================
# Copyright ©VIIA 2024

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

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

# References for functions and classes in the rhdhv_fem package
from rhdhv_fem.fem_math import fem_point_in_surface, fem_coplanar_surface_intersection
from rhdhv_fem.shapes import Wall, MainSurfaceReinforcement
from rhdhv_fem.fem_shapes import fem_connect_shape

# References for functions and classes in the viiaPackage
if TYPE_CHECKING:
    from viiapackage.viiaStatus import ViiaProject
from viiapackage.strengthening.helper_functions import viia_check_shape_argument, viia_check_measure_in_gmc, \
    viia_add_strengthening_shape
from viiapackage.shape_operations import viia_get_wall_horizontal_direction


### ===================================================================================================================
###   2. Function to create L5-N strengthening measures
### ===================================================================================================================

[docs]def viia_l5n(project: ViiaProject, wall: Wall, points: Optional[List[List[float]]] = None, keep_openings: bool = True) \ -> Tuple[Wall, MainSurfaceReinforcement]: """ Creates an L5N-measure (Reinforced concrete wall addition) for a selected wall or specified contour. Adds a concrete wall of 150mm, C20/25 and applies a grid reinforcement of 2x2R12-150. Input: - project (obj): VIIA project object containing collections of fem objects and project variables. - wall (obj): Object reference of the wall that has to be strengthened. - points (list, optional): Custom points for the contour, if specified applies the measure to the given contour. If None, it will be applied on the whole wall. - keep_openings (bool): Boolean in case the user wants to keep the openings. Default is True. Output: - The strengthening measure is added to the wall. Newly created walls and reinforcements are returned in a list. For example: .. code-block:: python project.viia_l5n(wall, [[2.3, 7.4, 0.0], [2.3, 7.4, 2.0], [0.0, 7.4, 2.7], [0.0, 7.4, 0.0]]) This example will apply the L5-N measure with a concrete wall and grid reinforcement to a portion of the wall given by the points. """ # Check if measure is in GMC measure_type = 'L5-N' measure_sub_type = f"{measure_type}-1" viia_check_measure_in_gmc(project=project, measure_sub_type=measure_sub_type) # Validate wall argument wall = viia_check_shape_argument(project, wall, 'viia_l5n') if not isinstance(wall, Wall): raise TypeError(f"ERROR: The provided wall is not of type Wall, Provided was: {wall}.") if points is None: points = wall.contour.get_points() else: # Validate that provided points are part of the wall's contour for point in points: if not fem_point_in_surface(point=point, surface=wall.contour.get_points()): raise ValueError(f"ERROR: The following points are not part of the wall's contour: {point}") # Check if openings are in the contour provided if wall.openings and keep_openings: for opening in wall.openings: if fem_coplanar_surface_intersection(surface1=points, surface2=opening.get_points()) is not None: raise ValueError( f"ERROR: The contour of the measure and the opening {opening.get_points()} are " f"overlapping.") # Materials and geometry to be used for strengthening measure material_name = project.project_specific['strengthening_measures']['L5-N']['material'] reinforcement_material_name = project.project_specific['strengthening_measures']['L5-N']['reinforcement_material'] thickness = project.project_specific['strengthening_measures']['L5-N']['thickness'] # Create wall new_wall = project.viia_create_wall( name=wall.layer, points=[points], material=material_name, geometry=str(int(thickness * 1000))) new_wall.name = new_wall.name.replace('WANDEN', 'WANDEN-L5N') viia_add_strengthening_shape(shape=wall, strengthening_shape=new_wall) # Connect shapes fem_connect_shape(shape=new_wall, shapes_list=wall.get_connecting_shapes() + [wall]) # Create reinforcement new_reinforcement = project.viia_create_main_surface_reinforcement( name=wall.layer, points=[points], material=reinforcement_material_name, geometry='L5N-WAPENING-2R12_150x2R12_150', host_members=[new_wall], element_x_axis=viia_get_wall_horizontal_direction(wall=wall).vector) new_reinforcement.name = \ new_reinforcement.name.replace('L5N-WAPENING-2R12_150x2R12_150-', '').replace('WAPENING', 'WAPENING-L5N') viia_add_strengthening_shape(shape=wall, strengthening_shape=new_reinforcement) # Set openings if applicable if keep_openings: new_wall.openings = wall.openings new_reinforcement.openings = wall.openings # Notifications for user project.write_log( f"L5-N measure applied on wall {wall.name}.\nConcrete wall created: {new_wall.name}\n" f"Reinforcement created: {new_reinforcement.name}.") # Set the data for strengthening in attribute of wall wall.add_meta_data({'strengthening': measure_sub_type}) return new_wall, new_reinforcement
### =================================================================================================================== ### 3. End of script ### ===================================================================================================================