pytabs.model

  1# pyTABS - ETABS .NET API python wrapper
  2# EtabsModel object and cFile interface
  3__all__ = ['EtabsModel']
  4
  5# general library imports
  6from pytabs.etabs import *
  7from pytabs.error_handle import handle, EtabsError
  8
  9# import typing
 10from typing import Union, TypedDict
 11
 12# import of ETABS API interface wrappers
 13from pytabs.pier_label import PierLabel
 14from pytabs.analysis_results import AnalysisResults
 15from pytabs.load_cases import LoadCases
 16from pytabs.resp_combo import RespCombo
 17from pytabs.story import Story
 18
 19
 20class UnitsComponents(TypedDict):
 21    """TypedDict class for Units components return"""
 22    force_units : eForce
 23    length_units : eLength
 24    temperature_units : eTemperature
 25
 26
 27class EtabsModel():
 28    """pytabs ETABS Model Object `EtabsObject` 🏢. 
 29    
 30    All interfaces and enumerations to the Etabs model objects are accessed as properties - refer below.
 31    
 32    """
 33    def __init__(self,
 34                 attach_to_instance : bool = True,
 35                 specific_etabs : bool = True,
 36                 specific_etabs_path : Union[str, Path] = default_etabs_exe_path,
 37                 model_path : Union[str, Path] = '',
 38                 remote_computer : str = '') -> None:
 39        
 40        # relate ETABS interfaces
 41        self.pier_label : PierLabel
 42        """EtabsModel `PierLabel` interface."""
 43        self.analysis_results : AnalysisResults
 44        """EtabsModel `AnalysisResults` interface."""
 45        self.load_cases : LoadCases
 46        """EtabsModel `LoadCases` interface."""
 47        self.resp_combo : RespCombo
 48        """EtabsModel `RespCombo` interface."""
 49        self.story : Story
 50        """EtabsModel `Story` interface."""
 51        
 52        # relate ETABS fixed enumerations
 53        self.eUnits = eUnits
 54        """EtabsModel `Units` enumeration."""
 55        self.eForce = eForce
 56        """EtabsModel `Force` enumeration."""
 57        self.eLength = eLength
 58        """EtabsModel `Length` enumeration."""
 59        self.eTemperature = eTemperature
 60        """EtabsModel `Temperature` enumeration."""
 61        self.eLoadCaseType = eLoadCaseType
 62        """EtabsModel `LoadCaseType` enumeration"""
 63        
 64        # EtabsModel initial properties
 65        self.active : bool = False
 66        """`True` if EtabsModel is active, otherwise `False`."""
 67        self.model_open : bool = False
 68        """`True` if model open, otherwise `False`."""
 69        self.model_path : Union[str, Path] = ''
 70        """Etabs model filepath."""
 71        
 72        # create ETABS API helper interface and try to initialise EtabsObject
 73        helper = cHelper(Helper())
 74        if attach_to_instance:
 75            #attach to a running instance of ETABS
 76            try:
 77                #get the active ETABS object        
 78                if remote_computer:
 79                    self.etabs_object = cOAPI(helper.GetObjectHost(remote_computer, "CSI.ETABS.API.ETABSObject"))
 80                else:
 81                    self.etabs_object = cOAPI(helper.GetObject("CSI.ETABS.API.ETABSObject"))
 82                self.active = True
 83            except:
 84                raise EtabsError(-1, "No running instance ETABS found or failed to attach.")
 85        else:
 86            if specific_etabs:
 87                try:
 88                    #'create an instance of the ETABS object from the specified path
 89                    if remote_computer:
 90                        self.etabs_object = cOAPI(helper.CreateObjectHost(remote_computer, str(specific_etabs_path)))
 91                    else:
 92                        self.etabs_object = cOAPI(helper.CreateObject(str(specific_etabs_path)))
 93                    self.active = True
 94                except :
 95                    raise EtabsError(-1, f"Cannot start a new instance of the ETABS from {str(specific_etabs_path)}")
 96            else:
 97                try: 
 98                    #create an instance of the ETABS object from the latest installed ETABS
 99                    if remote_computer:
