Module viiaGeneral

VIIA general contains general functions that are needed in running the process. They do not affect the model itself, but supports the modelling process.

General model setup functions

viiapackage.viiaGeneral.viia_create_model(project: ViiaProject, software: str = 'VIIA')[source]

Function selects the program to which the model must be exported or created in. For VIIA only SCIA and DIANA are used, but other programs can be selected.

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

  • software (str): Software in which the model is created. Default setting for VIIA is ‘diana’ for ‘NLPO’ or ‘NLTH’ and ‘scia’ for ‘MRS’ analysis type. In case the object needs to be created in ABAQUS software provide ‘abaqus’ as input (will only work for NLTH analysis objects).

Output:
  • If software is ‘abaqus’: The model is created in ABAQUS. But only if the analysis type is NLTH.

  • If software is ‘diana’: The model is created in DIANA, when running in DIANA.

  • If software is ‘scia’: The xlm with model data is created and can be loaded in SCIA.

viiapackage.viiaGeneral.viia_help()[source]

Function will open browser for additional information on viiaPackage.

Input:
  • No input required.

Output:
  • Default browser is opened and directed to the index page of the viiaPackage documentation.

viiapackage.viiaGeneral.viia_print_execution_time(project: ViiaProject)[source]

Function prints and logs the execution time of the MainScript (to the point where the functions is set).

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

Output:
  • Prints the execution time and logs it.

Visualisation of PY-memory

viiapackage.viiaGeneral.viia_create_plots(project: ViiaProject, collections: Optional[Union[List[Shapes], List[str]]] = None, layers: Optional[Union[List[Layer], List[str]]] = None, add_collections: Optional[Union[List[Shapes], List[str]]] = None, alpha: float = 0.7, add_alpha: float = 0.7, viewpoint: Optional[List[float]] = None, show: bool = True, title: Optional[str] = None, save_folder: Optional[Path] = None, file_name: Optional[str] = None, use_plotly: bool = False, save_plot: bool = True, return_figure: bool = False, legend_group_dict: Dict[Shapes, str] = None) Union[Optional[Path], Tuple[Optional[Path], Any]][source]

This function enables to create a plot of the shapes stored within the project in the Python database as collections with an interactive GUI from Matplotlib.

Input:
  • project (obj): VIIA Project object containing collections of VIIA objects and project variables.

  • collections (list of obj): The list of shapes to be plotted. The list must contain references to VIIA objects in Shapes class. Cannot be used when layers are also given. Alternative 1 (list of str): List of string representations of shape collections to be plotted. If layers are defined, then only shapes of the specified collections on the specified layers are plotted. Default value is None, in which case all shapes are plotted.

  • layers (list of obj): The list of layer objects for which shapes need to be plotted. Alternative (list of str): list of layer names, the shapes of which need to be plotted Default value is None, in which case all layers are plotted.

  • add_collections (list of obj): The list of additional shapes to be plotted besides those plotted in the specified layers. The list must contain references to VIIA objects in Shapes class. This should be used when specific layers are given, and the additional shapes should be shapes that are not in the specified layers or if collection is passed as a list of strings, and you want plot some additional shapes. Alternative 1 (list of str): List of string representations of additional shape collections to be plotted besides those plotted in the specified layers. Default value is None, in which case no additional shapes are plotted.

  • alpha (float): Number from 0 to 1 that determines the transparency of the shapes that are plotted. Default value is 0.7.

  • add_alpha (float): Number from 0 to 1 that determines the transparency of the additional shapes that are plotted that are defined by ‘add_collections’. Default value is 0.7.

  • viewpoint (list of float): List of two floats that determine the angle the plot is viewn from when first created. The first entry is the elevation angle in degrees, and the second entry is the azimuth angle in degrees. For a topview use [90, 0].

  • show (bool): This is used to show the plot. By default, this is set to True. If set to False, the GUI with the plot will not appear.

  • title (str): Title to be used in picture. Default value is None, in which case the title is set based on the shape types and layer.

  • save_folder (str): Path to folder where the pictures should be saved. Default value is None, in which case the current workfolder will be used.

  • file_name (str): Name of the file to save the plot as.

  • use_plotly (bool): Indicates if plotly should be used instead of matplotlib. Default is False.

  • save_plot (bool): Indicates if the plot should be saved. Default is True.

  • return_figure (bool): Indicates if next to the path of the save file also the picture object of matplotlib or plotly should be returned. Default is False.

  • legend_group_dict (dict): A dictionary with shape and the legend group that should be applied for it. This is only available for plotlty plots. Default is None.

