diff --git a/.gitignore b/.gitignore index 2778c7a..8aba3be 100644 --- a/.gitignore +++ b/.gitignore @@ -235,4 +235,5 @@ fabric.properties # Specific example files -examples/PyTABS_LinkSpringProp/XX-XX-CA-ST-Perimeter Wall P-Y Curves-240308.xlsx \ No newline at end of file +examples/PyTABS_LinkSpringProp/XX-XX-CA-ST-Perimeter Wall P-Y Curves-240308.xlsx +.etabs_test_models/ diff --git a/src/pytabs/analysis_results.py b/src/pytabs/analysis_results.py index e96028f..ff433ec 100644 --- a/src/pytabs/analysis_results.py +++ b/src/pytabs/analysis_results.py @@ -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) diff --git a/src/pytabs/analysis_results_setup.py b/src/pytabs/analysis_results_setup.py index cd4733f..0a2e768 100644 --- a/src/pytabs/analysis_results_setup.py +++ b/src/pytabs/analysis_results_setup.py @@ -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 @@ -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 @@ -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 diff --git a/src/pytabs/design_concrete.py b/src/pytabs/design_concrete.py new file mode 100644 index 0000000..df1e944 --- /dev/null +++ b/src/pytabs/design_concrete.py @@ -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 + diff --git a/src/pytabs/design_results.py b/src/pytabs/design_results.py new file mode 100644 index 0000000..5755344 --- /dev/null +++ b/src/pytabs/design_results.py @@ -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)} diff --git a/src/pytabs/model.py b/src/pytabs/model.py index 3344310..01f9242 100644 --- a/src/pytabs/model.py +++ b/src/pytabs/model.py @@ -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 @@ -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 @@ -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) diff --git a/tests/test_basic.py b/tests/test_basic.py index dcdf03d..29336bc 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -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()