Extraction
of Nastran XDB file results into Excel
Purpose
of the Excel workbook
The Excel
workbook discussed here allows you to extract
results from a Nastran XDB file in Excel. The example contains several worksheets with controls that are linked to Excel VBA functions. These
functions use the FeResPost COM component that performs the interactions with the Nastran model and results. The VBA code is not described here. Those
who are
interested are referred to the FeResPost
User Manual for more explanations.The workbook presented here is provided with the FeResPost COM examples, in the "COMEX/EX09/PostXdbRandom.xls" Excel file. To run this example, you need to properly register the corresponding version of the FeResPost COM component. (The way to do it is explained in the FeResPost User Manual.)
Note that a similar "COMEX/EX09/PostDesFacRandom.xls" worksheet allows you to perform similar operations with Samcef models, and results extracted from DES & FAC files.
"FemDbIds" worksheet
The first worksheet to work with is the "FemDbIds"
worksheet that is used to read the finite element model, and attach an
XDB
file. Several control buttons allow you to perform this operation:
- In cells C3,
C4 and C5, one specifies the Nastran main BDF file, the Patran group
session file, and the Nastran XDB file. The full path must be
specified, and this can be done manually by filling the cells. Buttons
"Select Bdf File", "Select Ses File" and "Select Xdb File" can also be
used to fill the three cells.
- Button
"ReadModel" creates a database ("NastranDb" object), reads the model from the BDF file, and the groups from the Patran session file. The button also
fills the content of columns "Groups" and "CoordSys" in the worksheet.
(These columns are used as list references for Combo boxes in several
extraction worksheets.)
- Button
"ScanXdb" attaches the XDB file to the database, and reads the
corresponding load cases, sub-cases, and results identified in the XDB
file. The columns "LC names", "SC names" and RES names are
also filled.
Two other buttons allow you to show or hide the FeResPost window, and one
button allows
to close FeResPost. (This last button also destroys all the objects
that have
been created.)
Finally, an "Export Groups" button allows you to save the database groups
in a Patran session file.

"ResExtract" worksheet
The "ResExtract" worksheet allows the extraction of Results from the
XDB file attached to the current database. Several controls allow you to
perform
this operation:
- A combo
box allows you to select the group of elements and/or nodes on which the
values are extracted. This first combo box is completed by two combo
boxes:
- The first one
defines on which types of entities the results are extracted:
"Elements", "Nodes", "ElemCenters", "ElemCorners", "ElemNodes"...
- The second one
allows you to specify the layers on which results are extracted. It can be
all the layers, or a selection of layers input in the spreadsheet. (In
the example provided, the selection corresponds to cells in range M2:Q11.)
- A Combo box
allows you to select the load case for which results are extracted.
- A Combo box
allows you to select the sub-case for which results are extracted. Note
that in some cases you have to be careful to choose a sub-case
corresponding to the load case you have selected. This difficulty can
occur when you are extracting results for Nastran SOL 105, SOL 106, SOL
108, SOL 111...
- A Combo box
allows you to select the result you are extracting. (In the example
below, one extracts the complex Beam forces in real-imaginary format.)
- One Combo box,
and one check box allow you to define the coordinate system in which the
components of the extracted result are expressed. If one checks the
"Projected CS" box, the vector defined in cells D12:F12" specifies the
projected vector.
Finally, the "Extract" button extracts the results and fills
the spreadsheet starting at line 15. Note that the results are sorted
by
increasing element ID, node ID, layer ID and sub-layer ID.

"ResExtractCombili" worksheet
"ResExtractCombili" is a variant of "ResExtract" worksheet
that allows the extraction of linear combinations of elementary load
cases
results. It differs from "ResExtract" by:
- The fact that
three load cases must be specified.
- The fact that
three factors must be associated with the three sub-cases. Three Scroll
bars allow the modification of these factors, but the factors can
also be input manually.
This worksheet can be useful when the sizing is done using combinations of elementary load case results, such as acceleration load cases.

"WorstResExtract" worksheet
This spreadsheet allows you to extract a limited number of results (the worst ones
according to a specified criterion). More precisely:
- A Combo box
allows you to specify according to which criterion the worst results are
selected. Note that in this case, the largest values are extracted.
- A Scroll bar
allows you to specify the number of values one wishes to extract. This
value can also be input manually.
Results are output in decreasing order for the selected criterion. The
calculated criterion is given first, then the associated keys and
values
(components). Note that it is not possible here to modify the
coordinate
system with respect to which the components are expressed.

"DynamResExtract" worksheet
The "DynamResExtract" worksheet allows the extraction of XDB complex
results for SOL 108 and SOL 111 analyses. The differences with
"ResExtract"
worksheet can be summarized as follows:
- You no longer
specify a sub-case. Indeed, the VBA function associated with "Extract"
button extracts the results for all the sub-cases associated with the
selected load case.
- The extracted
results are pasted into the spreadsheet in magnitude-phase format. Each
component is saved in two columns by order of increasing frequency.
- Two graphics
are created:
- The first one
plots curves of the magnitudes versus frequency.
- The second one
plots curves of the phases versus frequency.
"GroupEdit" worksheet
When performing extractions, it can be very frustrating to discover
that the
group you need is not defined in the current database because it is not
defined
in the Patran session file you have read in the "FemDbIds"
spreadsheet. The "GroupEdit" spreadsheet has been added to allow the
user to define new groups, or modify existing groups during an Excel
session.
The spreadsheet has several capabilities:
- A Combo box
allows you to select a group already existing in the database. The
corresponding group name is then written in cell C3.
- You can also
fill the cell C3 manually. Actually, you have to do it for the
definition of a new group that does not exist in the database.
- You can define
lists of FEM entities in the range "A11:E***". Entities are specified
by their type, a single ID, or an ID range.
- Three buttons
allow you to add (or replace) a group in the database, add entities to an
existing group, or remove entities from an existing group. The removed
or added entities are specified in range "A11:E***".
The data and controls in range "I1:N7" can be used to define new
groups by topological operations.
If you want to save created groups for later use, you can export a
Patran
session file by clicking the corresponding buttons in "FemDbIds"
worksheet.

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