pytabs.case_static_linear

  1# pyTABS - ETABS .NET API python wrapper
  2# CaseStaticLinear - cCaseStaticLinear
  3__all__ = ['CaseStaticLinear']
  4
  5# import ETABS namespace and pyTABS error handler
  6from pytabs.etabs_config import *
  7from pytabs.error_handle import *
  8
  9# import custom enumerations
 10from pytabs.enumerations import eLinearStaticCaseLoadType
 11
 12
 13# import typing
 14from typing import TypedDict
 15
 16
 17
 18class StaticLinearLoadData(TypedDict):
 19    """TypedDict class for static linear load case loading data"""
 20    case_name : str
 21    load_types : list[eLinearStaticCaseLoadType]
 22    load_names : list[str]
 23    scaling_factors : list[float]
 24
 25
 26class CaseStaticLinear:
 27    """CaseStaticLinearStaged interface"""
 28    def __init__(self, sap_model : etabs.cSapModel) -> None:
 29        # link of SapModel interface
 30        self.sap_model = sap_model
 31        # create interface for static linear load cases
 32        self.static_linear = etabs.cCaseStaticLinear(sap_model.LoadCases.StaticLinear)
 33        
 34        # relate custom enumerations
 35        self.eLinearStaticCaseLoadType = eLinearStaticCaseLoadType
 36
 37
 38    def get_initial_case(self, name : str) -> str:
 39        """Retrieves the initial condition assumed for the specified load case.
 40
 41        :param name: name of an existing static linear load case
 42        :type name: str
 43        :return: blank, None, or the name of an existing analysis case
 44        :rtype: str
 45        """
 46        initial_case = str()
 47        [ref, initial_case] = self.static_linear.GetInitialCase(name, initial_case)
 48        handle(ref)
 49        return initial_case
 50
 51
 52    def get_loads(self, name : str) -> StaticLinearLoadData:
 53        """Retrieves the load data for the specified load case.
 54
 55        :param name: name of an existing static linear load case
 56        :type name: str
 57        :return: load data
 58        :rtype: StaticLinearLoadData
 59        """
 60        number_loads = int()
 61        load_types = [str()]
 62        load_names = [str()]
 63        scaling_factors = [float()]
 64        [ret, number_loads, load_types,
 65         load_names, scaling_factors] = self.static_linear.GetLoads(name, number_loads, load_types,
 66                                                                    load_names, scaling_factors)
 67        handle(ret)
 68        load_types = [eLinearStaticCaseLoadType(load_type) for load_type in load_types]
 69        return {'case_name': name,
 70                'load_types': load_types,
 71                'load_names': load_names,
 72                'scaling_factors': scaling_factors}
 73
 74
 75    def set_case(self, name : str) -> None:
 76        """Initializes a static linear load case.
 77
 78        :param name: name of an existing or new load case
 79        :type name: str
 80        """
 81        handle(self.static_linear.SetCase(name))
 82
 83
 84    def set_initial_case(self, name : str, initial_case_name : str) -> None:
 85        """Sets the initial condition for the specified load case.
 86
 87        :param name: name of an existing static linear load case
 88        :type name: str
 89        :param initial_case_name:  name of an existing analysis case, can be blank or None
 90        :type initial_case_name: str
 91        """
 92        handle(self.static_linear.SetInitialCase(name, initial_case_name))
 93
 94
 95    def set_loads(self, name : str, number_loads : int, load_types : list[eLinearStaticCaseLoadType],
 96                  load_names : list[str], scale_factors : list[float]) -> None:
 97        """Sets the load data for the specified analysis case.
 98
 99        :param name: name of an existing static nonlinear load case
100        :type name: str
101        :param number_loads: number of loads assigned to the specified analysis case
102        :type number_loads: int
103        :param load_types: load type; one of `eLinearStaticCaseLoadType`
104        :type load_types: list[eLinearStaticCaseLoadType]
105        :param load_names: for a load this is the name of a defined load pattern, for an acceleration this is UX, UY, UZ, RX, RY or RZ and for a mode this is the mode number.
106        :type load_names: list[str]
107        :param scale_factors: scaling factor for load or mode, or magnitude of an acceleration
108        :type scale_factors: list[float]
109        """
110        self.__verify_loading_details(number_loads, load_types, load_names, scale_factors)
111        load_types = [load_type.value for load_type in load_types]
112        [ret, ret_load_types, ret_load_names, ret_scale_factors] = self.static_linear.SetLoads(name, number_loads, load_types, load_names, scale_factors)
113        handle(ret)
114
115
116    def __verify_loading_details(self, number_loads : int, load_types : list[eLinearStaticCaseLoadType],
117                                 load_names : list[str], scale_factors : list[float]):
118        """Private method for verifying loading details used by method `.set_loads`
119        """
120        if any(len(input_list) != number_loads for input_list in [load_types, load_names, scale_factors]):
121            raise ValueError('length of all input lists must must be equal to input number_loads')
122        for _l, load_type in enumerate(load_types):
123            load_name = load_names[_l]
124            if load_type is eLinearStaticCaseLoadType.ACCELERATION and (load_name not in ['UX', 'UY', 'UZ', 'RX', 'RY', 'RZ']):
125                raise ValueError('where load type is acceleration, the load name must be UX, UY, UZ, RX, RY or RZ, indicating the direction')
class CaseStaticLinear:
 27class CaseStaticLinear:
 28    """CaseStaticLinearStaged interface"""
 29    def __init__(self, sap_model : etabs.cSapModel) -> None:
 30        # link of SapModel interface
 31        self.sap_model = sap_model
 32        # create interface for static linear load cases
 33        self.static_linear = etabs.cCaseStaticLinear(sap_model.LoadCases.StaticLinear)
 34        
 35        # relate custom enumerations
 36        self.eLinearStaticCaseLoadType = eLinearStaticCaseLoadType
 37
 38
 39    def get_initial_case(self, name : str) -> str:
 40        """Retrieves the initial condition assumed for the specified load case.
 41
 42        :param name: name of an existing static linear load case
 43        :type name: str
 44        :return: blank, None, or the name of an existing analysis case
 45        :rtype: str
 46        """
 47        initial_case = str()
 48        [ref, initial_case] = self.static_linear.GetInitialCase(name, initial_case)
 49        handle(ref)
 50        return initial_case
 51
 52
 53    def get_loads(self, name : str) -> StaticLinearLoadData:
 54        """Retrieves the load data for the specified load case.
 55
 56        :param name: name of an existing static linear load case
 57        :type name: str
 58        :return: load data
 59        :rtype: StaticLinearLoadData
 60        """
 61        number_loads = int()
 62        load_types = [str()]
 63        load_names = [str()]
 64        scaling_factors = [float()]
 65        [ret, number_loads, load_types,
 66         load_names, scaling_factors] = self.static_linear.GetLoads(name, number_loads, load_types,
 67                                                                    load_names, scaling_factors)
 68        handle(ret)
 69        load_types = [eLinearStaticCaseLoadType(load_type) for load_type in load_types]
 70        return {'case_name': name,
 71                'load_types': load_types,
 72                'load_names': load_names,
 73                'scaling_factors': scaling_factors}
 74
 75
 76    def set_case(self, name : str) -> None:
 77        """Initializes a static linear load case.
 78
 79        :param name: name of an existing or new load case
 80        :type name: str
 81        """
 82        handle(self.static_linear.SetCase(name))
 83
 84
 85    def set_initial_case(self, name : str, initial_case_name : str) -> None:
 86        """Sets the initial condition for the specified load case.
 87
 88        :param name: name of an existing static linear load case
 89        :type name: str
 90        :param initial_case_name:  name of an existing analysis case, can be blank or None
 91        :type initial_case_name: str
 92        """
 93        handle(self.static_linear.SetInitialCase(name, initial_case_name))
 94
 95
 96    def set_loads(self, name : str, number_loads : int, load_types : list[eLinearStaticCaseLoadType],
 97                  load_names : list[str], scale_factors : list[float]) -> None:
 98        """Sets the load data for the specified analysis case.
 99
100        :param name: name of an existing static nonlinear load case
101        :type name: str
102        :param number_loads: number of loads assigned to the specified analysis case
103        :type number_loads: int
104        :param load_types: load type; one of `eLinearStaticCaseLoadType`
105        :type load_types: list[eLinearStaticCaseLoadType]
106        :param load_names: for a load this is the name of a defined load pattern, for an acceleration this is UX, UY, UZ, RX, RY or RZ and for a mode this is the mode number.
107        :type load_names: list[str]
108        :param scale_factors: scaling factor for load or mode, or magnitude of an acceleration
109        :type scale_factors: list[float]
110        """
111        self.__verify_loading_details(number_loads, load_types, load_names, scale_factors)
112        load_types = [load_type.value for load_type in load_types]
113        [ret, ret_load_types, ret_load_names, ret_scale_factors] = self.static_linear.SetLoads(name, number_loads, load_types, load_names, scale_factors)
114        handle(ret)
115
116
117    def __verify_loading_details(self, number_loads : int, load_types : list[eLinearStaticCaseLoadType],
118                                 load_names : list[str], scale_factors : list[float]):
119        """Private method for verifying loading details used by method `.set_loads`
120        """
121        if any(len(input_list) != number_loads for input_list in [load_types, load_names, scale_factors]):
122            raise ValueError('length of all input lists must must be equal to input number_loads')
123        for _l, load_type in enumerate(load_types):
124            load_name = load_names[_l]
125            if load_type is eLinearStaticCaseLoadType.ACCELERATION and (load_name not in ['UX', 'UY', 'UZ', 'RX', 'RY', 'RZ']):
126                raise ValueError('where load type is acceleration, the load name must be UX, UY, UZ, RX, RY or RZ, indicating the direction')

