Skip to content

Commit

Permalink
database example added
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchell-tesch committed Mar 13, 2024
1 parent 44847ed commit 115f22a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 36 deletions.
52 changes: 26 additions & 26 deletions examples/PyTABS_LinkSpringProp/excel_index.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
# Workbook indexing of multi-linear elastic links

WB_FILE = 'XX-XX-CA-ST-Perimeter Wall P-Y Curves-240308.xlsx'
WB_FILE = r"D:\dev\pytabs\examples\PyTABS_LinkSpringProp\XX-XX-CA-ST-Perimeter Wall P-Y Curves-240308.xlsx"
WB_SHEET = 'SUMMARY'
TABLE_RANGES = {'PW_GA_NESW_3.5_2.5': 'C62',
'PW_HF_NESW_3.5_-3.5': 'C84',
'PW_MS_NESW_3.5_-4.5': 'C107',
'PW_MS_W_3.5_-2': 'C130',
'PW_TA_NE_-2.5_-4': 'C153',
'PW_TA_NE_-4_-6': 'C175',
'PW_TA_NE_-8_-9': 'C197',
'PW_TA_NE_-9_-10': 'C219',
'PW_TA_NE_-10_-11': 'C241',
'PW_TA_NE_-12_': 'C263',
'PW_TA_S_-5.5_-6': 'C286',
'PW_TA_S_-8_-9': 'C309',
'PW_TA_S_-9_-10': 'C332',
'PW_TA_S_-10_-11': 'C355',
'PW_TA_S_-11_-12': 'C377',
'PW_TA_S_-12_-13': 'C399',
'PW_TA_S_-13_': 'C421',
'PW_TA_W_-2.5_-3.5': 'C444',
'PW_TA_W_-3.5_-4.5': 'C467',
'PW_TA_W_-4.5_-6': 'C490',
'PW_TA_W_-8_-9': 'C512',
'PW_TA_W_-9_-10': 'C534',
'PW_TA_W_-10_-11.5': 'C556',
'PW_TA_NEW_-6_-8': 'C577',
'PW_TA_S_-6_-8': 'C598',
TABLE_RANGES = {'PW_GA_NESW_3.5|2.5': 'C62',
'PW_HF_NESW_3.5|-3.5': 'C84',
'PW_MS_NESW_3.5|-4.5': 'C107',
'PW_MS_W_3.5|-2': 'C130',
'PW_TA_NE_-2.5|-4': 'C153',
'PW_TA_NE_-4|-6': 'C175',
'PW_TA_NE_-8|-9': 'C197',
'PW_TA_NE_-9|-10': 'C219',
'PW_TA_NE_-10|-11': 'C241',
'PW_TA_NE_-12|': 'C263',
'PW_TA_S_-5.5|-6': 'C286',
'PW_TA_S_-8|-9': 'C309',
'PW_TA_S_-9|-10': 'C332',
'PW_TA_S_-10|-11': 'C355',
'PW_TA_S_-11|-12': 'C377',
'PW_TA_S_-12|-13': 'C399',
'PW_TA_S_-13|': 'C421',
'PW_TA_W_-2.5|-3.5': 'C444',
'PW_TA_W_-3.5|-4.5': 'C467',
'PW_TA_W_-4.5|-6': 'C490',
'PW_TA_W_-8|-9': 'C512',
'PW_TA_W_-9|-10': 'C534',
'PW_TA_W_-10|-11.5': 'C556',
'PW_TA_NEW_-6|-8': 'C577',
'PW_TA_S_-6|-8': 'C598',
}
17 changes: 7 additions & 10 deletions examples/PyTABS_LinkSpringProp/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
TRIB_AREA = 1.2






def main():
input_data = extract_excel_inputs()

Expand All @@ -24,7 +20,7 @@ def main():

for prop_data in input_data:
prop_base_name = prop_data['name']

prop_set = [{'name': f'{prop_base_name}_{UNIDIRECTIONAL_SUFFIX}',
'dof': [False, False, True, False, False, False],
'ml_axes': [etabs_model.property.link.eLinkDof.U3],
Expand Down Expand Up @@ -52,7 +48,7 @@ def main():
'delta_values': uni_to_bidirectional(prop_data['delta_values']),
},
]

# create each property in the prop set
for prop in prop_set:
# create multi linear elastic link property
Expand All @@ -63,7 +59,7 @@ def main():
ke=[0., 0., 0., 0., 0., 0.],
ce=[0., 0., 0., 0., 0., 0.],
dj2=0., dj3=0.)

# provide spring data to link property
etabs_model.property.link.set_spring_data(name=prop['name'], length=TRIB_LENGTH, area=TRIB_AREA)

Expand All @@ -79,7 +75,7 @@ def main():
stiffness=[0., 0., 0., 0.],
nonlinear_option_2=etabs_model.property.line_spring.eSpringNonlinearOption.LINEAR,
nonlinear_option_3=etabs_model.property.line_spring.eSpringNonlinearOption.LINEAR)

# get database table for link to line spring association
db_line_spring_table = etabs_model.database_tables.get_table_details('Spring Property Definitions - Line Springs')

Expand All @@ -104,11 +100,12 @@ def main():
db_edit_log = etabs_model.database_tables.apply_table_edits(True)
print(db_edit_log['import_log'])
etabs_model.database_tables.discard_table_edits()
print('')


def uni_to_bidirectional(values):
return [-v for v in values][:0:-1] + values


def extract_excel_inputs():
wb = xw.Book(wb_index.WB_FILE)
sheet = wb.sheets(wb_index.WB_SHEET)
Expand All @@ -127,4 +124,4 @@ def extract_excel_inputs():


if __name__ == '__main__':
main()
main()

0 comments on commit 115f22a

Please sign in to comment.