Simcenter Amesim How to launch Python AMESim API using Window command prompt

Simcenter Amesim Automation Connect Simcenter System Simulation Client for Git Simcenter Amesim Teamcenter Share


The Simcenter Amesim™ software provides a complete set of API functions to write short programs in higher abstraction level languages, like Python, C, and Visual Basic for Applications, that automate interaction with the models. These functions are particularly designed for automating tasks, such as setting or getting parameter values, running temporal simulations or linear analysis, and post-processing result variables. You can launch API interface via a Python command interpreter, but, if, you have only 1 AMESim license, then, you will not able to use the API. This problem can overcome by using a window command prompt.


The API can be launched in two ways
  • Using Inbuild python command interpreter
  • Using window command prompt
Using inbuild python command interpreter
AMESim is comes along with inbuild python. You can directly launch it from the AMESim To launch interpreter, Go to Tools and click on Python command interpreter

Using window command prompt - In this case, you can come across two scenarios.
  • If only 1 AMESim version installed on your system
  • If multiple AMESim versions installed on your machine
  1. When you have only 1 AMESim version on your machine -  In this case, generally, all the AMESim paths are included in the PATH variable while installation. Your PATH system variable will have below AMESim related folder path C:\Program Files\Simcenter\2020.1\System Architect\win64;%AME%;%AME%\win64;%AME%\win32;%AME%\sys\mingw32\bin;%AME%\sys\python\win64. AMESim comes with inbuild python. Your system can use this python installation, since, this path is included in the PATH variable. In order to launch API via the command prompt, you can execute below command prompt in sequence.
    1. Open command prompt
    2. Execute "python"
    3. Execute "AMEInitAPI()"
    4. Now, you can execute all commands related to automation from this command prompt itself.
  2. When you will have multiple versions of AMESim and every version is launched via script.
    1. It is not always necessary to export the AMESim path to the PATH variable. You need not to export this PATH, if,
      1. If, you are launching API for the latest installed AMESim version. In this case, The AME system variable is pointing towards the latest version installation path.
      2. Launching API for the version, which is matched with the AME system variable value. Eg. Let us say, you have installed 2019.1 and 2020.1 version on the same system. If you are pointing your AME system variable to 2019.1 installation folder, then, you need not to export the path.
    2. It is always a good idea to remove all variables related to AMESim from the PATH variable, especially when, you are launching multiple versions via script. As you are again exporting the same PATH via a script, sometimes, it may create an issue. But, most of the time, it should not be the issue.
    3. To launch API for specific AMESim version (Let say, you have 2019.1, 2019.2, 2020.1 AMESim version and you want to launch the API with 2019.1), open the cmd window and execute below command in sequence.
      1. set AME=C:\Program Files\Simcenter\2019.1\Amesim
      2. PATH=%AME%;%AME%\win32;%AME%\win64;%AME%\sys\mingw32\bin;%AME%\sys\python\win32;%AME%\sys\mpich\mpd\bin;%PATH%
      3. Python
      4. AMEInitAPI()
Now, you can run the model via AMESim 2019.1 using the API.

KB Article ID# KB000045439_EN_US



Associated Components

Amesim Automation Connect