Source code for viiapackage.tools.interactive_modelling.viia_interactive_modelling

### ===================================================================================================================
###   INTERACTIVE MODELLING
### ===================================================================================================================
# Copyright ©VIIA 2025

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

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

# References for functions and classes in the rhdhv_fem package
from rhdhv_fem.grid import Gridline, GridlineGroup, Level, Grid
from rhdhv_fem.shapes import Shapes
from rhdhv_fem.groups import Layer

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


### ===================================================================================================================
###    2. Functions viia_start_interactive_modelling
### ===================================================================================================================

[docs]def viia_start_interactive_modelling( project: ViiaProject, level: Union[Level, float, str], geometry_material_combinations: List[List[Union[int, float, str]]], layer: Union[Layer, str], grid_lines: Union[Grid, List[Union[Gridline, GridlineGroup, Grid]]] = None, shape_type: str = 'wall', top_level: Optional[Union[Level, float, str]] = None, reference_shapes: List[Union[Shapes, Layer]] = None, create_new_shapes: bool = True, show_pop_up: bool = False, prevent_grid_output: bool = False): """ Input: - project (obj): Project object containing collections and of fem objects and project variables. - level (obj): Level object that indicates the level of the new to model shapes. Alternatively the z_coordinate or name of an existing level can be given. - layer (obj): Layer object that indicates the layer of the new to model shapes. - grid_lines (obj): Grid associate objects near the area where new shapes will be modelled. The intersections of the gridlines will be available as clickable points. Default value is None. If None is provided, the first Grid of the project will be used. - geometry_material_combinations (list of lists of two inputs): List of the geometry and material combination that are used for the new shapes. First input of the inner list should be the geometry, Second input should be the material. - shape_type (str): The type of new shapes that can be created. Available are: 'wall', 'floor', 'beam', 'column'. - top_level (obj): Level that indicates the top of the wall. Required only when shape_type is 'wall' or 'column', for other shape_type input the top_level is not used. Alternatively the -_coordinate or name of an existing level can be given. - reference_shapes (list of obj): Indicates which references shapes should be shown in the plot to help modelling. When no input is given the shapes from the layer below the layer of the new shapes will be used. - create_new_shapes (bool): Switch to indicate if the new shapes should be made directly. - show_pop_up (bool): Switch to show a pop-up when creating the shapes - prevent_grid_output (bool): If possible the output will be provided for the grid system. With this switch grid based output can be prevented. Default is False. Output: - The lines to create the shapes in the model script will be printed in the python console. - New shapes will be created when create_new_shapes is set to through - Returned are a list of text lines with commands to create the new shapes, and the object references of the new shapes """ if project.rhdhvDIANA.run_diana: raise RuntimeError(f"ERROR: Interactive modelling tool cannot be used when running in DIANA.") vim = VIIAInteractiveModelling( project=project, level=level, layer=layer, grid_lines=grid_lines, geometry_material_combinations=geometry_material_combinations, shape_type=shape_type, top_level=top_level, reference_shapes=reference_shapes, create_new_shapes=create_new_shapes, show_pop_up=show_pop_up, prevent_grid_output=prevent_grid_output) vim.set_up_plot() vim.inform_user() return vim.text_lines, vim.new_shapes_objects
### =================================================================================================================== ### 3. End of script ### ===================================================================================================================