Getting started
Setting the environment
Plots Python API, Setting the environment
The plotting facilities module is called amepyplot. To include the definitions of modules classes, use the following directive:
Copy
import amepyplot
Note
Several classes and functions contain references to PySide2, the Python binding for the Qt C++ framework.
Depending on the context of your script, the display of your graphs in a Simcenter Amesim plot window can differ. Three cases occur when scripts are used to interact with Simcenter Amesim.
Standalone script
This kind of script is particularly designed for automating tasks such as setting or getting parameter values, running temporal simulations or linear analysis, and post-processing result variables from outside Simcenter Amesim. Simcenter Amesim does not need to be open to interact with it, this is typically the case when using the Simulation scripting facility or the Simcenter Amesim API.
In that case you need to create a Qt Application that allows you to manage the plot widget.
Note
The main event loop receives events from the window system and dispatches these to the application widgets.
Below is a template of how the code needs to be structured to display your plot in an Simcenter Amesim plot window.
Copy
import sys
import math
import amepyplot
from PySide2 import QtWidgets
# Check if there is already a Qt Application
app = QtWidgets.QApplication.instance()
if app is None:
app = QtWidgets.QApplication([])
# Setup the curve
...
...
plot.show()
# Start the application
app.exec_()
Python tools
In Simcenter Amesim the Python tools are located at system level or component level. These tools call Python scripts to interact with an open model within Simcenter Amesim. They can be launched from the script analysis tool, the script assistant component (SCRCALL01 submodel), and the editable parameters group facility.
In this case the plot window is attached to the main Simcenter Amesim window.
Below is a template of how the code needs to be structured to display your plot in an Simcenter Amesim plot window.
Copy
import sys
import math
import amepyplot
from PySide2 import QtWidgets
import apps
# Get the Simcenter Amesim main window
mainWindow = apps.utils.topLevelWindow()
# Create a dedicated dialog for the plot
dialog = QtWidgets.QDialog(mainWindow)
# Create a layout to specify the behavior of the children widget
layout = QtWidgets.QVBoxLayout(dialog)
# Create the plot window as a child of the dialog
plot = amepyplot.PlotWidget(dialog)
# Add the plot window to the layout of the dialog
layout.addWidget(plot)
# Setup the curve
...
...
dialog.show()
Apps
In the App Designer there is a dedicated widget to integrate a plot within your Graphical User Interface. When you insert this widget in your UI the associated code is automatically generated. You just need to attach your graph to this widget through its name.
Below is a template of how the code needs to be structured to display your plot in an Simcenter Amesim plot widget.
Copy
import math
import amepyplot
...
#>>>>>>> Extra initialization declarations here
# Setup the curve
graph = self.myPlotWidgetName.firstGraph()
...
...
#>>>>>>> End of initialization
Source: https://docs.sw.siemens.com/en-US/doc/254352342/PL20250521841123434.amesim_collection.Plots_Python_API/xid1203340 · retrieved 2026-07-17