CaseStaticLinearStaged interface

CaseStaticLinear(sap_model: ETABSv1.cSapModel)
29    def __init__(self, sap_model : etabs.cSapModel) -> None:
30        # link of SapModel interface
31        self.sap_model = sap_model
32        # create interface for static linear load cases
33        self.static_linear = etabs.cCaseStaticLinear(sap_model.LoadCases.StaticLinear)
34        
35        # relate custom enumerations
36        self.eLinearStaticCaseLoadType = eLinearStaticCaseLoadType
def get_initial_case(self, name: str) -> str:
39    def get_initial_case(self, name : str) -> str:
40        """Retrieves the initial condition assumed for the specified load case.
41
42        :param name: name of an existing static linear load case
43        :type name: str
44        :return: blank, None, or the name of an existing analysis case
45        :rtype: str
46        """
47        initial_case = str()
48        [ref, initial_case] = self.static_linear.GetInitialCase(name, initial_case)
49        handle(ref)
50        return initial_case

Retrieves the initial condition assumed for the specified load case.

Parameters
  • name: name of an existing static linear load case
Returns

blank, None, or the name of an existing analysis case

def get_loads(self, name: str) -> pytabs.case_static_linear.StaticLinearLoadData:
53    def get_loads(self, name : str) -> StaticLinearLoadData:
54        """Retrieves the load data for the specified load case.
55
56        :param name: name of an existing static linear load case
57        :type name: str
58        :return: load data
59        :rtype: StaticLinearLoadData
60        """
61        number_loads = int()
62        load_types = [str()]
63        load_names = [str()]
64        scaling_factors = [float()]
65        [ret, number_loads, load_types,
66         load_names, scaling_factors] = self.static_linear.GetLoads(name, number_loads, load_types,
67                                                                    load_names, scaling_factors)
68        handle(ret)
69        load_types = [eLinearStaticCaseLoadType(load_type) for load_type in load_types]
70        return {'case_name': name,
71                'load_types': load_types,
72                'load_names': load_names,
73                'scaling_factors': scaling_factors}

