Step 1: Insert this “Python Code Object”

Step 2: Set a “Callback”, which is basically telling Mechanical, at which point you would like it to trigger the Python script
- In this case, we use “After Post”, as we want to wait till Mechanical solves the model so that the contour plots are available

Step 3: Put some code in it.
- The below code basically goes over each analysis in the Tree in Mechanical, searches for all the Equivalent Stress and Total Deformation result objects and exports the contour plots as images in the User Files Directory of the Project.
Step 4: Connect!


- In Workbench -> Tools -> Options
- Options Window pops up. Go to Mechanical -> and check the box “Connect/Run Python Code Objects When Mechanical is Launched”