100                        self.etabs_object = cOAPI(helper.CreateObjectProgIDHost(remote_computer, "CSI.ETABS.API.ETABSObject"))
101                    else:
102                        self.etabs_object = cOAPI(helper.CreateObjectProgID("CSI.ETABS.API.ETABSObject"))
103                    self.active = True
104                except:
105                    raise EtabsError(-1, "Cannot start a new instance of ETABS.")
106            # start etabs application
107            self.etabs_object.ApplicationStart()
108        
109        # if EtabsObject active 
110        if self.active:
111            # create SapModel interface
112            self.sap_model = cSapModel(self.etabs_object.SapModel)
113            """EtabsModel `SapModel` interface."""
114            # create File interface
115            self.file = cFile(self.sap_model.File)
116            
117            # relate external pyTABS interfaces
118            self.pier_label = PierLabel(self.sap_model)
119            self.analysis_results = AnalysisResults(self.sap_model)
120            self.load_cases = LoadCases(self.sap_model)
121            self.resp_combo = RespCombo(self.sap_model)
122            self.story = Story(self.sap_model)
123            
124            # if not attached to instance and model path supplied open model
125            if (not attach_to_instance) and model_path:
126                self.open_model(model_path)
127
128
129    def exit_application(self):
130        '''Terminates ETABS application severing API connection'''
131        self.etabs_object.ApplicationExit(False)
132        self.model_open = False
133        self.model_path = ''
134        self.sap_model = None
135        self.active = False
136
137
138    def open_model(self, model_path: Union[str, Path]) -> None:
139        """Opens ETABS model file.
140
141        :param model_path: file path to ETABS model file
142        :type model_path: Union[str, Path]
143        """
144        handle(self.file.OpenFile(str(model_path)))
145        self.model_path = model_path
146        self.model_open = True
147
148
149    def new_model(self, new_model_path: Union[str, Path]) -> None:
150        """Creates new blank ETABS model and saves.
151
152        :param new_model_path: file path to save new blank ETABS model file
153        :type new_model_path: Union[str, Path]
154        """
155        handle(self.file.NewBlank())
156        handle(self.file.Save(str(new_model_path)))
157        self.model_path = new_model_path
158        self.model_open = True
159        
160        
161    def get_database_units(self) -> eUnits:
162        """Returns a value from the eUnits enumeration indicating the database units for the model.
163        All data is internally stored in the model in these units and converted to the present units as needed.
164
165        :raises EtabsError: Database units could not be returned
166        :return: Units enumeration
167        :rtype: eUnits
168        """
169        ret = self.sap_model.GetDatabaseUnits()
170        if ret == 0:
171            raise EtabsError(0, "Database units could not be returned.")
172        else:
173            return ret
174    
175    
176    def get_database_units_components(self) -> UnitsComponents:
177        """Retrieves the database units for the model.
178        All data is internally stored in the model in these units and converted to the present units as needed.
179
180        :return: units for force, length and temperature units
181        :rtype: UnitsComponents
182        """
183        force_units = eForce.NotApplicable
184        length_units = eLength.NotApplicable
185        temperature_units = eTemperature.NotApplicable
186        [ret, force_units, length_units, temperature_units] =  self.sap_model.GetDatabaseUnits_2(force_units, length_units, temperature_units)
187        handle(ret)
188        return {'force_units': force_units,
189                'length_units': length_units,
190                'temperature_units': temperature_units}
191
192
193    def get_model_is_locked(self) -> bool:
194        """Retrieves locked status of the model.
195
196        :return: True if model is looked, otherwise False
197        :rtype: bool
198        """
199        return self.sap_model.GetModelIsLocked()
200    
201    
202    def get_present_coord_system(self) -> str:
203        """Retrieves model present coordinate system.
204
205        :return: name of coordinate system
206        :rtype: str
207        """
208        return self.sap_model.GetPresentCoordSystem()
209    
210    
211    def get_present_units(self) -> eUnits:
212        """Returns a value from the eUnits enumeration indicating the units presently specified for the model.
213
214        :raises EtabsError: Present units could not be returned
215        :return: Units enumeration
216        :rtype: eUnits
217        """
218        ret = self.sap_model.GetPresentUnits()
219        if ret == 0:
220            raise EtabsError(0, "Present units could not be returned.")
221        else:
222            return ret
223
224
225    def get_present_units_components(self) -> UnitsComponents:
226        """Retrieves the units presently specified for the model.
227
228        :return: units components for force, length and temperature units
229        :rtype: UnitsComponents
230        """
231        force_units = eForce.NotApplicable
232        length_units = eLength.NotApplicable
233        temperature_units = eTemperature.NotApplicable
234        [ret, force_units, length_units, temperature_units] =  self.sap_model.GetPresentUnits_2(force_units, length_units, temperature_units)
235        handle(ret)
236        return {'force_units': force_units,
237                'length_units': length_units,
238                'temperature_units': temperature_units}
239        
240        
241    def set_model_is_locked(self, lock_it : bool = True):
242        """Locks or unlocks the model.
243
244        :param lock_it: True to lock mode, False to unlock, defaults to True
245        :type lock_it: bool, optional
246        """
247        handle(self.sap_model.SetModelIsLocked(lock_it))
248    
249    
250    def set_present_units(self, units : eUnits):
251        """Sets the display (present) units.
252
253        :param units: Units enumeration to set.
254        :type units: eUnits
255        """
256        handle(self.sap_model.SetPresentUnits(units))
257        
258        
259    def set_present_units_components(self, force_units : eForce, length_units : eLength, temperature_units : eTemperature):
260        """Specifies the units for the model.
261
262        :param force_units: Force enumeration to set
263        :type force_units: eForce
264        :param length_units: Length enumeration to set
265        :type length_units: eLength
266        :param temperature_units: Temperature enumeration to set
267        :type temperature_units: eTemperature
268        """
269        handle(self.sap_model.SetPresentUnits_2(force_units, length_units, temperature_units))
class EtabsModel:
 28class EtabsModel():
 29    """pytabs ETABS Model Object `EtabsObject` 🏢. 
 30    
 31    All interfaces and enumerations to the Etabs model objects are accessed as properties - refer below.
 32    
 33    """
 34    def __init__(self,
 35                 attach_to_instance : bool = True,
 36                 specific_etabs : bool = True,
 37                 specific_etabs_path : Union[str, Path] = default_etabs_exe_path,
 38                 model_path : Union[str, Path] = '',
 39                 remote_computer : str = '') -> None:
 40        
 41        # relate ETABS interfaces
 42        self.pier_label : PierLabel
 43        """EtabsModel `PierLabel` interface."""
 44        self.analysis_results : AnalysisResults
 45        """EtabsModel `AnalysisResults` interface."""
 46        self.load_cases : LoadCases
 47        """EtabsModel `LoadCases` interface."""
 48        self.resp_combo : RespCombo
 49        """EtabsModel `RespCombo` interface."""
 50        self.story : Story
 51        """EtabsModel `Story` interface."""
 52        
 53        # relate ETABS fixed enumerations
 54        self.eUnits = eUnits
 55        """EtabsModel `Units` enumeration."""
 56        self.eForce = eForce
 57        """EtabsModel `Force` enumeration."""
 58        self.eLength = eLength
 59        """EtabsModel `Length` enumeration."""
 60        self.eTemperature = eTemperature
 61        """EtabsModel `Temperature` enumeration."""
 62        self.eLoadCaseType = eLoadCaseType
 63        """EtabsModel `LoadCaseType` enumeration"""
 64        
 65        # EtabsModel initial properties
 66        self.active : bool = False
 67        """`True` if EtabsModel is active, otherwise `False`."""
 68        self.model_open : bool = False
 69        """`True` if model open, otherwise `False`."""
 70        self.model_path : Union[str, Path] = ''
 71        """Etabs model filepath."""
 72        
 73        # create ETABS API helper interface and try to initialise EtabsObject
 74        helper = cHelper(Helper())
 75        if attach_to_instance:
 76            #attach to a running instance of ETABS
 77            try:
 78                #get the active ETABS object        
 79                if remote_computer:
 80                    self.etabs_object = cOAPI(helper.GetObjectHost(remote_computer, "CSI.ETABS.API.ETABSObject"))
 81                else:
 82                    self.etabs_object = cOAPI(helper.GetObject("CSI.ETABS.API.ETABSObject"))
 83                self.active = True
 84            except:
 85                raise EtabsError(-1, "No running instance ETABS found or failed to attach.")
 86        else:
 87            if specific_etabs:
 88                try:
 89                    #'create an instance of the ETABS object from the specified path
 90                    if remote_computer:
 91                        self.etabs_object = cOAPI(helper.CreateObjectHost(remote_computer, str(specific_etabs_path)))
 92                    else:
 93                        self.etabs_object = cOAPI(helper.CreateObject(str(specific_etabs_path)))
 94                    self.active = True
 95                except :
 96                    raise EtabsError(-1, f"Cannot start a new instance of the ETABS from {str(specific_etabs_path)}")
 97            else:
 98                try: 
 99                    #create an instance of the ETABS object from the latest installed ETABS
100                    if remote_computer:
101                        self.etabs_object = cOAPI(helper.CreateObjectProgIDHost(remote_computer, "CSI.ETABS.API.ETABSObject"))
102                    else:
103                        self.etabs_object = cOAPI(helper.CreateObjectProgID("CSI.ETABS.API.ETABSObject"))
104                    self.active = True
105                except:
106                    raise EtabsError(-1, "Cannot start a new instance of ETABS.")
107            # start etabs application
108            self.etabs_object.ApplicationStart()
109        
110        # if EtabsObject active 
111        if self.active:
112            # create SapModel interface
113            self.sap_model = cSapModel(self.etabs_object.SapModel)
114            """EtabsModel `SapModel` interface."""
115            # create File interface
116            self.file = cFile(self.sap_model.File)
117            
118            # relate external pyTABS interfaces
119            self.pier_label = PierLabel(self.sap_model)
120            self.analysis_results = AnalysisResults(self.sap_model)
121            self.load_cases = LoadCases(self.sap_model)
122            self.resp_combo = RespCombo(self.sap_model)
123            self.story = Story(self.sap_model)
124            
125            # if not attached to instance and model path supplied open model
126            if (not attach_to_instance) and model_path:
127                self.open_model(model_path)
128
129
130    def exit_application(self):
131        '''Terminates ETABS application severing API connection'''
132        self.etabs_object.ApplicationExit(False)
133        self.model_open = False
134        self.model_path = ''
135        self.sap_model = None
136        self.active = False
137
138
139    def open_model(self, model_path: Union[str, Path]) -> None:
140        """Opens ETABS model file.
141
142        :param model_path: file path to ETABS model file
143        :type model_path: Union[str, Path]
144        """
145        handle(self.file.OpenFile(str(model_path)))
146        self.model_path = model_path
147        self.model_open = True
148
149
150    def new_model(self, new_model_path: Union[str, Path]) -> None:
151        """Creates new blank ETABS model and saves.
152
153        :param new_model_path: file path to save new blank ETABS model file
154        :type new_model_path: Union[str, Path]
155        """
156        handle(self.file.NewBlank())
157        handle(self.file.Save(str(new_model_path)))
158        self.model_path = new_model_path
159        self.model_open = True
160        
161        
162    def get_database_units(self) -> eUnits:
163        """Returns a value from the eUnits enumeration indicating the database units for the model.
164        All data is internally stored in the model in these units and converted to the present units as needed.
165
166        :raises EtabsError: Database units could not be returned
167        :return: Units enumeration
168        :rtype: eUnits
169        """
170        ret = self.sap_model.GetDatabaseUnits()
171        if ret == 0:
172            raise EtabsError(0, "Database units could not be returned.")
173        else:
174            return ret
175    
176    
177    def get_database_units_components(self) -> UnitsComponents:
178        """Retrieves the database units for the model.
179        All data is internally stored in the model in these units and converted to the present units as needed.
180
181        :return: units for force, length and temperature units
182        :rtype: UnitsComponents
183        """
184        force_units = eForce.NotApplicable
185        length_units = eLength.NotApplicable
186        temperature_units = eTemperature.NotApplicable
187        [ret, force_units, length_units, temperature_units] =  self.sap_model.GetDatabaseUnits_2(force_units, length_units, temperature_units)
188        handle(ret)
189        return {'force_units': force_units,
190                'length_units': length_units,
191                'temperature_units': temperature_units}
192
193
194    def get_model_is_locked(self) -> bool:
195        """Retrieves locked status of the model.
196
197        :return: True if model is looked, otherwise False
198        :rtype: bool
199        """
200        return self.sap_model.GetModelIsLocked()
201    
202    
203    def get_present_coord_system(self) -> str:
204        """Retrieves model present coordinate system.
205
206        :return: name of coordinate system
207        :rtype: str
208        """
209        return self.sap_model.GetPresentCoordSystem()
210    
211    
212    def get_present_units(self) -> eUnits:
213        """Returns a value from the eUnits enumeration indicating the units presently specified for the model.
214
215        :raises EtabsError: Present units could not be returned
216        :return: Units enumeration
217        :rtype: eUnits
218        """
219        ret = self.sap_model.GetPresentUnits()
220        if ret == 0:
221            raise EtabsError(0, "Present units could not be returned.")
222        else:
223            return ret
224
225
226    def get_present_units_components(self) -> UnitsComponents:
227        """Retrieves the units presently specified for the model.
228
229        :return: units components for force, length and temperature units
230        :rtype: UnitsComponents
231        """
232        force_units = eForce.NotApplicable
233        length_units = eLength.NotApplicable
234        temperature_units = eTemperature.NotApplicable
235        [ret, force_units, length_units, temperature_units] =  self.sap_model.GetPresentUnits_2(force_units, length_units, temperature_units)
236        handle(ret)
237        return {'force_units': force_units,
238                'length_units': length_units,
239                'temperature_units': temperature_units}
240        
241        
242    def set_model_is_locked(self, lock_it : bool = True):
243        """Locks or unlocks the model.
244
245        :param lock_it: True to lock mode, False to unlock, defaults to True
246        :type lock_it: bool, optional
247        """
248        handle(self.sap_model.SetModelIsLocked(lock_it))
249    
250    
251    def set_present_units(self, units : eUnits):
252        """Sets the display (present) units.
253
254        :param units: Units enumeration to set.
255        :type units: eUnits
256        """
257        handle(self.sap_model.SetPresentUnits(units))
258        
259        
260    def set_present_units_components(self, force_units : eForce, length_units : eLength, temperature_units : eTemperature):
261        """Specifies the units for the model.
262
263        :param force_units: Force enumeration to set
264        :type force_units: eForce
265        :param length_units: Length enumeration to set
266        :type length_units: eLength
267        :param temperature_units: Temperature enumeration to set
268        :type temperature_units: eTemperature
269        """
270        handle(self.sap_model.SetPresentUnits_2(force_units, length_units, temperature_units))

