Our challenge - At the Ansys CodeFest in KIT 2023
During the last ANSYS CodeFest 2023 held in the Karlsruhe Institute of Technology (KIT, Germany), my group decided to participate with a work challenge that we brought ourselves: the creation of a custom toolbar for our ANSYS Mechanical installations, to enable us to compute and export stress and temperature analyses along linear paths between a point and surface. For those of you familiar with regulations & codes for licensing pressure vessels, this will sound familiar; standards such as the ASME’s BPVC Section VIII and the afcen’s RCC-MRx Code require linearization procedures to evaluate average and varying components along selected paths, as a means of qualifying a design. For all others, check here, here or here for example, for more information on linearization along FEM/FEA paths; this article also provides a good discussion on the topic. Due to the limited time of the event, our group decided to develop a simple (i.e. quick and dirty) set of Python scripts and embed them into a set of buttons in ANSYS Mechanical, in its own toolbar menu. The resulting package can be now found in its own GitHub repository. For this work, we’ve used Mechanical 2023 R1.Our solution - The PathAnalysis Package
The toolbar menu that we developed can be seen below. It includes a Path button, a Calculate button and a Delete sub-menu for both stress and temperature solutions.
- first create named selections for both a node and a surface in your results;
- then click the Path button (route icon) in the toolbar to determine and create the shortest path between them;
- then click the Calculate button (calculator icon) to compute the stress and temperature analysis summaries and export them as a CVS file on your Desktop.
.py files of the package. The toolbar menu itself was created with the PathAnalysis.XML file, by using the toolbar tag to define a new toolbar menu, and one entry tag for each toolbar button. The icon tag was used to associate an image to each button, and the callback and onclick tags were then used to link Python functions to them:
Our example
An example file has been included in the repo to test the extension after it has been installed and enabled (see the README for more information). It contains a named Node and a named Surface that can define a path, in a simple geometry loaded with a simple temperature distribution. Altering the given node/surface and clicking Path a few times can provide us with linear paths to perform an example analysis, as seen below.

I like where you are with this (and I’d like to try it out)
An installation guide can be found in the GitHub repository, but it is as simple as copying the contents of the repo’sextensions folder into the directory of same name of your installation! After that, the extension must be loaded in the Workbench toolbar (Extensions > Extensions Manager) by enabling the check-box for PathAnalysis. The extension menu will then appear in the toolbar of your window for visualization of results and you can use it to your heart’s content!
I like where you’re going with this (and I’d like to follow your work)
As mentioned before, this extension was developed quickly due to our limited time during the CodeFest. But we intend to keep working on it to improve its features and use-cases. Next in line are:- add the correct logging functions to each function, to facilitate debugging processes;
- use the direction between the named point and named surface to limit the number of iterations in the loop that searches the shortest path between them;
- modify the automatic path naming function and fixed named selection basis (of both node and surface) to more generic functionalities.
Tools > Options > Extensions, enable the check-box for Debug Mode). For additional information on XML tags and custom extensions, one can always check the Online API and XML Reference Guides in ANSYS ACT Developers Guides.