% ----------------------------------------------------------------------------
% function HfssSetColor(fid, HObject, HColor)
% 
% Popis funkce :
% -------------
% Funkce potrebna k nastaveni barev objektu v HFSS. 
%
% Parametery :
% ------------
% fid     - file identifier of the HFSS script file.
% Object  - jmeno objektu pro nastaveni barvy.
% Color   - [3x1 vector] prezentujici [R, G, B] komponenty barev.
%
% Priklad pouziti funkce :
% ---------
% fid = fopen('antenna.m', 'wt');
% ... 
% HfssSetColor(fid, 'Substrate', [0, 64, 0]);
%
% -------------------------------------------------------------------------

function HfssSetColor(fid, HObject, HColor)
global Editor

%Zapis do souboru temp
fprintf(fid, 'invoke(Editor,''ChangeProperty'',...\n');
fprintf(fid, '{''NAME:AllTabs'',...\n');
fprintf(fid, '{''NAME:Geometry3DAttributeTab'',...\n');
fprintf(fid, ['{''NAME:PropServers'',''',HObject,'''},...\n']);
fprintf(fid, '{''NAME:ChangedProps'',...\n');
fprintf(fid, ['{''NAME:Color'',''R:='',',num2str(HColor(1)),...
                             ',''G:='',',num2str(HColor(2)),...
                             ',''B:='',',num2str(HColor(3)),'}}}});\n\n']);

%prime vykonani v programu HFSS
invoke(Editor,'ChangeProperty',...
    {'NAME:AllTabs',...
    {'NAME:Geometry3DAttributeTab',...
    {'NAME:PropServers',HObject},...
    {'NAME:ChangedProps',...
    {'NAME:Color','R:=',HColor(1),'G:=',HColor(2),'B:=',HColor(3)}}}});    

    
end    