A Python script to extract information from a Nastran XDB file

Purpose of the script

The script illustrates the extraction of information from a Nastran XDB file.

Script

Python
import sys
sys.stdout=open(__file__+".log", 'w')

from FeResPost import *
import sys

sys.path.insert(0, '../UTIL')
import Util

# Creates and initializes the DataBase :

db=NastranDb()
db.Name="tmpDB"
db.readBdf("../../MODEL/MAINS/unit_xyz.bdf")
db.readGroupsFromPatranSession("../../MODEL/PATRAN/groups.ses")

# Accessing Results :

xdbFileName="../../MODEL/EXEC_XDB/sol111_ri_xyz.xdb"

db.attachXdb(xdbFileName)

infos=db.getAttachmentLcInfos(xdbFileName)
for tab in infos:
    sys.stdout.write("%-20s %-25s %-6d %-6d %-15g %-15g\n"%(tab[0],tab[1],tab[3],tab[4],tab[5],tab[6]))

resNames=db.getAttachmentResNames(xdbFileName)
for resName in resNames:
    sys.stdout.write("%-20s\n"%(resName))

Explanation

The different steps of the script are:

References

More information on this example, and on the functions it uses, is given in the FeResPost User Manual.

← Back to the examples