Retrieves the load data for the specified load case.

Parameters
  • name: name of an existing static linear load case
Returns

load data

def set_case(self, name: str) -> None:
76    def set_case(self, name : str) -> None:
77        """Initializes a static linear load case.
78
79        :param name: name of an existing or new load case
80        :type name: str
81        """
82        handle(self.static_linear.SetCase(name))

Initializes a static linear load case.

Parameters
  • name: name of an existing or new load case
def set_initial_case(self, name: str, initial_case_name: str) -> None:
85    def set_initial_case(self, name : str, initial_case_name : str) -> None:
86        """Sets the initial condition for the specified load case.
87
88        :param name: name of an existing static linear load case
89        :type name: str
90        :param initial_case_name:  name of an existing analysis case, can be blank or None
91        :type initial_case_name: str
92        """
93        handle(self.static_linear.SetInitialCase(name, initial_case_name))

Sets the initial condition for the specified load case.

Parameters
  • name: name of an existing static linear load case
  • initial_case_name: name of an existing analysis case, can be blank or None
def set_loads( self, name: str, number_loads: int, load_types: list[pytabs.enumerations.eLinearStaticCaseLoadType], load_names: list[str], scale_factors: list[float]) -> None:
 96    def set_loads(self, name : str, number_loads : int, load_types : list[eLinearStaticCaseLoadType],
 97                  load_names : list[str], scale_factors : list[float]) -> None:
 98        """Sets the load data for the specified analysis case.
 99
100        :param name: name of an existing static nonlinear load case
101        :type name: str
102        :param number_loads: number of loads assigned to the specified analysis case
103        :type number_loads: int
104        :param load_types: load type; one of `eLinearStaticCaseLoadType`
105        :type load_types: list[eLinearStaticCaseLoadType]
106        :param load_names: for a load this is the name of a defined load pattern, for an acceleration this is UX, UY, UZ, RX, RY or RZ and for a mode this is the mode number.
107        :type load_names: list[str]
108        :param scale_factors: scaling factor for load or mode, or magnitude of an acceleration
109        :type scale_factors: list[float]
110        """
111        self.__verify_loading_details(number_loads, load_types, load_names, scale_factors)
112        load_types = [load_type.value for load_type in load_types]
113        [ret, ret_load_types, ret_load_names, ret_scale_factors] = self.static_linear.SetLoads(name, number_loads, load_types, load_names, scale_factors)
114        handle(ret)

Sets the load data for the specified analysis case.

Parameters
  • name: name of an existing static nonlinear load case
  • number_loads: number of loads assigned to the specified analysis case
  • load_types: load type; one of eLinearStaticCaseLoadType
  • load_names: for a load this is the name of a defined load pattern, for an acceleration this is UX, UY, UZ, RX, RY or RZ and for a mode this is the mode number.
  • scale_factors: scaling factor for load or mode, or magnitude of an acceleration