%%%start auto demo play
function teidemo
global HndlList01 HndlList02 menu0 menu4 xfigokHndl buttonsHndl aniscancelHndl;
global textwin textwinHndl loadnameHndl matlfileHndl LoadFileName MatlFileName;
global SurfOption NodePointFlag SurfContourFlag;
global modenum;

timeunit=2;
set(HndlList01,'enable','on');

%pause(1);
myblinkmenu(menu0);myeval(51.5);pause(1);   %%FILE menu
myblink(loadnameHndl);set(loadnameHndl,'string','demo_clutch');
LoadFileName='demo_clutch.d';%modelname button
myblink(matlfileHndl);set(matlfileHndl,'string','MatlLib_clutch');
MatlFileName='MatlLib_clutch.ml';%%%matlname button
myblink(xfigokHndl);myeval(200.5);
set(HndlList01,'enable','on');pause(timeunit);%%load file ok 
myblink(HndlList01(2));myinput;pause(timeunit);%%edit model
myblink(buttonsHndl(3));myeval(8);pause(1);%%layer next
myblink(buttonsHndl(5));myeval(9);pause(1);%%layer end
myblink(buttonsHndl(11));myeval(30);pause(1);%%matl next
myblink(buttonsHndl(4));anis;pause(timeunit*2);%% open anis figure
myblink(aniscancelHndl);close(gcf);pause(1);%% close anis fig
myblink(buttonsHndl(14));close(gcf);pause(timeunit);%%MyModel fig close
myblink(HndlList01(4));myeval(101);view(80,0);pause(timeunit);%%3D view
for i=0:20,view(80,i);drawnow;end;pause(timeunit);  %3D rotate
myblink(HndlList01(3));NodePointFlag=0;myeval(103);
drawnow;pause(timeunit);%%show mesh
myblinkmenu(menu4);NodePointFlag=1;myeval(103);myzoomin;
drawnow;pause(timeunit);%%show mesh zoom in
myblink(HndlList01(1));tei_loop;  %%%run analysis
pause(timeunit);%% update textwin list
myblink(HndlList01(5));myeval(4000);drawnow;pause(timeunit);%%click ShowResult button
myblink(HndlList02(2));myeval(104); drawnow;pause(timeunit);%%T cross
myblink(HndlList02(3));SurfOption=5;SurfContourFlag=0;
myeval(105);drawnow;pause(timeunit);%% T surface 2DContour
myblink(HndlList02(3));modenum=42;SurfContourFlag=0;
myeval(105);drawnow;pause(timeunit);%% T surface 2DContour higher mode
myblinkmenu(menu4);modenum=1;SurfContourFlag=1;
myeval(105);drawnow;pause(timeunit);SurfContourFlag=0;%% T surface 3DSurf
myblink(HndlList02(4));myeval(109); drawnow;pause(timeunit);%% T thickness
myblink(HndlList02(6));myeval(110); drawnow;pause(timeunit*2);%% V-n
myblink(HndlList02(7));myeval(111); drawnow;pause(timeunit);%% c-n
myblink(HndlList02(9));myeval(116.1);drawnow;pause(timeunit*2);%% back to main menu
myeval(116); 

function myblink(blinkhndl)

blinkfrq=0.17;
for i=1:6, 
set(blinkhndl,'visible','off');drawnow;mypause(blinkfrq);
set(blinkhndl,'visible','on');drawnow;mypause(blinkfrq);
end;

function myblinkmenu(blinkhndl)

blinkfrq=0.17;
for i=1:6, 
set(blinkhndl,'enable','off');drawnow;mypause(blinkfrq);
set(blinkhndl,'enable','on');drawnow;mypause(blinkfrq);
end;

function mypause(pausetime)

for i=1:round(100000*pausetime),
sin(1);
end;

function show_textwin
global textwin textwinHndl;

for i=1:7,strlst{i}=textwin{i};end;
for i=8:length(textwin),
mypause(0.13);
strlst{i}=textwin{i};
set(textwinHndl,'string',strlst,'listboxtop',length(strlst));
drawnow;
end;

function myzoomin

myaxis=axis;
mycenterx=(myaxis(1)+myaxis(2))/2;
mycentery=(myaxis(3)+myaxis(4))/2;
mylenx=myaxis(2)-myaxis(1);
myleny=myaxis(4)-myaxis(3);
axis([mycenterx-mylenx/4 mycenterx+mylenx/4 ...
      mycentery-myleny/4 mycentery+myleny/4]);
