Skip to content

Archive File Code Streamlining

Compare
Choose a tag to compare
@akaszynski akaszynski released this 14 Nov 18:08

ParseFEM has been removed entirely from the archive reader and new archive files can be read in and displayed with VTK using:

import pyansys

archive = pyansys.ReadArchive('tiny.cdb')
grid = archive.ParseVTK()
grid.Plot()  # plot

This approach simplifies much of the code and eliminates an unnecessary function. Information about the ansys archive file is now contained within the unstructured grid and can be accessed using the GetPointScalars function. See vtkInterface.

ParseVTK also allows you to specify element types to read in. See the doc_string of ParseVTK below:

Parses raw data from cdb file to VTK format.

Parameters
----------
force_linear : bool, optional
    This parser creates quadradic elements if available.  Set this to
    True to always create linear elements.  Defaults to False.

allowable_types : list, optional
    Allowable element types.  Defaults to:
    ['45', '95', '185', '186', '92', '187']

    Can include:
    ['45', '95', '185', '186', '92', '187', '154']

Returns
-------
uGrid : vtk.vtkUnstructuredGrid
    VTK unstructured grid from archive file.