pyyeti.nastran.bulk.rdgrids

pyyeti.nastran.bulk.rdgrids(f, *, follow_includes=True, include_symbols=None, encoding='utf_8')[source]

Read Nastran GRID cards from a Nastran bulk file.

Parameters:
  • f (string or file_like or None) – Either a name of a file, or is a file_like object as returned by open(). If file_like object, it is rewound first. Can also be the name of a directory or None; in these cases, a GUI is opened for file selection.

  • follow_includes (bool; optional) – If True, INCLUDE statements will be followed recursively. Note that if f is a StringIO object, or another object that does not have a name property, this parameter will be set to False.

  • include_symbols (dict; optional) – A dictionary mapping Nastran symbols to an associated path. These can be read from a file using rdsymbols().

  • encoding (string; optional) – Encoding to use when opening text file. This option will be passed to any files read in via the follow_includes option.

Returns:

grids (ndarray or None) – 8-column ndarray: [ id, cs, x, y, z, cs, spc, seid ]. Returns None if no grid cards found

Notes

This routine uses rdcards() to load the data (can read 8 or 16 fixed field or comma-delimited).

Examples

>>> import numpy as np
>>> from pyyeti import nastran
>>> from io import StringIO
>>> from pandas import DataFrame
>>> xyz = np.array([[.1, .2, .3], [1.1, 1.2, 1.3]])
>>> with StringIO() as f:
...     nastran.wtgrids(f, [100, 200], xyz=xyz, cd=10)
...     g = nastran.rdgrids(f)
>>> df = DataFrame(g)
>>> intcols = [0, 1, 5, 6, 7]
>>> df[intcols] = df[intcols].astype(int)
>>> df
     0  1    2    3    4   5  6  7
0  100  0  0.1  0.2  0.3  10  0  0
1  200  0  1.1  1.2  1.3  10  0  0