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()
>>> node2 = bdf.nodes
>>> 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
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()
>>> stress = op2.plateStress # get the plate stress for load case 3
>>> eid = 100
>>> iLayer = 1
>>> print stress.oxx[eid][iLayer] # ovm is a dictionary of von
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.
On Tuesday, May 7, 2013 10:07:23 PM UTC-7, Steve Doyle wrote: