refine material structure for yield strength and get data as entered

This commit is contained in:
2019-02-10 20:45:55 +01:00
parent 9e0ccab871
commit dd8b70334e
3 changed files with 30 additions and 20 deletions

View File

@@ -180,9 +180,9 @@ def main():
parser_get.add_argument('-E', '--E', dest='const_collection',
action='append_const', const="E",
help='get Young\'s modulus, module of elasticity')
parser_get.add_argument('-R', '--R_p02', dest='const_collection',
action='append_const', const="R_p02",
help='get yield strength R_e, R_{p0.2}')
parser_get.add_argument('-R', '--R_p', dest='const_collection',
action='append_const', const="R_p",
help='get yield strength R_p')
parser_get.add_argument('--R_m', dest='const_collection',
action='append_const', const="R_m",
help='get ultimate tensile strength R_m')
@@ -207,18 +207,20 @@ def main():
if args.const_collection:
data = load_material(args.materialname)
if args.debug:
print("data: " + data)
if "rho" in args.const_collection:
#args.const_collection.append("rho(T)")
#f args.debug:
# print(args)
print_quantity(data['Mechanical Properties']['rho'])
if "E" in args.const_collection:
print_quantity(data['Mechanical Properties']['E'])
if "R_p02" in args.const_collection:
print_quantity(data['Mechanical Properties']['R_p02'])
if "R_m" in args.const_collection:
print_quantity(data['Mechanical Properties']['R_m'])
print("data:")
print_material(data)
for element in args.const_collection: # iter the way it is been entered as args
if element == "rho":
print_quantity(data['Mechanical Properties']['rho'])
elif element == "E":
print_quantity(data['Mechanical Properties']['E'])
elif element == "R_p":
if len(data['Mechanical Properties']['Yield strength']) == 1:
print_quantity(next(iter(data['Mechanical Properties']['Yield strength'].values())))
else:
print_quantity(data['Mechanical Properties']['Yield strength'])
elif element == "R_m":
print_quantity(data['Mechanical Properties']['R_m'])
elif args.search:
search_list = [element for element in args.search.split(',')]