Source code for viiapackage.pictures.result_pictures.helper_functions.setup_model_and_analysis

### ===================================================================================================================
###  FUNCTION: Setup model and analysis for result pictures
### ===================================================================================================================
# Copyright ©VIIA 2024

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

# General imports
from pathlib import Path

# References for functions and classes in the rhdhv_fem package
from rhdhv_fem.analyses import Analysis
from rhdhv_fem.diana_utils import DianaConfig, fem_check_box_size


### ===================================================================================================================
###   2. Function to set up the project model and analysis for the result picture
### ===================================================================================================================

[docs]def viia_set_model_and_analysis_diana(project: 'ViiaProject', analysis: Analysis): """ Function used to import the dat-file of the project and setup the analysis of specified in DIANA. Input: - project (obj): VIIA project object containing collections of fem objects and project variables. - analysis (obj): Object reference of the analysis of which results are to plot. - datfile (Path): Location of the dat-file of the model in DIANA. Output: - No output. Model is set up ready for result picture in DIANA. """ file = Path(project.workfolder_location) / project.name box_size = fem_check_box_size(project=project, box_size=project.diana_settings.box_size) project.rhdhvDIANA.model_created = True dia_project = project.rhdhvDIANA.newProject(file.as_posix(), box_size) if not project.rhdhvDIANA.debug and dia_project != file.as_posix() + '.dpf': raise FileNotFoundError( "ERROR: Unable to create the new diana project file. Most likely the license couldn't be found.") project.rhdhvDIANA.setModelAnalysisAspects(['STRUCT']) project.rhdhvDIANA.setModelDimension('3D') project.rhdhvDIANA.setDefaultMeshOrder(project.meshorder.upper()) project.rhdhvDIANA.setDefaultMesherType(DianaConfig.meshtype_dict[project.meshtype]) project.rhdhvDIANA.importModel(project.diana_settings.latest_dat_file.as_posix()) project.rhdhvDIANA.addAnalysis(f"{analysis.name}")
### =================================================================================================================== ### 3. End of script ### ===================================================================================================================