- 易迪拓培训,专注于微波、射频、天线设计工程师的培养
Control CST from Python
录入:edatop.com 点击:
Hello,
I would like to migrate my CST scripts from using Matlab to use Python.
I did some unsuccessful guess work. Please see below two scripts, one in Matlab and one in Python. The python one does not work.
Any suggestions?
Thanks
================= MATLAB ==========================
full_cst_prj_file_name = 'YOUR CST PROJECT';
%% CST start
cst = actxserver('CSTStudio.application');
%% Open the project file and add a parameter
mws=invoke(cst, 'OpenFile', full_cst_prj_file_name);
invoke(mws,'StoreParameter','my_tst_param',10.012)
invoke(mws,'Rebuild')
%% Save the project copy
cst_prj_copy_file_name = [full_cst_prj_file_name(1:end-4) '_copy_matlab.cst'];
invoke(mws, 'SaveAs',cst_prj_copy_file_name,1);
%% Finish CST session
invoke(mws, 'Quit');
release(mws);
invoke(cst, 'Quit');
release(cst);
dos(['taskkill /F /IM ' '"CST DESIGN ENVIRONMENT.exe"']);
================= PYTHON ==========================
# Existing CST file -> put your name instead of YOUR CST PROJECT
full_cst_prj_file_name = "YOUR CST PROJECT"
# CST start
import win32com.client
cst = win32com.client.Dispatch("CSTStudio.Application")
# Open the project file and add a parameter
mws = cst.OpenFile(full_cst_prj_file_name)
mws.StoreParameter('my_tst_param',10.012)
mws.Rebuild()
# Save the project copy
end = len(full_cst_prj_file_name)
cst_prj_copy_file_name = full_cst_prj_file_name[0:end-4] + '_copy_python.cst'
mws.SaveAs(cst_prj_copy_file_name,'True')
# Quit CST
mws.Quit
#cst.Quit()
I would like to migrate my CST scripts from using Matlab to use Python.
I did some unsuccessful guess work. Please see below two scripts, one in Matlab and one in Python. The python one does not work.
Any suggestions?
Thanks
================= MATLAB ==========================
full_cst_prj_file_name = 'YOUR CST PROJECT';
%% CST start
cst = actxserver('CSTStudio.application');
%% Open the project file and add a parameter
mws=invoke(cst, 'OpenFile', full_cst_prj_file_name);
invoke(mws,'StoreParameter','my_tst_param',10.012)
invoke(mws,'Rebuild')
%% Save the project copy
cst_prj_copy_file_name = [full_cst_prj_file_name(1:end-4) '_copy_matlab.cst'];
invoke(mws, 'SaveAs',cst_prj_copy_file_name,1);
%% Finish CST session
invoke(mws, 'Quit');
release(mws);
invoke(cst, 'Quit');
release(cst);
dos(['taskkill /F /IM ' '"CST DESIGN ENVIRONMENT.exe"']);
================= PYTHON ==========================
# Existing CST file -> put your name instead of YOUR CST PROJECT
full_cst_prj_file_name = "YOUR CST PROJECT"
# CST start
import win32com.client
cst = win32com.client.Dispatch("CSTStudio.Application")
# Open the project file and add a parameter
mws = cst.OpenFile(full_cst_prj_file_name)
mws.StoreParameter('my_tst_param',10.012)
mws.Rebuild()
# Save the project copy
end = len(full_cst_prj_file_name)
cst_prj_copy_file_name = full_cst_prj_file_name[0:end-4] + '_copy_python.cst'
mws.SaveAs(cst_prj_copy_file_name,'True')
# Quit CST
mws.Quit
#cst.Quit()
申明:网友回复良莠不齐,仅供参考。如需专业解答,请学习易迪拓培训专家讲授的CST视频培训教程。
上一篇:ADS to CST layout import
下一篇:low frequency anteena using cst