-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathhfssAssignSlave_y.m
78 lines (72 loc) · 2.85 KB
/
hfssAssignSlave_y.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
77
78
% ----------------------------------------------------------------------------
% function hfssAssignSlave(fid, Name, ObjName, iUStart, iUEnd, Units,
% [ReverseV])
%
% Description :
% -------------
% Creates the necessary VB Script to assign a Slave Boundary to a given Object.
%
% Parameters :
% ------------
% fid - file identifier of the HFSS script file.
% Name - name of the slave boundary (appears under 'Boundaries' in HFSS).
% ObjName - name of the (sheet-like) object to which the slave boundary is to
% be assigned.
% iUStart - (vector) starting point of the U vector. Specify as
% [x, y, z].
% iUEnd - (vector) ending point of the U vector. Specify as
% [x, y, z].
% Units - specify as 'meter', 'in', 'cm' (defined in HFSS).
% [ReverseV] - (boolean, optional) reverses vector V (defaults to
% true if the U vector points +y, and to false elsewise)
% Example :
% ---------
% fid = fopen('myantenna.vbs', 'wt');
% ...
% hfssAssignMaster(fid, 'Master', 'Sheet', [-width/2, 0, 0], ...
% [width/2, 0, 0], 'meter', false);
%
% ----------------------------------------------------------------------------
% ----------------------------------------------------------------------------
% CHANGELOG
%
% 21-May-2013: *Initial release.
% ----------------------------------------------------------------------------
% ----------------------------------------------------------------------------
% Written by Pablo Alcon Garcia
% 21 May 2013
% ----------------------------------------------------------------------------
function hfssAssignSlave(fid, Name, ObjName, iUStart, iUEnd, Units, Master, ReverseV)
% arguments processor.
if (nargin < 7)
error('Insufficient # of arguments !');
elseif (nargin < 8)
if iUEnd(2)~=iUStart(2)
ReverseV = true;
else
ReverseV = false;
end
end
if ReverseV
ReverseV = 'true';
else
ReverseV = 'false';
end
% Preamble.
fprintf(fid, '\n');
fprintf(fid, 'Set oModule = oDesign.GetModule("BoundarySetup")\n');
% Parameters
fprintf(fid, 'oModule.AssignSlave _\n');
fprintf(fid, 'Array("NAME:%s", _\n', Name);
fprintf(fid, '\t"Faces:=", Array(%s), _\n', ObjName);
fprintf(fid, '\tArray("NAME:CoordSysVector", "Origin:=", _\n');
fprintf(fid, '\t\tArray("%f%s", "%f%s", "%f%s"), _\n', ...
iUStart(1), Units, iUStart(2), Units, iUStart(3), Units);
fprintf(fid, '\t\t"UPos:=", Array("%f%s", "%f%s", "%f%s") _\n', ...
iUEnd(1), Units, iUEnd(2), Units, iUEnd(3), Units);
fprintf(fid, '\t\t), _\n');
fprintf(fid, '\t"ReverseV:=", %s, _\n', ReverseV);
fprintf(fid, '\t"Master:=", "%s", _\n', Master);
fprintf(fid, '\t"UseScanAngles:=", true, "Phi:=", "0deg", "Theta:=", "0deg" _\n');
fprintf(fid, '\t)\n');