Creating a Result Reader to Expose Results

To create a result reader to expose results, you can create a class that implements the interface ICustomResultReader. The following methods need to be implemented. For each method, the expected results that must be returned are described.

GetCurrentStep(self)

This method must return the current step number.

SetCurrentStep(self,stepInfo)

This method is called each time the current step number is changed.

GetStepValues(self)

This method must return a lost of double values that represents the time steps or frequencies.

GetResultNames(self)

This method must return a list of strings that represents the result names available for the reader.

GetResultLocation(self,resultName)

This method must return the location type of the result identified by the name resultName. The possible values are node, element, and elemnode.

GetResultType(self,resultName)

This method must return the type of the result identified by the name resultName. The possible values are scalar, vector, and tensor.

GetComponentNames(self,resultName)

This method must return a list of strings that represents the list of available components available for the result identified by the name resultName.

GetComponentUnit(self,resultName,componentName)

This method must return the unit name related to the result's component identified by the result name resultName and the component name componentName.

GetValues(self,resultName,collector)

This method must return a list of double values for each component associated with the result identified by the name resultName.

To specify a dedicated reader, add the callback <getreader> in the solver definition. This callback returns a list of strings, where the first is the name of the reader class and the remainder represents parameters given to the constructor of the class when the reader is instanced by ACT. Any result exposed in the method ResultNames() is available in the Results worksheet in Mechanical.

If the name of the result matches a standard result name (like U), Workbench applies the same treatment for this result as it does for a standard one. So, if the result is named U, Workbench uses this result to draw the deformed model.

In the extension Extsolver1, the reader declares one single scalar nodal result VALUES. No deformation is considered.

Enabling and Disabling the Reading of Meshing Data Inside the RST File

The following field enables and disables the reading of the meshing data inside the RST file:

Ansys.ACT.Mechanical.ActResultReaderUsingMeshDataFromRst = True / False

For some results, meshing data contained inside the RST file is needed for postprocessing. This is the case when the results refer to the entity generated during the solve, such as for contact results.

If the solve is done by a third-party solver rather than the standard Ansys Mechanical solver, the RST file will not contain meshing data. In this case, the variable ActResultReaderUsingMeshDataFromRst must be set to false:

def EvaluateResult(self, result, stepInfo, collector):
        ExtAPI.ActResultReaderUsingMeshDataFromRst = False;
      reader = result.Analysis.GetResultsData()