Return to
the
examples
Extraction
of Nastran XDB file results into excel
Purpose
of the excel workbook
The excel
workbook discussed here allows 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
Nastran model and results. The VBA code is not described here. Those
who are
interested are referred to the FeResPost
Reference Manual for more explanation.
The
workbook we present here is provided with
FeResPost COM example in "COMEX/EX09/PostXdbRandom.xls" excel file.
To run this example, you need to register properly the corresponding
version of
FeResPost COM component. (The way to do it is explained in FeResPost
Reference Manual.)
Note that
a
similar "COMEX/EX09/PostDesFacRandom.xls"
worksheet allows ,to perform similar operations with SAMCEF models, and
results
extracted from DES & FAC files.
"FemDbIds" worksheet
The first worksheet in which on has to work is the "FemDbIds"
worksheet that is used to read the finite element model, and attach an
XDB
file. Several control buttons allow 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 BDF file, and the groups from 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 content of columns "LC names", "SC names" and RES names are
also filled.
Two other buttons allow to show or hide 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 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 to
perform
this operation:
- A combo
box allows 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 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
M2Q11.)
- A Combo box
allows to select the load case for which results are extracted.
- A Combo box
allows 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 to define the coordinate system in which the
components of the extracted result are expressed. If one checks the
"Projected CS" box, the vector define in cells D12:F12" specifies the
projected vector.
Finally, the "Extract" button allows to extract 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 to 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
elementary load case results as acceleration load cases.
"WorstResExtract" worksheet
This spreadsheet allows to extracted a limited number of results (the
worst one
according to a specified criterion). More precisely:
- A Combo box
allows 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 to specify the number of values one wishes to extract. This
value can also be input manually.
Results are output by decreasing order for the selected criterion. The
calculated criterion is given first, then the associated keys and
values
(components). Note that one has no possibility here to modify the
coordinate
system wrt 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 to "Extract"
button extracts the results for all the sub-cases associated to 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 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 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 a later usage, you can export a
Patran
session file by clicking the corresponding buttons in "FemDbIds"
worksheet.
References
More information on this example, and the manual
explaining the functions used in this example are given in FeResPost
Reference Manual.