Output:
  • The requested shapes are plotted in an interactive GUI.

  • The path to where the saved file is returned if save_plot is True.

viiapackage.viiaGeneral.viia_plot_building_cross_section(project: ViiaProject, plotting_plane: str = 'xz', grid: Optional[Union[Grid, int, str]] = None, show: bool = False, title: Optional[str] = None, save_folder: Optional[Path] = None, file_name: Optional[str] = None)[source]

This function plots all shapes and the given grid from the specified plane.

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

  • plotting_plane (str): Optional argument to specify a plane for the plot. Two options are available: ‘xz’ and ‘yz’.

  • grid (Grid, int, str): Optional object, id or name of the grid to use. By default, the first grid in the collection is used.

  • show (bool): True if plots will be shown, otherwise they are just saved in the given folder. Default value is True.

  • title (str): Title to be used in picture. Default value is None, in which case the title is set based on the plotting plane.

  • save_folder (Path): Path to folder to save plots in.

  • file_name (str): Name of the file to save the plot as.

Output:
  • The specified cross-section is plotted and shown if desired.

  • The picture is saved in the specified or default location.

viiapackage.viiaGeneral.viia_plot_grid(project: ViiaProject, plot_levels: bool = True, levels_plotting_plane: Optional[str] = None, show: bool = False, save_folder: Optional[Path] = None)[source]

This function plots all grids in the collections of the project. Optionally the levels defined in the grids are plotted. The plotting methods for the fem package are used to create the plots.

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

  • plot_levels (bool): Optional boolean to choose whether the levels are plotted. Default is True.

  • levels_plotting_plane (str): Optional string (choose ‘xz’ or ‘yz’) to set the plotting plane for the levels.

  • show (bool): Optional boolean to choose whether to show the plots. Default value is False, not showing.

  • save_folder (Path): Path location to save the plots. If no path is specified, the current workfolder is used.

Output:
  • Plot of all the grids in the project is saved to the requested folder.

  • Optional plot of the levels is saved to the requested folder.

viiapackage.viiaGeneral.viia_plot_layers(project: ViiaProject, layers: Optional[Union[List[str], List[Layer], str]] = None, view: str = '2D', shape_types: Optional[Union[str, List[str]]] = None, grid: Optional[Union[Grid, int, str]] = None, shape_types_together: Optional[bool] = None, thickness_scale: float = 1, show: bool = True, show_dimensions: bool = True, save_folder: Optional[Path] = None, file_name: Optional[str] = None)[source]

This function plots either all or the specified layers and all or the specified shape types.

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

  • layers (list of obj): List of layer objects to plot. Default value is None, in which case all the layers are plotted. Alternative 1 (list of obj): List of strings representing the layers to plot. Alternative 2 (str): String representing one layer to plot.

  • view (str): Optional string to indicate whether layer(s) should be plotted in 2D or 3D. Default value is ‘2D’.

  • shape_types (str): String indicating the shape type to plot. Default value is None, in which case all walls, floors, roofs, beams and columns are plotted

  • grid (Grid, int, str): Optional object, id or name of the grid to use. By default, the first grid in the collection is used.

  • shape_types_together (bool): If True, all shape_types defined are plotted together in the same plot. If False, a plot is generated separately for each shape type.

  • thickness_scale (float): A scaling factor for the thickness of the plotted walls. Default value is 2.

  • show (bool): True if plots will be shown, otherwise they are just saved in the given folder. Default value is True.

  • show_dimensions (bool): True if dimensions should be plotted. Default value is True.

  • save_folder (Path): Path to folder to save plots in. If not provided, plots are saved in sub folder ‘Modelling Pictures’ in working folder.

  • file_name (str): Name of the file to save the plot as. If not provided a name will be generated based on layer name and shape-types.

Output:
  • All specified or default layers and shapes are plotted and shown if desired.

  • All plots made are saved in the specified or default folder.

Functions for handling coordinates

viiapackage.viiaGeneral._viia_find_floor_mesh_nodes(project: ViiaProject) Dict[source]

This function finds all the nodes within the floors of the model.

Warning