pytabs ETABS Model Object EtabsObject 🏢.

All interfaces and enumerations to the Etabs model objects are accessed as properties - refer below.

EtabsModel( attach_to_instance: bool = True, specific_etabs: bool = True, specific_etabs_path: Union[str, pathlib.Path] = WindowsPath('C:/Program Files/Computers and Structures/ETABS 20/ETABS.exe'), model_path: Union[str, pathlib.Path] = '', remote_computer: str = '')
 34    def __init__(self,
 35                 attach_to_instance : bool = True,
 36                 specific_etabs : bool = True,
 37                 specific_etabs_path : Union[str, Path] = default_etabs_exe_path,
 38                 model_path : Union[str, Path] = '',
 39                 remote_computer : str = '') -> None:
 40        
 41        # relate ETABS interfaces
 42        self.pier_label : PierLabel
 43        """EtabsModel `PierLabel` interface."""
 44        self.analysis_results : AnalysisResults
 45        """EtabsModel `AnalysisResults` interface."""
 46        self.load_cases : LoadCases
 47        """EtabsModel `LoadCases` interface."""
 48        self.resp_combo : RespCombo
 49        """EtabsModel `RespCombo` interface."""
 50        self.story : Story
 51        """EtabsModel `Story` interface."""
 52        
 53        # relate ETABS fixed enumerations
 54        self.eUnits = eUnits
 55        """EtabsModel `Units` enumeration."""
 56        self.eForce = eForce
 57        """EtabsModel `Force` enumeration."""
 58        self.eLength = eLength
 59        """EtabsModel `Length` enumeration."""
 60        self.eTemperature = eTemperature
 61        """EtabsModel `Temperature` enumeration."""
 62        self.eLoadCaseType = eLoadCaseType
 63        """EtabsModel `LoadCaseType` enumeration"""
 64        
 65        # EtabsModel initial properties
 66        self.active : bool = False
 67        """`True` if EtabsModel is active, otherwise `False`."""
 68        self.model_open : bool = False
 69        """`True` if model open, otherwise `False`."""
 70        self.model_path : Union[str, Path] = ''
 71        """Etabs model filepath."""
 72        
 73        # create ETABS API helper interface and try to initialise EtabsObject
 74        helper = cHelper(Helper())
 75        if attach_to_instance:
 76            #attach to a running instance of ETABS
 77            try:
 78                #get the active ETABS object        
 79                if remote_computer:
 80                    self.etabs_object = cOAPI(helper.GetObjectHost(remote_computer, "CSI.ETABS.API.ETABSObject"))
 81                else:
 82                    self.etabs_object = cOAPI(helper.GetObject("CSI.ETABS.API.ETABSObject"))
 83                self.active = True
 84            except:
 85                raise EtabsError(-1, "No running instance ETABS found or failed to attach.")
 86        else:
 87            if specific_etabs:
 88                try:
 89                    #'create an instance of the ETABS object from the specified path
 90                    if remote_computer:
 91                        self.etabs_object = cOAPI(helper.CreateObjectHost(remote_computer, str(specific_etabs_path)))
 92                    else:
 93                        self.etabs_object = cOAPI(helper.CreateObject(str(specific_etabs_path)))
 94                    self.active = True
 95                except :
 96                    raise EtabsError(-1, f"Cannot start a new instance of the ETABS from {str(specific_etabs_path)}")
 97            else:
 98                try: 
 99                    #create an instance of the ETABS object from the latest installed ETABS
