### ===================================================================================================================
### Function to check if the material-name complies to VIIA naming conventions
### ===================================================================================================================
# Copyright ©VIIA 2024
### ===================================================================================================================
### 1. Import modules
### ===================================================================================================================
# General imports
from __future__ import annotations
from typing import TYPE_CHECKING
# References for functions and classes in the viiaPackage
if TYPE_CHECKING:
from viiapackage.viiaStatus import ViiaProject
### ===================================================================================================================
### 2. Get geometry-group based on geometry-name
### ===================================================================================================================
[docs]def viia_check_material_name(project: ViiaProject, material_name: str, material_group: str) -> bool:
"""
Function to check whether the name of the material is according to VIIA convention
Input:
- project (obj): VIIA project object containing collections of fem objects and project variables.
- material_name (str): Name of the material.
- material_group (str): Name of the material-group.
Output:
- Returns True if the material-name complies to VIIA naming convention.
- Raises an error if the material-name is not according to VIIA convention.
"""
if material_group in [
'Linear', 'LinearTimber', 'LinearSteel', 'LinearInterface', 'LinearOrthotropic', 'LinearOrthotropicSteel',
'LinearDirectStiffness', 'LinRebar', 'NonLinMasonry', 'NonLinConcrete', 'NonLinRebar',
'NonLinBondSlipRebar', 'NonLinSteel', 'NonLinInterfaceFriction', 'NonLinElasticInterface', 'TimberFrame']:
if 'BETON' in material_name and material_name not in ['LIN-SCHUIMBETON']:
if len(material_name.split('-')) not in [1, 2, 3, 4]:
raise ValueError(
f"ERROR: Name of {material_name} is not according to VIIA convention, it should look like "
f"'LIN-BETON', 'LIN-BETON-GK', 'LIN-BETON-GK-BASALT', 'BETON-C20/25', 'BETON-C20/25-GK' or "
f"'BETON-C20/25-GK-ZANDSTEEN'.")
if '-GK' in material_name:
if len(material_name.split('-')) not in [3, 4]:
raise ValueError(
f"ERROR: Name of {material_name} is not according to VIIA convention, it should look like "
f"'LIN-BETON-GK', 'BETON-C20/25-GK' or 'BETON-C20/25-GK-ZANDSTEEN'.")
if material_name in ['KALKSTEEN', 'ZANDSTEEN', 'BASALT', 'KWARTS']:
if len(material_name.split('-')) not in [3, 4]:
raise ValueError(
f"ERROR: Name of {material_name} is not according to VIIA convention, it should look like "
f"'LIN-BETON-ZANDSTEEN' or 'BETON-C20/25-ZANDSTEEN'.")
elif 'HSB' in material_name:
# Material name example: 'LIN-HSB-0.018-0.05-0.15-0.6'
if len(material_name.split('-')) not in [6]:
raise ValueError(
f"ERROR: Name of {material_name} is not according VIIA convention, it should look like "
f"'LIN-HSB-0.018-0.05-0.15-0.6'.")
elif 'HBV' in material_name or 'PLANKEN' in material_name or 'PLATEN' in material_name:
npr_year = int(project.project_information['npr_versie'].split('NPR9998:')[-1][0:4])
if npr_year >= 2020:
if len(material_name.split('-')) not in [7, 9, 10]:
t = material_name.split('-')
raise ValueError(
f"ERROR: Name of {material_name} is not according VIIA convention, it should look like "
f"'LIN-HBV-PLANKEN-0.018-0.05-0.15-0.6-4-6.5', or "
f"'LIN-HBV-PLANKEN-0.018-0.05-0.15-0.6-4-6.5-0.25' for floor material or "
f"'LIN-HBV-PLANKEN-0.018-0.05-0.15-0.6' for roof material.")
else:
if len(material_name.split('-')) not in [7]:
raise ValueError(
f"ERROR: Name of {material_name} is not according to VIIA convention, it should look like"
f"'LIN-HBV-PLANKEN-0.018-0.05-0.15-0.6' or 'LIN-HBV-PLATEN-0.018-0.05-0.15-0.6'.")
elif 'KPV' in material_name:
if len(material_name.split('-')) not in [3, 4]:
raise ValueError(
f"ERROR: Name of {material_name} is not according VIIA convention, it should look like "
f"'LIN-KPV-260' for a floor without any compressive layer or 'LIN-KPV-150-60' for a floor "
f"with compressive layer.")
elif 'VEER' in material_name or 'SPRING' in material_name:
if len(material_name.split('-')) not in [2, 3, 4]:
raise ValueError(
f"ERROR: Name of {material_name} is not according to VIIA convention, it should look like "
f"'LIN-SPRING-1.5e+06' or 'LIN-SPRING-1.5E+06-0.002' or 'SPOUWANKER-150'.")
elif 'COMBI' in material_name:
if len(material_name.split('-')) not in [4, 5]:
raise ValueError(
f"ERROR: Name of {material_name} is not according to VIIA convention, it should look like "
f"'LIN-COMBI-VBI-170-40', 'LIN-COMBI-DATO-170-40' or 'LIN-COMBI-DATO-170'.")
elif 'RIB' in material_name:
if len(material_name.split('-')) not in [3]:
raise ValueError(
f"ERROR: Name of {material_name} is not according to VIIA convention, it should look like "
f"'LIN-RIB-CVP'.")
elif 'LEWIS' in material_name:
if len(material_name.split('-')) not in [3]:
raise ValueError(
f"ERROR: Name of {material_name} is not according to VIIA convention, it should look like"
f"'LIN-LEWIS-51'.")
elif 'STAAL' in material_name:
if len(material_name.split('-')) not in [2, 3]:
raise ValueError(
f"ERROR: Name of {material_name} is not according to VIIA convention, it should look like "
f"'LIN-STAAL' or 'LIN-STAAL-275'")
elif 'MW' in material_name:
if len(material_name.split('-')) not in [2, 3, 4]:
raise ValueError(
f"ERROR: Name of {material_name} is not according to VIIA convention, it should look like "
f"'LIN-MW-KZS>1960', 'MW-KLEI<1945SK', 'MW-KLEI<1945-0.25x0.25', 'LIN-MW-KLEI>1945-DENSIT2160' or "
f"'LIN-MW-AAC'.")
elif 'HOUT' in material_name and 'Linear' in material_group:
if len(material_name.split('-')) not in [2, 3, 4]:
raise ValueError(
f"ERROR: Name of {material_name} is not according to VIIA convention, it should look like "
f"'LIN-HOUT', 'LIN-HOUT-PLAAT' or 'LIN-HOUT-PLAAT-VUREN'.")
elif 'STDAK' in material_name:
if len(material_name.split('-')) not in [4]:
raise ValueError(
f"ERROR: Name of {material_name} is not according to VIIA convention, it should look like "
f"'LIN-STDAK-SAB158R/750-1.5' or 'LIN-STDAK-SAB158R/750-1.25'.")
elif 'DUMMY' in material_name:
if len(material_name.split('-')) not in [2, 3]:
raise ValueError(
f"ERROR: Name of {material_name} is not according to VIIA convention, it should look like "
f"'LIN-DUMMY' or 'LIN-DUMMY-PLATE'.")
elif 'NEHOBO' in material_name:
if len(material_name.split('-')) not in [2, 3]:
raise ValueError(
f"ERROR: Name of {material_name} is not according to VIIA convention, it should look like "
f"'LIN-NEHOBO' or 'LIN-NEHOBO-140'.")
elif 'SANDWICH' in material_name:
if len(material_name.split('-')) not in [2]:
raise ValueError(
f"ERROR: Name of {material_name} is not according to VIIA convention, it should look like "
f"'LIN-SANDWICH'.")
elif 'SCHUIMBETON' in material_name:
if len(material_name.split('-')) not in [2]:
raise ValueError(
f"ERROR: Name of {material_name} is not according to VIIA convention, it should look like "
f"'LIN-SCHUIMBETON'.")
elif 'QUAKESHIELD' in material_name:
if len(material_name.split('-')) not in [2, 3]:
raise ValueError(
f"ERROR: Name of {material_name} is not according to VIIA convention, it should look like "
f"'LIN-CFRPMESH-QUAKESHIELD' or 'CFRP-QUAKESHIELD'.")
elif 'HVBP' in material_name:
if len(material_name.split('-')) not in [4]:
raise ValueError(
f"ERROR: Name of {material_name} is not according to VIIA convention, it should look like "
f"'LIN-HVBP-HOUTWOL-4x20' or 'LIN-HVBP-DURISOL-160'.")
elif 'COSTEEL' in material_name:
if len(material_name.split('-')) not in [2]:
raise ValueError(
f"ERROR: Name of {material_name} is not according to VIIA convention, it should look like "
f"'LIN-COSTEEL'.")
elif 'GOLF' in material_name:
if len(material_name.split('-')) not in [3]:
raise ValueError(
f"ERROR: Name of {material_name} is not according to VIIA convention, it should look like "
f"'LIN-VECEM-GOLF'.")
elif 'UNIDEK' in material_name:
if len(material_name.split('-')) not in [2]:
raise ValueError(
f"ERROR: Name of {material_name} is not according to VIIA convention, it should look like "
f"'LIN-UNIDEK'.")
elif material_name in ['LIN-L3A', 'LIN-L3B', 'LIN-L3D', 'LIN-L3E', 'LIN-L3M']:
pass
elif 'MPV' in material_name:
if len(material_name.split('-')) not in [2]:
raise ValueError(
f"ERROR: Name of {material_name} is not according to VIIA convention, it should look like "
f"'LIN-MPV'.")
elif 'WAP' in material_name:
if len(material_name.split('-')) not in [2, 3]:
raise ValueError(
f"ERROR: Name of {material_name} is not according to VIIA convention, it should look like "
f"'LIN-WAP-B500' or 'WAP-B500'.")
else:
if 'IF' not in material_name:
raise ValueError(f"ERROR: The {material_name} is not according to VIIA convention. Check the Database.")
elif 'LinearRotationalSpring' in material_group or \
'LinearTranslationalSpring' in material_group or \
'NonLinSpring' in material_group:
if len(material_name.split('-')) not in [2, 3, 4]:
raise ValueError(
f"ERROR: Name of {material_name} is not according to VIIA convention, it should look like "
f"'LIN-SPRING-1.5e+06' or 'LIN-SPRING-1.5E+06-0.002' or 'SPOUWANKER-150'.")
elif 'PointMass' in material_group:
if len(material_name.split('-')) not in [3, 5]:
raise ValueError(
f"ERROR: Name of {material_name} is not according to VIIA convention, it should look like "
f"'LIN-PUNTMASSA-200.0-100.0-150.0' or 'LIN-PUNTMASSA-200.0'.")
elif 'LineMass' in material_group:
if len(material_name.split('-')) not in [3, 4]:
raise ValueError(
f"ERROR: Name of {material_name} is not according to VIIA convention, it should look like "
f"'LIN-LIJNMASSA-200.0-(1,1,1)'.")
elif 'SurfaceMass' in material_group:
if len(material_name.split('-')) not in [3]:
raise ValueError(
f"ERROR: Name of {material_name} is not according to VIIA convention, it should look like "
f"'LIN-VLAKMASSA-200.0'.")
elif 'USRDEF' in material_group:
if len(material_name.split('_')) not in [3, 4]:
raise ValueError(
f"ERROR: Name of {material_name} is not according to VIIA convention, it should look like "
f"'USRDEF_KOP001_basement_100%' or 'USRDEF_KOP001_100%'.")
else:
raise ValueError(
f"ERROR: The {material_name} mentioned is not checked against VIIA convention. Check the database if the "
f"material is present or not.")
return True
### ===================================================================================================================
### 3. End of script
### ===================================================================================================================