https://space.mit.edu/RADIO/CST_online/Python/main.html#
CST Python Libraries
Some features of the CST Studio Suite tools can be controlled via CST Python Libraries.
Overiew
The cst package provides a Python interface to the CST Studio Suite.
- cst.interface – Allows controlling a running CST Studio Suite.
- cst.results – Provides access to 0D/1D Results of a cst file.
- cst.eda – Provides an interface to a Printed Circuit Board (PCB).
General Notes
Supported is Python version 3.6.
Setup
The CST Studio Suite installation comes with Python 3.6, which requires no further setup to start using it with the CST Python Libraries. However, this is just a plain Python interpreter with only the standard libraries available. You may want to use a more feature rich Python 3.6 distribution like Anaconda with the provided CST Python Libraries. To start working with the CST Python Libraries from an external Python distribution, you will have to include the directory in Python’s system path.The easiest solution is to add or modify the PYTHONPATH
system environment variable to include:
- Windows:
<CST_INSTALLATION_FOLDER>\CST STUDIO SUITE 2020\AMD64\python_cst_libraries
- Linux:
<CST_INSTALLATION_FOLDER>/CST_STUDIO_SUITE_2020/LinuxAMD64/python_cst_libraries
If you have installed the CST Studio Suite in a different location, please adjust the paths above. Consult your operating system user manual on how to set environment variables.
Alternatively you may modify sys.path
in a running Python environment by calling:
>>> import sys >>> sys.path.append(r"<PATH_TO_CST_AMD64>/python_cst_libraries")
Please replace <PATH_TO_CST_AMD64>
above with the system dependent paths indicated above (i.e. under Windows use: <CST_INSTALLATION_FOLDER>\CST STUDIO SUITE 2020\AMD64
).
You have succesfully set up your Python environment when you are able to execute the following code without error:
>>> import cst >>> print(cst.__file__) # should print '<PATH_TO_CST_AMD64>\python_cst_libraries\cst\__init__.py'