-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathhfssInsertDesign.m
76 lines (72 loc) · 2.67 KB
/
hfssInsertDesign.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
% ----------------------------------------------------------------------------
% function hfssInsertDesign(fid, designName, [designType = 'driven modal'])
%
% Description :
% -------------
% Create the necessary VB Script to insert an HFSS Design into the Project
% and set it as the active design.
%
% Parameters :
% ------------
% fid - file identifier of the HFSS script file.
% designName - name of the new design to be inserted.
% designType - (Optional String) choose from the following:
% 1. 'driven modal' (default)
% 2. 'driven terminal'
% 3. 'eigenmode'
%
% Note :
% ------
% This function is usually called after a call to either hfssNewProject()
% or hfssOpenProject(), but this is not necessary.
%
% Example :
% ---------
% fid = fopen('myantenna.vbs', 'wt');
% ...
% hfssInsertDesign(fid, 'Dipole_SingleElement');
% ----------------------------------------------------------------------------
% ----------------------------------------------------------------------------
% This file is part of HFSS-MATLAB-API.
%
% HFSS-MATLAB-API is free software; you can redistribute it and/or modify it
% under the terms of the GNU General Public License as published by the Free
% Software Foundation; either version 2 of the License, or (at your option)
% any later version.
%
% HFSS-MATLAB-API is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
% for more details.
%
% You should have received a copy of the GNU General Public License along with
% Foobar; if not, write to the Free Software Foundation, Inc., 59 Temple
% Place, Suite 330, Boston, MA 02111-1307 USA
%
% Copyright 2004, Vijay Ramasami ([email protected])
% ----------------------------------------------------------------------------
function hfssInsertDesign(fid, designName, designType)
% arguments processor.
if (nargin < 2)
error('Insufficient number of arguments !');
elseif (nargin < 3)
designType = [];
end;
% default arguments.
if isempty(designType)
designType = 'driven modal';
end;
% create the necessary script.
fprintf(fid, '\n');
fprintf(fid, 'oProject.InsertDesign "HFSS", ');
fprintf(fid, '"%s", ', designName);
switch (lower(designType))
case 'driven terminal',
fprintf(fid, '"DrivenTerminal", ""\n');
case 'driven modal'
fprintf(fid, '"DrivenModal", ""\n');
case 'eigenmode'
fprintf(fid, '"Eigenmode", ""\n');
end;
fprintf(fid, 'Set oDesign = oProject.SetActiveDesign("%s")\n', designName);
fprintf(fid, 'Set oEditor = oDesign.SetActiveEditor("3D Modeler")\n');