21.2. Python Result

The Python Result object enables you to evaluate output quantities by executing a Python script based on the Data Processing Framework (DPF) post-processing toolbox.

Sample Python Scripts and Python Engine

The Mechanical application allows you to use either the IronPython or CPython engine for your Python Result scripts. The example scripts in this section were created and tested using the IronPython engine. To switch the Python engine, see Viewing and Changing the Python Engine . For tips on migrating scripts between IronPython and CPython, see Migrating from IronPython to CPython in the Scripting in Mechanical Guide.

Python Result Disclaimer

The Python Result feature advances capabilities for you to create and evaluate a variety of scripts. Since the core architecture of this object works like a generic Python interpreter, you are free to use all that Python has to offer. However, if your goal is to transfer information back to the Mechanical application in the form of a standard output, such as contours, tables, charts, etc., there are limitations to what Mechanical can handle and display. There are also performance considerations for complicated calculations within the script.

The examples provided in this section illustrate the most commonly used scenarios with a variety of inputs (geometry and finite element scoping, time and frequency selection, data sources, etc.) and outputs (Contours, deformations, table/charts) that Mechanical currently supports for this feature.

We encourage you to be cautious while using this feature. Python and DPF offer many features, however, there are limits to what Mechanical can do in terms of supported outputs.