100                    if remote_computer:
101                        self.etabs_object = cOAPI(helper.CreateObjectProgIDHost(remote_computer, "CSI.ETABS.API.ETABSObject"))
102                    else:
103                        self.etabs_object = cOAPI(helper.CreateObjectProgID("CSI.ETABS.API.ETABSObject"))
104                    self.active = True
105                except:
106                    raise EtabsError(-1, "Cannot start a new instance of ETABS.")
107            # start etabs application
108            self.etabs_object.ApplicationStart()
109        
110        # if EtabsObject active 
111        if self.active:
112            # create SapModel interface
113            self.sap_model = cSapModel(self.etabs_object.SapModel)
114            """EtabsModel `SapModel` interface."""
115            # create File interface
116            self.file = cFile(self.sap_model.File)
117            
118            # relate external pyTABS interfaces
119            self.pier_label = PierLabel(self.sap_model)
120            self.analysis_results = AnalysisResults(self.sap_model)
121            self.load_cases = LoadCases(self.sap_model)
122            self.resp_combo = RespCombo(self.sap_model)
123            self.story = Story(self.sap_model)
124            
125            # if not attached to instance and model path supplied open model
126            if (not attach_to_instance) and model_path:
127                self.open_model(model_path)

EtabsModel PierLabel interface.

