! ******************************
! $Revision: 145002 $
! $Date: 2009-11-13 11:20:27 -0500 (Fri, 13 Nov 2009) $
! ******************************
! macro MTbcsymb (_key, _krep)

! *** primary function: toggle the appropriate BC symbols on and off

! *** Notice - This file contains ANSYS Confidential information ***

!  input arguments:
!   _key       (arg1)    (int,sc)      0-do not show symbols;   1-show symbols
!   _krep      (arg2)    (int,sc)      0-no replot,   1-replot

!  output arguments:
!   _success            (int,sc)      =0 no success, =1 success  


/nopr
_SUCCESS=1

! --- debug
*if,_DEBUG,gt,0,then
!{
   /gopr
   *vwrite,arg1,arg2
   (' === MTbcsymb:    key =',f3.0,'   krep =',f3.0)
   *if,_DEBUG,lt,3,then
   !{
      /nopr
   !}
   *endif
!}
*endif

! --- check arguments
_key  = ARG1
_krep = ARG2
*if,_key,lt,0,then
!{
   *msg,error,_key
   MTbcsymb error: The show key is %i
   _SUCCESS=0
!}
*elseif,_key,gt,1,then
!{
   *msg,error,_key
   MTbcsymb error: The show key is %i
   _SUCCESS=0
!}
*endif

*if,_SUCCESS,gt,0,then
!{
   *if,_key,eq,1,then
      _SUCCESS=0
      *get,_xjunk,active,,keyword,,PR_STRUC
      *if,_xjunk,eq,1,then 
         !  structural
         /pbc,u,,1
         /pbc,rot,,1
         /pbc,f,,2
         /pbc,m,,2
         /pbc,acel,,2
         /pbc,omeg,,2
         /psf,pres,,2,1
         /pnum,sval,1
      *else
         !  thermal
         /pbc,temp,,2
         /color,temp,red     ! since default orange does not show well on gray
         /pbc,heat,,2
         /psf,conv,hcoef,1,1   ! face outlines since this covers most of the surfaces!
         /pnum,sval,1
         *if,_CURENV,gt,0,then
            ! check if should display HFLUX rather than CONV
            _ACTENV = '_ENV%_CURENV%'
            *vfill,_MASK2(1),ramp,0
            *voper,_MASK1(1),%_ACTENV%(1,18,1),ne,_MASK2(1)  !have a heat flux
            *vmask,_MASK1(1)
            *vscfun,_counta,num,%_ACTENV%(1,18,1)   !no. of areas with heat flux
            *voper,_MASK1(1),%_ACTENV%(1,18,2),ne,_MASK2(1)  !have a heat flux
            *vmask,_MASK1(1)
            *vscfun,_countl,num,%_ACTENV%(1,18,2)   !no. of lines with heat flux
            _count=_counta+_countl
            *if,_count,gt,0,then
               /psf,hflux,,2,1
            *endif
            *del,_count
            *del,_countl
            *del,_counta
         *endif
      *endif
      ! turn off numbering if POST1 and add reactions (static analysis only!)
      *get,_xjunk,active,,rout
      *if,_xjunk,eq,31,then
         /pnum,sval,0
         *get,_xjunk,active,,keyword,MODAL
         *if,_xjunk,eq,0,then
            /pbc,rfor,,2
            /pbc,rmom,,2
         *endif
      *endif
      !}
   *else
      _SUCCESS=0
      /pbc,u,,0
      /pbc,rot,,0
      /pbc,f,,0
      /pbc,m,,0
      /pbc,temp,,0
      /pbc,heat,,0
      /pbc,acel,,0
      /pbc,omeg,,0
      /pbc,rfor,,0
      /pbc,rmom,,0
      /psf,pres,,0,0
      /pnum,sval,0
      !}
   *endif

   *if,_krep,eq,1,then
      /replot
   *endif

   *if,_DEBUG,gt,0,then
   !{
      /gopr
      /com, === leave MTbcsymb
   !}
   *endif

!}
*endif
! Replot may have been disabled in MECHTOOL.AUI
/UIS,REPLO,1

! delete local variables
*del,_key
*del,_krep
