Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
tyenergy said:i try to implement an API to export the network parameters, such as S,Y,Z,Gamma,Zo, just like the built-in script "oModule.ExportNetworkData"
but I can only export the results of the first frequency point, the later ones are all outflow, i don't know why
danieldani said:You can implement an API to create a report and extract its data. I did it and it worked.
hfss = actxserver('AnsoftHfss.HfssScriptInterface');
desktop = hfss.GetAppDesktop();
project = desktop.GetActiveProject();
design = project.GetActiveDesign();
editor = design.SetActiveEditor('3D Modeler');
boundary = design.GetModule('BoundarySetup');
%name = HFSSBox(editor,name,position,size,varargin)
%name/value parameters: Material, Color, SolveInside,Transparency
function var = HFSSBox(editor,name,position,size,varargin)
p = inputParser;
p.addParamValue('Material','pec');
p.addParamValue('Color','(132 132 193)');
p.addParamValue('SolveInside',false);
p.addParamValue('Transparency',0);
p.parse(varargin{:});
mm = @(x)sprintf('%0.4fmm',x);
var = editor.CreateBox({'NAME:BoxParameters','CoordinateSystemID:=',-1,...
'XPosition:=',mm(position(1)),'YPosition:=',mm(position(2)),'ZPosition:=',mm(position(3)),...
'XSize:=',mm(size(1)),'YSize:=',mm(size(2)),'ZSize:=',mm(size(3))},...
{'NAME:Attributes','Name:=',name,'Flags:=','','MaterialName:=',p.Results.Material,...
'SolveInside:=',false,'Color:=',p.Results.Color,'Transparency:=',p.Results.Transparency,...
'PartCoordinateSystem:=','global'});
end
%HFSSMove(editor,name,vector)
%Arguments:
% editor: HFSS Editor COM object
% name: Name of object to be moved
% vector: [x,y,z] movement vector.
function HFSSMove(editor,name,vector)
error(nargchk(3,3,nargin,'struct'));
mm = @(x)sprintf('%0.4fmm',x);
editor.Move({'NAME:Selections','Selections:=',name},{'NAME:TranslateParameters',...
'TranslateVectorX:=',mm(vector(1)),'TranslateVectorY:=',mm(vector(2)),...
'TranslateVectorZ:=',mm(vector(3))});
end
oAnsoftApp=actxserver('AnsoftHfss.HfssScriptInterface.12');
oDesktop=oAnsoftApp.GetAppDesktop;
oProject=oDesktop.NewProject;
oDesign=oProject.InsertDesign('HFSS', 'HFSSDesign1','DrivenModal', '');
oEditor=oDesign.SetActiveEditor('3D Modeler');
...........
oDesign.Analyze('Setup1');
oSolutions=oDesign.GetModule('Solutions');
invoke(oSolutions,'ExportEigenmodes','Setup1', '', 'C:\Documents and Settings\sh\My Documents\Ansoft\eig1.eig')
H.K. said:Do you know any method that can save HFSS result by Matlab?
I executed Eigenmode calculation in HFSS controlled by Matlab code as follows.
[...]
But, I don't know how to save result.
I made codes as follows but error message appears.
Code:oSolutions=oDesign.GetModule('Solutions'); invoke(oSolutions,'ExportEigenmodes','Setup1', '', 'C:\Documents and Settings\sh\My Documents\Ansoft\eig1.eig')
Set oModule = oDesign.GetModule("Solutions")
oModule.ExportEigenmodes "Setup1 : LastAdaptive", "", _
"C:\mydir\myeigenmode" & _
".eig"
Thanks for the script file that is uploadad. I am working on the same procedure, desgining a patch antenna in hfss and optimizing it with matlab. This topic will be very useful.
The program is useful for me.After read it,I know how to use it!I attach here the modifications I have done to both, the visual script and de matlab script for HFSS version 11. I think it works.