The model must be meshed, the dat-file should have been created and the dat-file should have been read and converted to DATDict, the dictionary containing the information in the dat-file.

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

Output:
  • Returns a dictionary with storey numbers (N0, N1, etc.) as keys with lists of corresponding floor node numbers of that storey as values.

viiapackage.viiaGeneral._viia_find_foundation_nodes_under_wall(project: ViiaProject, node_fstrip_list: List[int], wall_name: str) Union[List[int], None][source]

This function will look for the closest node of the foundation strips in the mesh to the point in the bottom line of the given wall. The z-coordinate of the bottom line is determined by the smallest z-coordinate of the contour of the wall. The function will loop through the nodes on foundation strip to check whether the nodes are under this wall.

Warning

The model must be meshed, the dat-file should have been created and the dat-file should have been read and converted to DATDict, the dictionary containing the information in the dat-file.

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

  • node_fstrip_list (list of int): A list of the all the node numbers in the foundation strips

  • wall_name(str): Name of the requested wall.

Output:
  • Returns a list with multiple nodes (integers).

viiapackage.viiaGeneral._viia_find_foundation_strip_below_wall(wall) Optional[Fstrip][source]

This function will get the underlying foundation strip of a certain wall by check if the intersection exists from the center of the wall pointing to the foundation strip.

Input:
  • wall (obj): Wall object.

Output:
  • Returns the foundation strip object below the wall.

viiapackage.viiaGeneral._viia_find_intersecting_floors_for_wall(project: ViiaProject, wall)[source]

This function will get the intersecting floors of a wall by the following two steps: First check if both points of a line of the wall are in the surface of the floor. Else check if both points of a line of the floor are in the surface of the wall.

Note

Make sure the shapes are properly connected using the connect_shape function.

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

  • wall: Wall object.

Output:
  • Returns a list of the intersecting floors of the wall.

viiapackage.viiaGeneral._viia_find_lower_floor_of_wall(wall)[source]

This function will get the lower intersecting floors of a wall by using the function of viia_find_intersecting_floors_for_wall, the method here to judge if it is a lower floor is to compare the floor z_coordinate with the center of the wall coordinate.

Input:
  • wall: Wall object.

Output:
  • Returns a list of the lower intersecting floors of the wall.

viiapackage.viiaGeneral._viia_find_nodes_top_ridge(project: ViiaProject, tolerance=0.001) List[MeshNode][source]

This function collects the top mesh-nodes (in z-coordinate) within floor and roof shapes. The maximum z-coordinate is determined and any nodes within the tolerated distance from this maximum plane are collected.

Warning

The model must be meshed and read into the project. For diana this is done with project.from_diana.

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

  • tolerance (float): the tolerated distance from the found maximum z-coordinate

Output:
  • Returns a list with MeshNode objects.

viiapackage.viiaGeneral._viia_find_upper_floor_of_wall(wall: Wall) List[Floor][source]

This function will get the upper intersecting floors of a wall by using the function of viia_find_intersecting_floors_for_wall, the method here to judge if it is an upper floor is to compare the floor z_coordinate with the center of the wall coordinate.

Input:
  • wall (obj): Wall object.

Output:
  • Returns a list of the upper intersecting floors of the wall.

viiapackage.viiaGeneral._viia_find_wall_groups_for_nlka_in_model(project: ViiaProject) Dict[source]

This function will look for all the walls in the model, group them with the required parameters in the NLKA assessment procedure.

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

Output:
  • A dictionary is returned, which contains all the wall groups and all required parameters for nlka assessment. It also includes all the wall names in the group.

viiapackage.viiaGeneral._viia_foundation_area(project: ViiaProject)[source]

This function calculates the area of the supported surfaces in DIANA.

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

Output:
  • Returns the area of supported surfaces as float.

  • Adds the information in the logfile.

viiapackage.viiaGeneral._viia_get_weight_of_elements_in_box(project: ViiaProject, x_boundary, y_boundary, z_boundary)[source]

This function will calculate the weight of all the elements in a box by summing the weight of all elements.

Warning

The model must be meshed, the dat-file should have been created and the dat-file should have been read and converted to DATDict, the dictionary containing the information in the dat-file.

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

  • dat: dat file of the model.

  • x_boundary: list containing the x-boundaries of the box [start-coordinate, end-coordinate]

  • y_boundary: list containing the y-boundaries of the box [start-coordinate, end-coordinate]

  • z_boundary: list containing the z-boundaries of the box [start-coordinate, end-coordinate]

