Controlling HFSS from Matlab
I am in Matlab in a loop where I have to call HFSS. I need to:
1. load a project file,
2. change some variables values
3. run the optimization in it
4. export results
5. save project
I have this Matlab routine I wrote (mostly guessing) and the HFSS test project file attached.
Questions:
1. It looks like when the directory string includes spaces, it won't work. Is this true?
2. I can't get line 12 & 13 to work. Is the syntax correct?
oDesign = oProject.SetActiveDesign('HFSSDesign1')
oModule = oDesign.GetModule('Optimetrics')
Please let me know if this can be done at all. I spent too much time guessing.
Thanks
Katto01
I found the solution, so if any body needs this, here it is
%=============================== start
%Setup up project information
fln='i:\file.hfss';
%gln=strcat(dir,fln)
oAnsoftApp = actxserver('AnsoftHfss.HfssScriptInterface');
oDesktop = oAnsoftApp.GetAppDesktop();
oDesktop.RestoreWindow();
%oDesign = oProject.SetActiveDesign('HFSSDesign1')
oDesktop.OpenProject (fln)
oProject = oDesktop.SetActiveProject('file');
oDesign = oProject.SetActiveDesign('HFSSDesign1');
%oModule = oDesign.GetModule('ReportSetup');
oModule = oDesign.GetModule('Optimetrics');
%oProject = oDesktop.SetActiveProject('file');
%Set Variables
oProject.ChangeProperty({'NAME:AllTabs', {'NAME:ProjectVariableTab', {'NAME:PropServers', ...
'ProjectVariables'}, {'NAME:ChangedProps', ...
{'NAME:Sepsr', 'Value:=', '0.5'}, ...
{'NAME:Smiur', 'Value:=', '3'}, ...
{'NAME:Setan_delta', 'Value:=', '.01'}, ...
{'NAME:Smtan_delta', 'Value:=', '.05'}}}});
%Save and Solve
oProject.Save();
oModule.SolveSetup('OptimizationSetup1')
%=============================== end