Source code for viiapackage.viiaGeometries

### =============================================================================================================== ###
###                                                                                                                 ###
###                                                viiaGeometries.py                                                ###
###                                                                                                                 ###
### =============================================================================================================== ###
# This module ``viiaGeometries`` contains the functions that handle the geometry properties of the shapes and
# connections. It contains available functionality to create the geometry instances, based on VIIA conventions.

# Module is based on:
# VIIA_QE_R376 Basis of Design Retrofit Advice NLTH, v11.0, d.d. 29 August 2024
# VIIA_QE_R376 Basis of Design Step-by-Step MRS, v1.0, d.d. 21 January 2022
# VIIA_QE_R1674 Uitgangspuntenrapport engineering NLPO, v1.0, d.d. 1 August 2019

# This script was based upon the Constitution For Python At VIIA
# For use by VIIA
# Copyright RHDHV

### ===================================================================================================================
###   Contents script
### ===================================================================================================================

#   1. Import modules

#   2. Function to create instance of Geometry class for VIIA

#   3. End of script

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

# General imports
from __future__ import annotations
from typing import TYPE_CHECKING

# References for functions and classes in the rhdhv_fem package
from rhdhv_fem.geometries import Geometry

# References for functions and classes in the viiaPackage
if TYPE_CHECKING:
    from viiapackage.viiaStatus import ViiaProject
from viiapackage.geometries import viia_get_geometry_group, viia_check_geometry_name, \
    viia_get_geometry_model_properties, viia_create_geometry_model


### ===================================================================================================================
###   2. Function to create instance of Geometry class for VIIA
### ===================================================================================================================

[docs]def viia_create_geometries(project: ViiaProject, geometry_name: str) -> Geometry: """ This function will collect the arguments for the creation of an object based on the name of the element geometry. The VIIA naming convention is applied in this function and sub-functions it uses. Input: - project (obj): VIIA project object containing collections of fem objects and project variables. - geometry_name(str): Name of the element geometry. Output: - Returns the object reference to the 'Geometry' object that is created based on the input arguments. """ # Check if the geometry is already present (check on name) # Reversed looping so the last added geometries are check first. There is a higher change that last added geometry # will be re-used. for geometry in reversed(project.collections.geometries): if geometry.name == geometry_name: return geometry # Get the geometry-group geometry_group = viia_get_geometry_group( geometry_name=geometry_name) # Check whether geometry name complies to VIIA convention viia_check_geometry_name( geometry_name=geometry_name, geometry_group=geometry_group) # Set geometry model and initialise the geometry properties dictionary geometry_model_properties = viia_get_geometry_model_properties( project=project, geometry_name=geometry_name, geometry_group=geometry_group) # Create geometry model geometry_model = viia_create_geometry_model( project=project, geometry_group=geometry_group, geometry_model_properties=geometry_model_properties) # Create and return the geometry object return project.create_user_defined_geometry( name=geometry_name, geometry_model=geometry_model)
### =================================================================================================================== ### 3. End of script ### ===================================================================================================================