% -------------------------------------------------------------------------
% function HfssRename(fid, HoldName, HnewName)
% 
% Popis funkce :
% -------------
% Vytovoreni m-file potrebneho k prejmenovani objektu v HFSS.
%
% Parametery :
% ------------
% fid     - soubor identifikujici HFSS script.
% HoldName - stare jmeno objektu.
% HnewName - nove jmeno objektu.
% 
%
% Priklad pouziti funkce :
% ---------
% fid = fopen('antenna.m', 'wt');
% ... 
% HfssRename(fid, 'dipole1', 'dipole_one');
%
% -------------------------------------------------------------------------

function HfssRename(fid, HoldName, HnewName)
global Editor

%zapis do souboru temp
fprintf(fid,'%% Prejmenovani objektu\n');
fprintf(fid,'invoke(Editor,''ChangeProperty'',...\n');
fprintf(fid,'{''NAME:AllTabs'',...\n');
fprintf(fid,'{''NAME:Geometry3DAttributeTab'',...\n');
fprintf(fid,['{''NAME:PropServers'',''',HoldName,'''},...\n']);
fprintf(fid,'{''NAME:ChangedProps'',...\n');
fprintf(fid,'{''NAME:Name'',...\n');
fprintf(fid,['''Value:='',''',HnewName,'''}}}});\n\n']);

%Prime vykonani v progrqamu Hfss
invoke(Editor,'ChangeProperty',...
    {'NAME:AllTabs',...
    {'NAME:Geometry3DAttributeTab',... 
    {'NAME:PropServers',HoldName},...
    {'NAME:ChangedProps',...
    {'NAME:Name',...
    'Value:=',HnewName}}}});


end

