pyNastran v0.6 is now released. pyNastran is a free open-source Python wrapper for the Nastran BDF, OP2, and OP4.
The BDF Reader supports roughly 220 cards and links them together in order to make it easier to access. An example:
>>> bdf = BDF()
>>> bdf.read_bdf(bdf_filename_in)
>>> node2 = bdf.nodes[2]
>>> print node2
GRID 1 120.322-4.82872 1.13362
>>> print node2.Position()
array([120.322, -4.82872, 1.13362])
>>> node2.nid = 4
>>> print node2 # change the node ID
GRID 4 120.322-4.82872 1.13362
>>> bdf.write_bdf(bdf_filename_out)
You can change any of the parameters stored on the cards, which makes it a lot easier run an optimization problem. There are methods to interface with the case control deck as well, so you can create new/edit/delete load cases. The BDF reader also supports INCLUDE files and type checking, which makes it a lot easier to debug a Nastran BDF.
The OP2 reader is most popular feature. It reads the vast majority of tables (stress, strain, displacement, velocity, accelration, eigenvalues, eigenvectors, spc/mpc forces, etc.) in both their static form (e.g. SOL 101) and their "transient" form. A "transient" variable could be a time, load step or a frequency. Each unique OP2 data table is stored as a separate result, so if you can identify it in the F06, there's a good chance the OP2 reader will read it properly.
>>> op2 = OP2()
>>> op2.read_op2(op2_filename_in)
>>> op2.write_f06(f06_filename_out)
>>> stress = op2.plateStress[3] # get the plate stress for load case 3
>>> eid = 100
>>> iLayer = 1
>>> print stress.oxx[eid][iLayer] # ovm is a dictionary of von
2100.0
I hope people find it useful. If you're stuck trying to use it or have a suggestion, let me know. Best of all, it's free.
Steve Doyle
On Tuesday, May 7, 2013 10:07:23 PM UTC-7, Steve Doyle wrote: