import os,sys,struct,zlib,re d=sys.argv[1] def txt(f): b=open(os.path.join(d,f),'rb').read(); nl,el=struct.unpack('=0 and j>i else [] last=rows[-1] if rows else ('','','','') k=t.find('Pressure profile:'); prof=re.findall(r'[\d.]+ s\s+([\d.]+)',t[k:k+600]) if k>=0 else [] yv=txt(s+'.yml.bin') if os.path.exists(os.path.join(d,s+'.yml.bin')) else '' nums=re.findall(r'-\s*([-\dEe.+]+)',yv) print(','.join([s,s.split('_')[1],g(t,r'Total number of part nodes\s*=\s*(\d+)'),g(t,r'Total number of elements\s*=\s*(\d+)'), g(t,r'Volume of tetrahedral elements\s*=\s*([\dE.+-]+)'),g(t,r'Melt temperature\s*=\s*([\d.]+)'),g(t,r'Mold temperature\s*=\s*([\d.]+)'), g(t,r'Fill time\s*=\s*([\d.]+) s'),g(t,r'Volume filled at velocity/pressure switch-over\s*=\s*([\d.]+)'), g(t,r'Time at velocity/pressure switch-over\s*=\s*([\d.]+)'),g(t,r'Injection pressure at velocity/pressure switch-over\s*=\s*([\dE.+-]+)'), last[1],last[3],last[2],str(max(map(float,prof))) if prof else '', str(bool(re.search(r'short shot|did not fill|not completely filled',t,re.I)))]+(nums[:6]+['']*6)[:6]))