본문 바로가기
Programming/Python & R

CST Studio Suite에서 제공하는 python script 사용하기(Using the python script provided by CST Studio Suite)

by 도파공 2022. 11. 9.
728x90
반응형

CST Studio Suite 2022 버전은 Python 3.7 ~ 3.9 버전을 지원하고 있다. 하기 예제는 이에 해당하며, 혹여 Python 3.10에서 다루고자 한다면 win32com을 이용하기 바란다.

CST Studio Suite version 2022 supports Python versions 3.7 through 3.9. The examples below are for Python 3.7 and 3.9, and if you want to work with Python 3.10, Python 3.10, please use win32com.

 

# CST Library
# PYTHONPATH
# Windows: <CST_INSTALLATION_FOLDER>\CST Studio Suite 2022\AMD64\python_cst_libraries

import sys
sys.path.append(r"C:/Program Files (x86)/CST Studio Suite 2022/AMD64")
sys.path.append(r"C:/Program Files (x86)/CST Studio Suite 2022/AMD64/python_cst_libraries")
# print(sys.path)

# import cst
# print(cst.__file__) # should print '<PATH_TO_CST_AMD64>\python_cst_libraries\cst\__init__.py'

from cst.interface import DesignEnvironment
de = DesignEnvironment.new()

cst_file = r"C:\Works\CST\PYTHON\Dipole Antenna.cst" # replace with actual path on your machine
prj = de.open_project(cst_file)
prj.modeler.run_solver()
prj.close()

# cst studio suite example
import cst.results
project = cst.results.ProjectFile(r"c:\cst_works\Dipole Antenna.cst")
s11 = project.get_3d().get_result_item(r"1D Results\S-Parameters\S1,1")

print(s11.get_xdata())
print(s11.xlabel)
print(s11.get_data)

# Close CST
de.close()

 

win32com 이용하기

https://mwave.tistory.com/288

 

[Python] Python으로 CST STUDIO SUITE 제어하기

Python의 win32com을 이용하여 CST STUDIO SUITE를 제어할 수 있는 예제를 올려둔다. 하기 예제는 변수를 등록하는 방법과 재질을 등록하는 법이 포함되어 있다. CST STUDIO SUITE을 잘 이용한다면 History에서

mwave.tistory.com

 

728x90
반응형

댓글