Output:
  • Returns the weight of all the elements in the defined unit in dat file.

viiapackage.viiaGeneral.viia_check_inner_wall(wall: Wall) bool[source]

This function will check if a wall is an inner wall. This is assessed in two steps:

  • First check if the start node of any line of the wall is inside the surface of the floor, or if the coordinate of middle of the top line of the wall is inside the floor surface when both top nodes of the wall are on the contour of the floor. If true then it is an inner wall, if not then it goes to step 2.

  • Second check if the wall has upper floors on its both sides, if true then it is an inner wall, otherwise it is not an inner wall.

Note

Before applying this function make sure to connect all shapes first.

Input:
  • wall (obj): Object reference of Wall object.

Output:
  • Returns a boolean whether the wall is an inner wall or not.

viiapackage.viiaGeneral.viia_find_closest_mesh_node(project: ViiaProject, target_point: List[float], mesh_nodes: List[MeshNode] = None, direction: str = None, precision: int = None, shape: Shapes = None) MeshNode[source]

Function to find the closest mesh node in the latest mesh.

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

  • target_point (list with 3 floats): Target point to find the closest node for.

  • mesh_nodes (list of obj. ref.): List of MeshNodes to check the shortest distance for. Default value None, all mesh-nodes stored in the collections will be used.

  • direction (str): Option to search the closest node on a certain plane. The closest node returned has the same coordinate, depending on this input. Default set to ‘None’, no direction. Options are ‘X’, ‘Y’ and ‘Z’. Input ‘Z’ will return a node with the same z-coordinate as the target point. If no such a point exists, None is returned.

  • precision (float): In case the direction is given, the precision is used to tuning how exact the node should be in coordinate of X, Y or Z directions. Default value is the project check-precision.

  • shape (obj): Object of shape class. If this input is given then the closest node will be found from within the nodes of this shape only. Default value is None.

Output:
  • If node_number is selected as return_type, the closest node is returned as number in the project.diana_settings.dat_file node collection. If set to complete, a list of MeshNode object, node coordinates and distance to target point is returned. Else the MeshNode object is returned.

viiapackage.viiaGeneral.viia_find_wall_center_z_coordinate(wall: Wall) float[source]

This function will get the z coordinate of the center of the wall by using the fem_centroid_of_polygon function.

Input:
  • wall (obj): Object reference of Wall object.

Output:
  • Returns a float of the z-coordinate of the center of the wall.

viiapackage.viiaGeneral.viia_get_element_weight(dat_file, element)[source]

This function will calculate the weight of an element by multiplying its volume by its density.

Warning

The model must be meshed, the dat-file should have been created and the dat-file should have been read and converted to DATDict, the dictionary containing the information in the dat-file.

Input:
  • dat: dat file of the model.

  • element: element number

Output:
  • Returns the weight of the element in the defined unit in dat file.

viiapackage.viiaGeneral.viia_get_flat_roofs(project: ViiaProject) List[Roof][source]

This function collects all the flat roofs. It loops only through the roof object collection and checks if the normal vector of the contour of the roof is vertical.

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

Output:
  • List with all the object references of flat roofs.

Functions for GMC and cost engineer

viiapackage.viiaGeneral.viia_create_cost_key_figures(project: ViiaProject, facade_list: List[Union[str, Wall]] = None, generate_excel: bool = False) Path[source]

This function computes the cost key figures required by the cost engineer (at request of the client) and send them to MYVIIA.

Note

Area of inner walls is not required anymore by cost engineer, August 2022.

The data collected is:

  • BVO: Area of all the modelled floors (no fstrip and roofs), excluding the openings > 5m2, in [m2].

  • BBO: Area of all the modelled ground floors, in [m2].

  • BGO: Area of the facade including the openings in [m2].

  • OGO: Area of the openings in the facade in [m2].

  • BDO: Area of all the modelled roofs including the openings in [m2].

  • ODO: Area of all the openings in the modelled roofs in [m2].

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

  • facade_list (list of obj): List with names or object references of the wall objects that should be considered facades of the building structure. Default value is None, the area of the facade and the opening area of the facade are not computed.

  • generate_excel (bool): Select to return an Excel sheet with the values for the cost engineer. A template for this Excel file is available in the viiaPackage. Default value is True.