EtabsModel AnalysisResults interface.

EtabsModel LoadCases interface.

EtabsModel RespCombo interface.

EtabsModel Story interface.

eUnits

EtabsModel Units enumeration.

eForce

EtabsModel Force enumeration.

eLength

EtabsModel Length enumeration.

eTemperature

EtabsModel Temperature enumeration.

eLoadCaseType

EtabsModel LoadCaseType enumeration

active: bool

True if EtabsModel is active, otherwise False.

model_open: bool

True if model open, otherwise False.

model_path: Union[str, pathlib.Path]

Etabs model filepath.

def exit_application(self):
130    def exit_application(self):
131        '''Terminates ETABS application severing API connection'''
132        self.etabs_object.ApplicationExit(False)
133        self.model_open = False
134        self.model_path = ''
135        self.sap_model = None
136        self.active = False

Terminates ETABS application severing API connection

def open_model(self, model_path: Union[str, pathlib.Path]) -> None:
139    def open_model(self, model_path: Union[str, Path]) -> None:
140        """Opens ETABS model file.
141
142        :param model_path: file path to ETABS model file
143        :type model_path: Union[str, Path]
144        """
145        handle(self.file.OpenFile(str(model_path)))
146        self.model_path = model_path
147        self.model_open = True

Opens ETABS model file.

