calculix_postprocess.py
Go to the documentation of this file.00001 def get_sigini_values(sigini_input):
00002 input = open(sigini_input,"r")
00003 lines = input.readlines()
00004 lc = lines[1].split(",")
00005 ltc = lines[2].split(",")
00006 input.close()
00007 return lc,ltc
00008
00009
00010
00011 def calculix_postprocess(frd_input) :
00012 input = open(frd_input,"r")
00013 nodes_x = []
00014 nodes_y = []
00015 nodes_z = []
00016 disp_x = []
00017 disp_y = []
00018 disp_z = []
00019 displaced_nodes_x = []
00020 displaced_nodes_y = []
00021 displaced_nodes_z = []
00022
00023 disp_found = False
00024 nodes_found = True
00025 while True:
00026 line=input.readline()
00027 if not line: break
00028
00029 if nodes_found and (line[1:3] == "-1"):
00030 nodes_x.append(float(line[13:25]))
00031 nodes_y.append(float(line[25:37]))
00032 nodes_z.append(float(line[37:49]))
00033
00034 if line[5:9] == "DISP":
00035 disp_found = True
00036
00037 if disp_found and (line[1:3] == "-1"):
00038 disp_x.append(float(line[13:25]))
00039 disp_y.append(float(line[25:37]))
00040 disp_z.append(float(line[37:49]))
00041
00042 if line[1:3] == "-3":
00043
00044 disp_found = False
00045 nodes_found = False
00046
00047 input.close()
00048
00049
00050 for i in range(0,len(nodes_x)):
00051 displaced_nodes_x.append(nodes_x[i] + disp_x[i])
00052 displaced_nodes_y.append(nodes_y[i] + disp_y[i])
00053 displaced_nodes_z.append(nodes_z[i] + disp_z[i])
00054
00055
00056
00057 bbox_orig = (max(nodes_x)-min(nodes_x))*(max(nodes_y)-min(nodes_y))*(max(nodes_z)-min(nodes_z))
00058 bbox_distorted = (max(displaced_nodes_x)-min(displaced_nodes_x))*(max(displaced_nodes_y)-min(displaced_nodes_y))*(max(displaced_nodes_z)-min(displaced_nodes_z))
00059 relationship = bbox_orig/bbox_distorted*100
00060 max_disp_x = max(disp_x)
00061 min_disp_x = min(disp_x)
00062 max_disp_y = max(disp_y)
00063 min_disp_y = min(disp_y)
00064 max_disp_z = max(disp_z)
00065 min_disp_z = min(disp_z)
00066 return bbox_orig,bbox_distorted,relationship,max_disp_x,min_disp_x,max_disp_y,min_disp_y,max_disp_z,min_disp_z
00067
00068
00069