pyyeti.nastran.bulk.wtassign

pyyeti.nastran.bulk.wtassign(f, assign_type, path, params=None, current_path=None, max_length=72)[source]

Write a Nastran ASSIGN statement to a file.

If possible, the relative path from current_path to path will be used. The statment will be wrapped as needed such that no lines exceed the specified max_length.

Parameters:
  • f (string or file_like or 1 or None) – Either a name of a file, or is a file_like object as returned by open() or io.StringIO. Input as integer 1 to write to stdout. Can also be the name of a directory or None; in these cases, a GUI is opened for file selection.

  • assign_type (str) – The type of ASSIGN statement. This can be one of ‘input2’, ‘input4’, ‘output2’, or ‘output4’.

  • path (string or object that defines __fspath__) – The path to the file.

  • params (dict; optional) – Optional “describer” values to add to the assign statment.

  • current_path (string or object that defines __fspath__; optional) – The path to the directory where the Nastran input file is located. If current_path is not specified, the output will use an absolute path.

  • max_length (integer; optional) – The max length of each line of the assign statment.

Notes

The max_length parameter must be at least 24 to allow space for the ASSIGN statement and assign type on the first line.

Forward slashes will always be used as path separators. This ensures that relative paths will work on both Windows and Linux.

Examples

>>> from pyyeti import nastran
>>> assign_type = 'output4'
>>> path = '/home/user1/out.op4'
>>> params = {'unit':101, 'delete':None}
>>> current_path = '/home/user2'
>>> nastran.wtassign(1, assign_type, path, params, current_path)
ASSIGN OUTPUT4 = '../user1/out.op4',UNIT=101,DELETE