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

! *** primary function: set the units to the requested system

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

!  input arguments:
!   _unitloc   (arg1)    (int,sc)      unit system:
!                                        1 - mks (SI)
!                                        2 - cgs
!                                        3 - BFT
!                                        4 - BIN
!                                        5 - MPa

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


/nopr
_SUCCESS=1

! --- debug
*if,_DEBUG,gt,0,then
!{
   /gopr
   *vwrite,arg1
   (' === MTunits    unitloc =',f3.0)
   *if,_DEBUG,lt,3,then
   !{
      /nopr
   !}
   *endif
!}
*endif

! --- check arguments
_unitloc = ARG1
*if,_unitloc,lt,1,then
!{
   *msg,error,_unitloc
   MTunits error: unitloc is %i
   _SUCCESS=0
!}
*elseif,_unitloc,gt,_MAXUNIT,then
!{
   *msg,error,_unitloc
   MTunits error: unitloc is %i
   _SUCCESS=0
!}
*endif

! call to add the appropriate load
*if,_SUCCESS,gt,0,then
!{
   _CURUNIT=_unitloc
   _SUCCESS=0

   *if,_DEBUG,gt,0,then
   !{
      /gopr
      /com, === leave MTunits:
      _namdbg1=_UNITNAM(_CURUNIT,1)
      _namdbg2=_UNITNAM(_CURUNIT,2)
      *vwrite,_CURUNIT,_namdbg1,_namdbg2
      ('    CURUNIT =',f3.0,'  Name =',2a)
      *del,_namdbg1
      *del,_namdbg2
   !}
   *endif

!}
*endif

! delete local variables
*del,_unitloc
*del,_setup
! test of checkin
