Source code for viiapackage.results.make_pictures

### ===================================================================================================================
###   VIIA make pictures
### ===================================================================================================================
# Copyright ©VIIA 2024

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

# General imports
from __future__ import annotations
from typing import TYPE_CHECKING

# References for functions and classes in the rhdhv_fem package

# References for functions and classes in the viiaPackage
if TYPE_CHECKING:
    from viiapackage.viiaStatus import ViiaProject


### ===================================================================================================================
###   2. Function to create pictures
### ===================================================================================================================

[docs]def viia_make_picture_strengthening_measures(project: ViiaProject, name: str, picture_type: str = 'Model'): """ Function to create a picture of the specified view for strengthening measures. The picture 'BUILDING' of model pictures is created by default. If this is not present a (random) picture from the model picture dictionary is selected to be created. Input: - project (obj): Project object containing collections and of fem objects and project variables. - view_name (str): Name of the view of which a picture is created. - picture_type (str): Type of picture to be created. Can be 'Model' or 'Result'. Default value 'Model'. Output: - Picture is created from view. """ for view_object in project.collections.views: if view_object.name == name: try: view_object.show_view(picture_type, picture_name='BUILDING') view_object.save_picture('BUILDING') except KeyError: pictures = view_object.pictureDict['Model'].keys() view_object.show_view(picture_type, pictureName=pictures[0]) view_object.save_picture(pictures[0])
[docs]def viia_show_picture( project: ViiaProject, view_name: str, picture_type: str, picture_name: str, reinforcement: bool = True): """ This function can be used to check a specific picture. It will show the picture on screen. Input: - project (obj): Project object containing collections and of fem objects and project variables. - view_name (str): Name of the view to be presented on screen. - picture_type (str): Type of picture, can be 'Model' or 'Results'. - picture_name (str): Name of the picture. - reinforcement (bool): Default value is 'True', reinforcements will be shown (if any exist in the picture). Output - Picture is created on screen in DIANA. """ check_bool = False for view in project.collections.views: if view.name == view_name: view.show_view(picture_type, picture_name, reinforcement, False) check_bool = True if not check_bool: project.write_log("ERROR: view name not recognised.")
### =================================================================================================================== ### 3. End of script ### ===================================================================================================================