Output:
  • The cost key figures are calculated based on the model.

  • The values are sent to MYVIIA. These are uploaded if no prior values exist, or the values have changed.

  • The Excel with the values is created, the location of the file is returned.

viiapackage.viiaGeneral.viia_get_facades(project: ViiaProject)[source]

Function returns and prints list of facade walls, based on VIIA functions. This function should be used to check and if required manually update list to use in consecutive functions for cost engineer. The function makes use of the viia_check_inner_wall functionality.

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

Output:
  • Returns and prints the facade shapes as list.

viiapackage.viiaGeneral.viia_get_inner_walls(project: ViiaProject)[source]

Function returns and prints list of inner walls, based on VIIA functions. This function should be used to check and if required manually update list to use in consecutive functions for cost engineer. The function makes use of the viia_check_inner_wall functionality.

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

Output:
  • Returns and prints the inner wall shapes as list.

Helper-functions

viiapackage.general.viia_cost_key_figures.viia_compute_cost_key_figures(project: ViiaProject, facade_list: List[Union[str, Wall]] = None) Dict[str, Union[float, int]][source]

This function computes the cost key figures required by the cost engineer (at request of the client).

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

  • facade_list (list of obj): List with names or object references of the wall objects that should be considered facades of the building structure. Default value is None, the area of the facade and the opening area of the facade are not computed.

Output:
  • Returns a dictionary containing the following information:

    • BVO: Area of all the modelled floors (no fstrip and roofs), excluding the openings > 5m2, in [m2].

    • BBO: Area of all the modelled ground floors, in [m2].

    • BGO: Area of the facade including the openings, in [m2].

    • OGO: Area of the openings in the facade, in [m2].

    • BBWO: Area of the inner walls including the openings, in [m2].

    • BDO: Area of all the modelled roofs including the openings, in [m2].

    • ODO: Area of all the openings in the modelled roofs, in [m2].

viiapackage.general.viia_cost_key_figures.viia_cost_key_figures_to_excel(project: ViiaProject, data: Dict[str, Union[float, int]]) Path[source]

This function fills the Excel template with the provided data for the cost key figures.

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

  • data (dict): Dictionary with the cost key figures, the keys ‘BVO’, ‘BBO’, ‘BGO’, ‘OGO’, ‘BDO’ and ‘ODO’ should be present in this dictionary. The values should be floats, in [m2].

Output:
  • Creates an Excel sheet with the values filled. The location of the file is returned as path.

viiapackage.general.viia_cost_key_figures.viia_send_cost_key_figures_to_myviia(project: ViiaProject, data: Dict[str, Union[float, int]]) Dict[str, Union[int, float, str]][source]

Function to send cost key figures to MYVIIA. It checks if there is already an existing record and if that record needs to be updated. In that case a new record is added.

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

  • data (dict): Dictionary with the cost key figures, the keys ‘BVO’, ‘BBO’, ‘BGO’, ‘OGO’, ‘BDO’ and ‘ODO’ should be present in this dictionary. The values should be floats, in [m2].

Output:
  • Compares and posts new values to MYVIIA.

  • Notifications of the process are provided.

  • Returns the response of the post in case the values on MYVIIA have been updated. If not, None is returned.

File handling (JSON, DIANA)

viiapackage.viiaGeneral._viia_analysis_diana_gui_files(project: ViiaProject, analysis: Analysis)[source]

When running an analysis directly from script in the DIANA GUI, the calculation files are located in the working directory. For result handling, the files need to be moved to the appropriate analysis folder. This function performs the moving and deleting of files.

When running a calculation in DIANA it creates a result file (dnb-file), a filos file (ff-file) and out files (out-files). The filos file is not needed anymore and is removed with this function. The result and out files are moved to the current analysis folder (project.current_analysis_folder). There functions for result handling will look for the results.

Note

After running a calculation in DIANA the result file is loaded in DIANA GUI automatically. When directly running this function, the file is locked and a copy is placed in the analysis folder. The result file in working directory can be removed after closing DIANA. But it is better to run picture scripts etc. directly after running the calculation and then remove the analysis in the script (the file is then unlocked).

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

  • analysis (obj): Object reference of ‘Analysis’ class. The analysis which will be performed. Default value is ‘None’. In case of SCIA calculations no analysis is needed. In case of DIANA calculations, the analysis it is required to provide the analysis. Alternative (str): Name of the analysis to be performed (there should be an object with that analysis).

