Parsing FIL file with Python
Parsing FIL file with Python
(OP)
Hello all,
I am looking to access the .FIL file instead of going through the .ODB. The Abaqus documentation says that each entry is 8 bytes long whether it's a string, float, or integer.
I am trying to used the struct module to convert the binary. I am unsure what format to use to read 8 byte integers.
For a first step I am simply trying to print the record length and record type key - the first 16 bytes of each entry.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
import struct
sFileName = 'shellMeshStatic.fil'
f = open(sFileName,'rb')
for x in f.readlines():
q = struct.unpack('<qq',x[0:16])
print q, len(x)
f.close()
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
I seem to be getting garbage. Has anyone done this before? Any help would be great.
-Ryan
I am looking to access the .FIL file instead of going through the .ODB. The Abaqus documentation says that each entry is 8 bytes long whether it's a string, float, or integer.
I am trying to used the struct module to convert the binary. I am unsure what format to use to read 8 byte integers.
For a first step I am simply trying to print the record length and record type key - the first 16 bytes of each entry.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
import struct
sFileName = 'shellMeshStatic.fil'
f = open(sFileName,'rb')
for x in f.readlines():
q = struct.unpack('<qq',x[0:16])
print q, len(x)
f.close()
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
I seem to be getting garbage. Has anyone done this before? Any help would be great.
-Ryan





RE: Parsing FIL file with Python
www.Roshaz.com
RE: Parsing FIL file with Python
RE: Parsing FIL file with Python
I am writing some utilities to analyze post-buckling of stiffened panels. The models are generated as Nastran files from another code. I am trying to do the pre and post processing with a single IronPython application with a GUI interface designed using the (free) SharpDevelop IDE.
On johnhors suggestion, I am parsing the ascii file instead. It is pretty straightforward parse the ascii FIL since you can physically see how the data is patterned.
RE: Parsing FIL file with Python
TOP
CSWP, BSSE
www.engtran.com www.niswug.org
"Node news is good news."
RE: Parsing FIL file with Python
www.Roshaz.com
RE: Parsing FIL file with Python
I know that. But he was reading a binary file. Only a hex editor will let him see what is in it. I agree exporting as ascii makes a lot more sense.
TOP
CSWP, BSSE
www.engtran.com www.niswug.org
"Node news is good news."