Skip to content

Commit

Permalink
design results testing
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchell-tesch committed Aug 16, 2024
1 parent 0573dc3 commit 6953581
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -235,4 +235,5 @@ fabric.properties


# Specific example files
examples/PyTABS_LinkSpringProp/XX-XX-CA-ST-Perimeter Wall P-Y Curves-240308.xlsx
examples/PyTABS_LinkSpringProp/XX-XX-CA-ST-Perimeter Wall P-Y Curves-240308.xlsx
.etabs_test_models/
2 changes: 0 additions & 2 deletions src/pytabs/analysis_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,6 @@ class AnalysisResults:
def __init__(self, sap_model: etabs.cSapModel) -> None:
# link of SapModel interface
self.sap_model = sap_model
# create AnalysisResultsSetup interface
self.analysis_results_setup = etabs.cAnalysisResultsSetup(sap_model.Results.Setup)
# create AnalysisResults interface
self.analysis_results = etabs.cAnalysisResults(sap_model.Results)

Expand Down
7 changes: 4 additions & 3 deletions src/pytabs/analysis_results_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ def __init__(self, sap_model: etabs.cSapModel) -> None:
self.sap_model = sap_model
# create AnalysisResultsSetup interface
self.analysis_results_setup = etabs.cAnalysisResultsSetup(sap_model.Results.Setup)

# relate custom enumerations
self.eResultsSetupStepOutOption = eResultsSetupStepOutOption
self.eResultsSetupComboOutOption = eResultsSetupComboOutOption
Expand All @@ -36,7 +35,8 @@ def get_case_selected_for_output(self, case_name: str) -> bool:
:return: `True` if the Case selected for output, `False` otherwise
:rtype: bool
"""
[ret, selected] = self.analysis_results_setup.GetCaseSelectedForOutput(case_name)
selected = bool()
[ret, selected] = self.analysis_results_setup.GetCaseSelectedForOutput(case_name, selected)
handle(ret)
return selected

Expand All @@ -48,7 +48,8 @@ def get_combo_selected_for_output(self, combo_name: str) -> bool:
:return: `True` if the Combination selected for output, `False` otherwise
:rtype: bool
"""
[ret, selected] = self.analysis_results_setup.GetComboSelectedForOutput(combo_name)
selected = bool()
[ret, selected] = self.analysis_results_setup.GetComboSelectedForOutput(combo_name, selected)
handle(ret)
return selected

Expand Down
27 changes: 27 additions & 0 deletions src/pytabs/design_concrete.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# PyTABS - ETABS .NET API python wrapper
# DesignConcrete - cDesignConcrete interface
__all__ = ['DesignConcrete']

# import ETABS namespace and pyTABS error handler
from .etabs_config import etabs
from .error_handle import handle

# import custom enumerations

# import typing
from typing import TypedDict


class DesignConcrete:
"""DesignConcrete interface"""

def __init__(self, sap_model: etabs.cSapModel) -> None:
# link of SapModel interface
self.sap_model = sap_model
# create DesignConcrete interface
self.design_concrete= etabs.cDesignConcrete(sap_model.DesignConcrete)

# relate custom enumerations

# Design Concrete Methods

73 changes: 73 additions & 0 deletions src/pytabs/design_results.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# PyTABS - ETABS .NET API python wrapper
# DesignResults - cDesignResults interface
__all__ = ['DesignForces']

# import ETABS namespace and pyTABS error handler
from .etabs_config import etabs
from .error_handle import handle

# import custom enumerations

# import typing
from typing import TypedDict


class BeamDesignForce(TypedDict):
"""TypedDict class for beam_design_force return"""
number_results: int
frame_name: list[str]
combo_name: list[str]
station: list[float]
axial: list[float]
shear_2: list[float]
shear_3: list[float]
torsion: list[float]
moment_2: list[float]
moment_3: list[float]


class DesignResults:
"""DesignForcesResults interface"""

def __init__(self, sap_model: etabs.cSapModel) -> None:
# link of SapModel interface
self.sap_model = sap_model
# create DesignResults interface
self.design_forces = etabs.cDesignForces(sap_model.DesignResults.DesignForces)

# relate custom enumerations
# self.eResultsSetupStepOutOption = eResultsSetupStepOutOption
# self.eResultsSetupComboOutOption = eResultsSetupComboOutOption

# Design Results Methods
def beam_design_forces(self, name: str, item_type_element: etabs.eItemType) -> BeamDesignForce:
number_results = int()
frame_name = [str()]
combo_name = [str()]
station = [float()]
axial = [float()]
shear_2 = [float()]
shear_3 = [float()]
torsion = [float()]
moment_2 = [float()]
moment_3 = [float()]

[ret, number_results, frame_name,
combo_name,station,
axial, shear_2, shear_3,
torsion, moment_2, moment_3] = self.design_forces.BeamDesignForces(name, number_results, frame_name,
combo_name,station,
axial, shear_2, shear_3,
torsion, moment_2, moment_3,
item_type_element)
handle(ret)
return {'number_results': number_results,
'frame_name': list(frame_name),
'combo_name': list(combo_name),
'station': list(station),
'axial': list(axial),
'shear_2': list(shear_2),
'shear_3': list(shear_3),
'torsion': list(torsion),
'moment_2': list(moment_2),
'moment_3': list(moment_3)}
4 changes: 4 additions & 0 deletions src/pytabs/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from .combo import Combo
from .constraint import Constraint
from .database_tables import DatabaseTables
from .design_results import DesignResults
from .diaphragm import Diaphragm
from .frame_obj import FrameObj
from .grid_sys import GridSys
Expand Down Expand Up @@ -82,6 +83,8 @@ def __init__(self,
"""EtabsModel `Constraint` interface."""
self.database_tables: DatabaseTables
"""EtabsModel `DatabaseTables` interface."""
self.design_results: DesignResults
"""EtabsModel `DesignResults` interface."""
self.diaphragm: Diaphragm
"""EtabsModel `Diaphragm` interface."""
self.frame_obj: FrameObj
Expand Down Expand Up @@ -211,6 +214,7 @@ def __init__(self,
self.combo = Combo(self.sap_model)
self.constraint = Constraint(self.sap_model)
self.database_tables = DatabaseTables(self.sap_model)
self.design_results = DesignResults(self.sap_model)
self.diaphragm = Diaphragm(self.sap_model)
self.frame_obj = FrameObj(self.sap_model)
self.grid_sys = GridSys(self.sap_model)
Expand Down
16 changes: 12 additions & 4 deletions tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@


def main():
# substantiate pyTABS EtabsModel
etabs_model = pytabs.EtabsModel()

stories = etabs_model.story.get_stories()

print(stories)
etabs_model.analysis_results_setup.deselect_all_cases_combos_for_output()

combos = etabs_model.combo.get_name_list()
# select all combos
for combo in combos:
etabs_model.analysis_results_setup.set_combo_selected_for_output(combo)
# check selection of combos
for combo in combos:
check_status = etabs_model.analysis_results_setup.get_combo_selected_for_output(combo)
print(check_status)

# get beam design forces
beam_design_forces = etabs_model.design_results.beam_design_forces('541', etabs_model.eItemType.Objects)

if __name__ == "__main__":
main()

0 comments on commit 6953581

Please sign in to comment.