Simcenter Amesim How to configure PyCharm for Simcenter Amesim ?

2024-01-10T15:40:16.000-0500
Simcenter Amesim Automation Connect Simcenter System Simulation Client for Git Simcenter Amesim Teamcenter Share

Summary

PyCharm is an IDE commonly used for Python Code. In this article, we will see how we can configure PyCharm® to work with Simcenter Amesim API functions.


Details

To launch PyCharm for Simcenter Amesim usage, a customized $AME should be set to be recognized by this one.
To do so, write the bellows instruction into a batch file and adapt it to your PyCharm.exe installation (here we have an example with the PyCharm Community Edition 2021.2):

@echo off
set PYTHONPATH=%AME%\scripting\python;%AME%\scripting\python\win64
set PATH=%AME%\scripting\python;%AME%\scripting\python\win64;%PATH% 
REM set QT_PLUGIN_PATH=%AME%\scripting\python\win64 
"C:\Program Files\JetBrains\PyCharm Community Edition 2021.2\bin\pycharm64.exe"

Then you can save it under the name you want.

To start PyCharm with Simcenter Amesim, you have first to open a command window in Simcenter Amesim using "Tools>Python command interpreter"
pict1.png
Exit the python process with exit() (or you can use the keybord shortcut "ctrl+Z"):
pict2.png
Now you can lauch the batch file you have created (in this case we named it PyCharmLaucher.bat):
pict3.png

Once PyCharm is started, you have to configure your project to use properly PyCharme. Select "FIle>New project". Set a custom name when defining the location and in Project interpreter click on Existing interpreter. Then click on ... and a new window shall open. Here select System Interpreter on the left side. If you have well lauched PyCharm from Amesim, the python.exe located in your Amesim folder shall be available in the Interpreter list. Else you can find into the Simcenter Amesim installation location file %AME%\sys\python\win64\python.exe.
pict4.png
Click on Ok then click on Create.

KB Article ID# KB000047157_EN_US

Contents

SummaryDetails

Associated Components

Amesim Automation Connect