pyyeti.nastran.bulk.rdextrn

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

Read EXTRN entry from .pch file created by Nastran

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.

  • expand (bool; optional) –

    If True, expand rows like this:

    [100, 123456]
    

    into 6 separate rows like this:

    [100, 1],
    [100, 2],
    [100, 3],
    [100, 4],
    [100, 5],
    [100, 6],
    
  • 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().

Returns:

2d ndarray – Two column array: [ID, DOF]

Notes

The expansion is done by pyyeti.nastran.n2p.expanddof().

Examples

>>> from pyyeti import nastran
>>> from io import StringIO
>>> f = StringIO('EXTRN,3,123456,11,123456,19,123456,27,123456\n'
...              ',2995001,0,2995002,0,2995003,0,2995004,0\n'
...              ',2995005,0,2995006,0,2995007,0,2995008,0\n')
>>> nastran.rdextrn(f, expand=False)
array([[      3,  123456],
       [     11,  123456],
       [     19,  123456],
       [     27,  123456],
       [2995001,       0],
       [2995002,       0],
       [2995003,       0],
       [2995004,       0],
       [2995005,       0],
       [2995006,       0],
       [2995007,       0],
       [2995008,       0]]...)
>>> f = StringIO('EXTRN,3,123456,2995001,0')
>>> nastran.rdextrn(f)
array([[      3,       1],
       [      3,       2],
       [      3,       3],
       [      3,       4],
       [      3,       5],
       [      3,       6],
       [2995001,       0]]...)