pyyeti.nastran.bulk.rdsets

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

Read case control SET statements from a 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().

  • include_root_dirs (None; optional) – This parameter is only used when this function is called recursively while following INCLUDE statements. Users should keep it as the default value of None.

  • 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:

sets (dict) – A dictionary of all sets in the file. The set IDs are the keys, and the values are a list of the set components.

Examples

>>> from io import StringIO
>>> from pyyeti import nastran
>>> f = StringIO("SET 101 = 11, 21 THRU 23")
>>> print(nastran.rdsets(f))
{101: [11, 21, 22, 23]}