Parameters
  • model_path: file path to ETABS model file
def new_model(self, new_model_path: Union[str, pathlib.Path]) -> None:
150    def new_model(self, new_model_path: Union[str, Path]) -> None:
151        """Creates new blank ETABS model and saves.
152
153        :param new_model_path: file path to save new blank ETABS model file
154        :type new_model_path: Union[str, Path]
155        """
156        handle(self.file.NewBlank())
157        handle(self.file.Save(str(new_model_path)))
158        self.model_path = new_model_path
159        self.model_open = True

Creates new blank ETABS model and saves.

Parameters
  • new_model_path: file path to save new blank ETABS model file
def get_database_units(self) -> ETABSv1.eUnits:
162    def get_database_units(self) -> eUnits:
163        """Returns a value from the eUnits enumeration indicating the database units for the model.
164        All data is internally stored in the model in these units and converted to the present units as needed.
165
166        :raises EtabsError: Database units could not be returned
167        :return: Units enumeration
168        :rtype: eUnits
169        """
170        ret = self.sap_model.GetDatabaseUnits()
171        if ret == 0:
172            raise EtabsError(0, "Database units could not be returned.")
173        else:
174            return ret

Returns a value from the eUnits enumeration indicating the database units for the model. All data is internally stored in the model in these units and converted to the present units as needed.

Raises
  • EtabsError: Database units could not be returned
Returns

Units enumeration

def get_database_units_components(self) -> pytabs.model.UnitsComponents:
177    def get_database_units_components(self) -> UnitsComponents:
178        """Retrieves the database units for the model.
179        All data is internally stored in the model in these units and converted to the present units as needed.
180
181        :return: units for force, length and temperature units
182        :rtype: UnitsComponents
183        """
184        force_units = eForce.NotApplicable
185        length_units = eLength.NotApplicable
186        temperature_units = eTemperature.NotApplicable
187        [ret, force_units, length_units, temperature_units] =  self.sap_model.GetDatabaseUnits_2(force_units, length_units, temperature_units)
188        handle(ret)
189        return {'force_units': force_units,
190                'length_units': length_units,
191                'temperature_units': temperature_units}