Output:
  • Files are moved and deleted.

  • Notifications are given of errors.

  • Returns the out-file.

viiapackage.viiaGeneral._viia_get_material_database(project: ViiaProject)[source]

This function will return the json data from the VIIA-Database-Materials. As a function with lru_cache decorator, once the same input project is provided, the cached data will be returned instead of running through this function.

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

Output:
  • Return de json data of the database.

viiapackage.viiaGeneral.viia_check_materialname_present(project: ViiaProject, material_name) Union[None, str][source]

This function checks if the material is present in the material-database of VIIA.

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

  • material_name (str): Name of the material that is looked up in the material database.

Output:
  • Returns the name of the material group to which the looked up material belongs. If not found ‘None’ will be returned.

viiapackage.viiaGeneral.viia_get_material(project: ViiaProject, material_name: str, material_group: str) Optional[Dict][source]

This function will return a dictionary with the material properties from the VIIA-Database-Materials.

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

  • material_name (str): Name of the material that is looked up in the material database.

  • material_group (str): Name of the group to which the material belongs.

Output:
  • Returns dictionary with the properties of the material from the database.

viiapackage.viiaGeneral.viia_get_signal(project: ViiaProject, signal) Optional[Tuple][source]

This function will return four lists containing the data from the input signals from the VIIA-Database-Signals.

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

  • signal (str): Name of the signal, for example ‘S1’.

Output:
  • Returns 4 lists as tuple, containing respectively: time-signal, accelerations in x-direction, accelerations in y-direction and accelerations in z-direction.

viiapackage.viiaGeneral.viia_read_dump(project: ViiaProject, filename='Dump', remove_collections=True, loading_model: str = 'all', *args)[source]

Function can be used to reload a model created earlier.

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

  • filename (Path or str): Name of the file to be read. It is not required to add the suffix (json), but the file must have the json extension.

  • remove_collections (bool): Before adding new elements to the model, the existing ones are removed by default. Default value is True.

  • loading_model (str): Defines the categories to be loaded, different sets are created, increasing the amount of elements to be loaded. Default value is ‘all’, collecting all data from the json-file.

  • args (str): Any sub-folders relative to the working folder can be added.

Output:
  • The json is read and objects in it are initialised.

viiapackage.viiaGeneral.viia_read_myviia_model(project: ViiaProject, analysis: str = 'A1') Dict[str, Any][source]

This function will collect the model from MYVIIA that was uploaded for a specified analysis. The function will raise an error when there is already a model present, or if something went wrong in the process to collect or read.

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

  • analysis (str): Name of the analysis for which the model should be loaded, for example ‘A1’.

Output:
  • The model is read from MYVIIA and loaded into project.

  • Returns model summary of the loaded json.

viiapackage.viiaGeneral.viia_write_dump(project: ViiaProject, filename: Optional[str] = None, folder: Optional[Path] = None, create_summary: bool = True, result_json_only: bool = False) Tuple[Optional[Path], Optional[Path], Optional[Path]][source]

This function writes a dump-file of the current PY-memory. It saves the shapes, its attributes, Project data, properties, etc. The function viia_read_dump can be applied to reload.

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

  • filename (str): The name of the json-file to be written, default value is None, creating a filename based on the projectname and extend with ‘-model’.

  • folder (str or path): The name of the sub-folder where the file is to be written can be given, folder should be available. The sub-folder given in the argument is relative to and in the working directory. If not provided the json will be saved to the ‘model’ folder that is a sub-folder in the working folder.

  • create_summary (bool): Indicates if a pdf with a model summary should be made. Default is True.

  • result_json_only (bool): Switch to indicate only the result json should be generated. Only works if results= True, and return_result_json=True. By default, the switch is set to False.

Output:
  • Dumpfile is created by default in sub-folder ‘model’ of working directory or in given sub-folder of the working directory. The file contains the current state of the model in PY-memory.

  • Based on the model a summary is created.

  • A tuple is returned with the location of the model json-file, result json-file and model summary pdf-file.

Helper-functions

viiapackage.general.file_handling.restructure_folder.viia_restructure_folder(project: ViiaProject, analysis_nr: str)[source]

