summaryrefslogtreecommitdiff
path: root/CSXCAD/matlab/AddBox.m
blob: d07274cbf0bc30b12e70860a6195f8e586a1d0c5 (plain)
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
function CSX = AddBox(CSX, propName, prio, start, stop, varargin)
% function CSX = AddBox(CSX, propName, prio, start, stop, varargin)
%
% Add a box to CSX and assign to a property with name <propName>.
%
%  start:   box start coordinates
%  stop :   box stop  coordinates
%  prio :   primitive priority
%
% optional:
%   Transformation: perform a transformation on a primitive by adding
%      e.g.: 'Transform', {'Scale','1,1,2','Rotate_X',pi/4,'Translate','0,0,100'}
%      Note: This will only affect the 3D material/metal discretisation
%
%   example:
%       CSX = AddMetal(CSX,'metal'); %create PEC with propName 'metal'
%       CSX = AddBox(CSX,'metal',10,[0 0 0],[100 100 200]); %assign box
%
%   with transformation:
%       CSX = AddBox(CSX,'metal',10,[0 0 0],[100 100 200], ...
%                        'Transform', {Rotate_Z, pi/4});
%
% See also AddCylinder, AddCylindricalShell, AddSphere, AddSphericalShell,
% AddCurve, AddWire, AddMetal
%
% CSXCAD matlab interface
% -----------------------
% author: Thorsten Liebig

box.ATTRIBUTE.Priority = prio;

box.P1.ATTRIBUTE.X=start(1);
box.P1.ATTRIBUTE.Y=start(2);
box.P1.ATTRIBUTE.Z=start(3);

box.P2.ATTRIBUTE.X=stop(1);
box.P2.ATTRIBUTE.Y=stop(2);
box.P2.ATTRIBUTE.Z=stop(3);

box = AddPrimitiveArgs(box,varargin{:});

CSX = Add2Property(CSX,propName, box, 'Box');