Clear and concise
This code illustrates the readability of Python.
Compare reading these program statements to reading the text of AISC 15th Edition Manual, Section J3 (↓ at bottom of page).
def determine_lc_edge_gage_reqd(diameter_label, hole_class):
"""
***************************
diameter_label: for example 'H0750' for 3/4 inch diameter bolt
hole_class: one of these ['STD', 'OVS', 'SSLT', 'LSLT'] standard, oversize, short slot, long slot
***************************
"""
if hole_class not in ['STD', 'OVS', 'SSLT', 'LSLT']:
return [["invalid class: " + hole_class]]
global dbaischole15 # ‘database’ of AISC slots and holes
# dbaischole15 = V1415S.getallHolesAISC15() entire 'database'
# of slot and
# hole dimensions
debug = False
dhole = dbaischole15[diameter_label.upper()] # 'database' row for given diameter_label
dbolt = dhole.DIAMETER # bolt diameter for given diameter_label
# define 'func_C2' which calculates 'C2' values in AISC Table J3.5
def func_C2(db, hole_class):
'''
db: bolt diameter
hole_class: one of these ['STD', 'OVS', 'SSLT', 'LSLT']
'''
if db <= 0.875:
if hole_class == "STD":
return 0
elif hole_class == "OVS":
return 0.0625
elif hole_class == "SSLT":
return 0.125
elif hole_class == "LSLT":
return 0.75*db
elif db == 1:
if hole_class == "STD":
return 0
elif hole_class == "OVS":
return 0.125
elif hole_class == "SSLT":
return 0.125
elif hole_class == "LSLT":
return 0.75 * db
else:
if hole_class == "STD":
return 0
elif hole_class == "OVS":
return 0.125
elif hole_class == "SSLT":
return 0.1875
elif hole_class == "LSLT":
return 0.75*db
# AISC limits
c2c_clr_limit = dbolt # AISC limit -- clear distance between holes
c2c_gage_limit = 2.6666 * dbolt # AISC limit -- center to center of holes
c2e_limit = dhole.MIN_EDGE # AISC limit -- center of hole to edge of plate
# AISC C2 calculation
c2 = func_C2(dbolt, hole_class) # now call the c2 function
CCWidth = CCLength = CEWidth = CELength = 0 # initialization of return variables
# AISC slots have a width and a length
# CCWidth = center to center 'width' direction
# CCLength = center to center 'length' direction
# CEWidth = center to edge 'width' direction
# CELength = center to edge 'length' direction
try:
if hole_class == "STD":
c2c_clr_gage_min = c2c_clr_limit + dhole.STD # clear limit + hole diameter
c2c_gage_min = max(c2c_clr_gage_min, c2c_gage_limit) # determine our greatest minimum gage
CCWidth = c2c_gage_min
CCLength = c2c_gage_min
CEWidth = c2e_limit
CELength = c2e_limit
elif hole_class == "OVS":
c2c_clr_gage_min_W = c2c_clr_limit + dhole.OVS # clear limit + hole diameter
c2c_clr_gage_min_L = c2c_clr_limit + dhole.OVS # clear limit + hole diameter
c2c_gage_min_W = max(c2c_clr_gage_min_W, c2c_gage_limit) # determine our greatest minimum gage
c2c_gage_min_L = max(c2c_clr_gage_min_L, c2c_gage_limit) # determine our greatest minimum gage
CCWidth = c2c_gage_min_W
CCLength = c2c_gage_min_L
CEWidth = c2e_limit + c2
CELength = c2e_limit + c2
elif hole_class == "SSLT":
c2c_clr_gage_min_W = c2c_clr_limit + dhole.STD # clear limit + slot width
c2c_clr_gage_min_L = c2c_clr_limit + dhole.SSLOT # clear limit + slot length
c2c_gage_min_W = max(c2c_clr_gage_min_W, c2c_gage_limit) # determine our greatest minimum gage
c2c_gage_min_L = max(c2c_clr_gage_min_L, c2c_gage_limit) # determine our greatest minimum gage
CCWidth = c2c_gage_min_W
CCLength = c2c_gage_min_L
CEWidth = c2e_limit
CELength = c2e_limit + c2
elif hole_class == "LSLT":
c2c_clr_gage_min_W = c2c_clr_limit + dhole.STD # clear limit + slot width
c2c_clr_gage_min_L = c2c_clr_limit + dhole.LSLOT # clear limit + slot length
c2c_gage_min_W = max(c2c_clr_gage_min_W, c2c_gage_limit) # determine our greatest minimum gage
c2c_gage_min_L = max(c2c_clr_gage_min_L, c2c_gage_limit) # determine our greatest minimum gage
CCWidth = c2c_gage_min_W
CCLength = c2c_gage_min_L
CEWidth = c2e_limit
CELength = c2e_limit + c2
except:
pass
if CCWidth == 0:
return [["invalid result"]]
else:
ndigits = 2
return round(CCWidth, ndigits), round(CCLength, ndigits), round(CEWidth, ndigits), round(CELength, ndigits)
if __name__ == "__main__":
for ch in ['STD', 'OVS', 'SSLT', 'LSLT']:
print("\n", ch, "\n")
for d in ["H1500", "H1375", "H1250", "H1125", "H1000", "H0875", "H0750", "H0625", "H0500"]:
print(d, " ", determine_lc_edge_gage_reqd(d, ch))
Results from above Python function
Hole Class
diameter_label (CCWidth, CCLength, CEWidth, CELength)
# AISC slots have a width and a length
# CCWidth = center to center 'width' direction
# CCLength = center to center 'length' direction
# CEWidth = center to edge 'width' direction
# CELength = center to edge 'length' direction
STD
H1500 (4.0, 4.0, 1.88, 1.88)
H1375 (3.67, 3.67, 1.72, 1.72)
H1250 (3.33, 3.33, 1.62, 1.62)
H1125 (3.0, 3.0, 1.5, 1.5)
H1000 (2.67, 2.67, 1.25, 1.25)
H0875 (2.33, 2.33, 1.12, 1.12)
H0750 (2.0, 2.0, 1.0, 1.0)
# therefore
# 3/4 inch bolts (STD) could be placed at a 2” gage
# with a 1” centerline to edge dimension
H0625 (1.67, 1.67, 0.88, 0.88)
H0500 (1.33, 1.33, 0.75, 0.75)
OVS
H1500 (4.0, 4.0, 2.0, 2.0)
H1375 (3.67, 3.67, 1.84, 1.84)
H1250 (3.33, 3.33, 1.75, 1.75)
H1125 (3.0, 3.0, 1.62, 1.62)
H1000 (2.67, 2.67, 1.38, 1.38)
H0875 (2.33, 2.33, 1.19, 1.19)
H0750 (2.0, 2.0, 1.06, 1.06)
H0625 (1.67, 1.67, 0.94, 0.94)
H0500 (1.33, 1.33, 0.81, 0.81)
SSLT
H1500 (4.0, 4.0, 1.88, 2.06)
H1375 (3.67, 3.67, 1.72, 1.91)
H1250 (3.33, 3.33, 1.62, 1.81)
H1125 (3.0, 3.0, 1.5, 1.69)
H1000 (2.67, 2.67, 1.25, 1.38)
H0875 (2.33, 2.33, 1.12, 1.25)
H0750 (2.0, 2.0, 1.0, 1.12)
# therefore
# 3/4 inch bolts (short-slot) could be placed at a 2” gage
# with a 1” centerline to edge dimension (width)
# with a 1 1/8” centerline to edge dimension (length)
H0625 (1.67, 1.67, 0.88, 1.0)
H0500 (1.33, 1.33, 0.75, 0.88)
LSLT
H1500 (4.0, 5.25, 1.88, 3.0)
H1375 (3.67, 4.81, 1.72, 2.75)
H1250 (3.33, 4.38, 1.62, 2.56)
H1125 (3.0, 3.94, 1.5, 2.34)
H1000 (2.67, 3.5, 1.25, 2.0)
H0875 (2.33, 3.06, 1.12, 1.78)
H0750 (2.0, 2.62, 1.0, 1.56)
H0625 (1.67, 2.19, 0.88, 1.34)
H0500 (1.33, 1.75, 0.75, 1.12)