This function restructures an A4, A12 or A15 folder from the old structure to the current structure. The current structure involves a folder whose name contains the timestamp. This timestamp folder contains folder(s) corresponding to signal(s).

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

  • analysis_nr (int): The analysis number as a string. The acceptable analysis_nr are ‘A4’, ‘A12, ‘A15’.

Output:
  • The function does not return anything. A new folder is created with the new folder structure. The old folder remains with ‘ old’ added in front of its name, however, its contents are moved to the new folder.

viiapackage.general.file_handling.viia_filename.viia_to_filename(string: str) str[source]

This function replaces any characters from a string that can prevent a file from being saved in Windows.

Input:
  • string (str): String to be modified into a Windows filename format.

Output:
  • Returns string that adheres to Windows filename formats.

viiapackage.general.file_handling.viia_get_latest_model_folder.viia_get_latest_folder(version: Union[str, int], folder: Path) Dict[int, Path][source]

Function to collect the sub-folders within the requested folder that comply to the requested version. The timestamp is used as key in dictionary with these sub-folders, for easy selecting latest folder.

Input:
  • version (int): The version number as indicated at start of the project. By VIIA convention version number 1 indicates the BSC and higher numbers the strengthening steps. To get the latest model folder with the highest version number, provide input ‘highest’.

  • folder (path): Path of the folder for which the sub-folders are retrieved.

Output:
  • Returns dictionary with (keys) the timestamp of the sub-folder and values the path to the folder. Note that if version doesn’t match any of the sub-folders, the dictionary returned will be empty.

viiapackage.general.file_handling.viia_get_latest_model_folder.viia_get_latest_model_folder(project: ViiaProject, version: Optional[Union[int, str]] = None, folder: Optional[Path] = None, analysis_nr: Optional[str] = None, signal: Optional[str] = None) Optional[Path][source]

This function selects the latest model from the default analysis sub-folders. The path is based on the latest version and time an in the name of the folder. The version number determines the required model step. For BSC, the version is always 1. For TVA, the specific step must be provided. Within this selection the latest timestamp in the folder name is used to find the folder.

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

  • version (int): The version number as indicated at start of the project. By VIIA convention version number 1 indicates the BSC and higher numbers the strengthening steps. To get the latest model folder with the highest version number, provide input ‘highest’. Default value is None, using the version specified in the project.

  • folder (path): The path of the folder containing the folders from which the latest result folder must be obtained.

  • analysis_nr (str): The name of the analysis referencing the numbers in the viiaStatus. For example ‘A1’.

  • signal (str): The signal number specified as a string. The available signals are S1, S2, S3, S4, S5, S6, S7, S8, S9, S10 and S11. Required if analysis_name is ‘A4’, ‘A12’ or ‘A15’ or if the folder provided corresponds to one of these three analyses.

Output:
  • The latest result folder for the specified version number is returned as path reference.

viiapackage.general.file_handling.viia_get_latest_model_folder.viia_get_latest_model_folder_signal(project: ViiaProject, analysis_nr: str, signal: str, version: Optional[int] = None) Optional[Path][source]

This function selects the latest model from the default A4/A12/A15 analysis sub-folders for a given signal. The path is based on the latest version and timestamp in the name of the folder that contains the given signal.

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

  • analysis_nr (str): The number of the time history analysis. Choose from “A4”, “A12” or “A15”.

  • signal (str): The signal number specified as a string. The available signals are S1, S2, S3, S4, S5, S6, S7, S8, S9, S10 and S11.

  • version (int): The version number as indicated at start of the project. By VIIA convention version number 1 indicates the BSC and higher numbers the strengthening steps. To get the latest model folder with the highest version number, provide input ‘highest’. Default value is None, using the version specified in the project.

Output:
  • The latest result folder for the specified analysis and signal is returned as path reference.

viiapackage.general.viia_read_myviia_a1_model.viia_read_myviia_a1_model(project: ViiaProject) Dict[str, Any][source]

This function will collect the model from MYVIIA that was uploaded for the A1 analysis. The function will raise an error when there is already a model present, or if something went wrong in the process to collect or read.

Input:
  • project (obj): VIIA project object containing collections of fem objects and project variables.

Output:
  • The model is read from MYVIIA and loaded into project.

  • Returns model summary of the loaded json.