5.4. Creating and Maintaining a Status Bar from a Macro

www.kxcad.net Home > CAE Index > ANSYS Index > Release 11.0 Documentation for ANSYS


Your Ad Here

Within macros, you can insert commands to define an ANSYS dialog box containing a status bar displaying the progress of an operation, a STOP button you can click on to stop the operation, or both.

To define a status dialog box, issue the following command:

*ABSET,Title40,Item

To update the status bar, issue the command *ABCHECK,Percent,NewTitle.

If you specify KILL or BOTH, your macro should check the _RETURN parameter after each execution of *ABCHECK to see if the user has pressed the STOP button, then take the appropriate action.

To remove the status bar from the ANSYS GUI, issue the *ABFINI command.

The following example macro illustrates the status bar (complete with bar and STOP button) in use. The status dialog box that is produced is shown in the following figure. Note that the macro checks the status of the _RETURN parameter and, if the STOP button is pressed, posts the "We are stopped......" message.

fini
/clear,nost
/prep7  
n,1,1
n,1000,1000
fill
*abset,'This is a Status Bar',BOTH
myparam = 0
*do,i,1,20
   j = 5*i
   *abcheck,j
   *if,_return,gt,0,then
     myparam = 1
   *endif
   *if,myparam,gt,0,exit
   /ang,,j
   nplot,1
   *if,_return,gt,0,then
     myparam = 1
   *endif
   *if,myparam,gt,0,exit
   nlist,all
   *if,_return,gt,0,then
     myparam = 1
   *endif
   *if,myparam,gt,0,exit
*enddo
*if,myparam,gt,0,then
*msg,ui
We are stopped.........
*endif
*abfinish
fini

Note

Do not call *ABCHECK more than about 20 times in a loop.

Figure 5.3  A Typical Status Dialog Box

Your Ad Here