Retrieves the database units for the model. All data is internally stored in the model in these units and converted to the present units as needed.

Returns

units for force, length and temperature units

def get_model_is_locked(self) -> bool:
194    def get_model_is_locked(self) -> bool:
195        """Retrieves locked status of the model.
196
197        :return: True if model is looked, otherwise False
198        :rtype: bool
199        """
200        return self.sap_model.GetModelIsLocked()

Retrieves locked status of the model.

Returns

True if model is looked, otherwise False

def get_present_coord_system(self) -> str:
203    def get_present_coord_system(self) -> str:
204        """Retrieves model present coordinate system.
205
206        :return: name of coordinate system
207        :rtype: str
208        """
209        return self.sap_model.GetPresentCoordSystem()

Retrieves model present coordinate system.

Returns

name of coordinate system

def get_present_units(self) -> ETABSv1.eUnits:
212    def get_present_units(self) -> eUnits:
213        """Returns a value from the eUnits enumeration indicating the units presently specified for the model.
214
215        :raises EtabsError: Present units could not be returned
216        :return: Units enumeration
217        :rtype: eUnits
218        """
219        ret = self.sap_model.GetPresentUnits()
220        if ret == 0:
221            raise EtabsError(0, "Present units could not be returned.")
222        else:
223            return ret

Returns a value from the eUnits enumeration indicating the units presently specified for the model.

Raises
  • EtabsError: Present units could not be returned
Returns

Units enumeration

def get_present_units_components(self) -> pytabs.model.UnitsComponents:
226    def get_present_units_components(self) -> UnitsComponents:
227        """Retrieves the units presently specified for the model.
228
229        :return: units components for force, length and temperature units
230        :rtype: UnitsComponents
231        """
232        force_units = eForce.NotApplicable
233        length_units = eLength.NotApplicable
234        temperature_units = eTemperature.NotApplicable
235        [ret, force_units, length_units, temperature_units] =  self.sap_model.GetPresentUnits_2(force_units, length_units, temperature_units)
236        handle(ret)
237        return {'force_units': force_units,
238                'length_units': length_units,
239                'temperature_units': temperature_units}

Retrieves the units presently specified for the model.

Returns

units components for force, length and temperature units

def set_model_is_locked(self, lock_it: bool = True):
242    def set_model_is_locked(self, lock_it : bool = True):
243        """Locks or unlocks the model.
244
245        :param lock_it: True to lock mode, False to unlock, defaults to True
246        :type lock_it: bool, optional
247        """
248        handle(self.sap_model.SetModelIsLocked(lock_it))

Locks or unlocks the model.

Parameters
  • lock_it: True to lock mode, False to unlock, defaults to True
def set_present_units(self, units: ETABSv1.eUnits):
251    def set_present_units(self, units : eUnits):
252        """Sets the display (present) units.
253
254        :param units: Units enumeration to set.
255        :type units: eUnits
256        """
257        handle(self.sap_model.SetPresentUnits(units))

Sets the display (present) units.

Parameters
  • units: Units enumeration to set.
def set_present_units_components( self, force_units: ETABSv1.eForce, length_units: ETABSv1.eLength, temperature_units: ETABSv1.eTemperature):
260    def set_present_units_components(self, force_units : eForce, length_units : eLength, temperature_units : eTemperature):
261        """Specifies the units for the model.
262
263        :param force_units: Force enumeration to set
264        :type force_units: eForce
265        :param length_units: Length enumeration to set
266        :type length_units: eLength
267        :param temperature_units: Temperature enumeration to set
268        :type temperature_units: eTemperature
269        """
270        handle(self.sap_model.SetPresentUnits_2(force_units, length_units, temperature_units))

Specifies the units for the model.

Parameters
  • force_units: Force enumeration to set
  • length_units: Length enumeration to set
  • temperature_units: Temperature enumeration to set