!   TITLE:  a_sub_a.mac (SM_TOOL)
!
!
!   OBJECTIVE:
!
!   This sub-macro executes the booleam operation:  area-subtract-area.
!
!
!   COMMAND SYNTAX:
!
!               (1) (2)   (3)    (4)      (5)
!       a_sub_a, A1, A2, sepo, keep_A1, keep_A2
!
!
!   ARGUMENTS:
!
!       (1) A1 = area(s) to subtract from.
!                (if a component group name is used, it must be entered
!                                       in single quotes)
!
!       (2) A2 = area(s) to subtract.
!                (if a component group name is used, it must be entered
!                                       in single quotes)
!
!       (3) sepo = behavior at the intersection of the areas of A1 and A2:
!
!               0 (or blank) = A1 and A2 will share their common lines
!                              where they touch. (DEFAULT)
!
!               1 = areas A1 and A2 will have separate, but coincident,
!                            lines where they touch.
!
!       (4) keep_A1 = boolean to determine whether to keep/delete area(s)
!                     A1.
!
!               0 (or blank) = delete the original area(s), A1, after the
!                              subtraction operation. (DEFAULT)
!
!               1 = keep the original area(s), A1, after the subtraction
!                   operation.
!
!       (5) keep_A2 = boolean to determine whether to keep/delete area(s)
!                     A2.
!
!               0 (or blank) = delete the original area(s), A2, after the
!                              subtraction operation. (DEFAULT)
!
!               1 = keep the original area(s), A2, after the subtraction
!                   operation.
!
!
!   DESCRIPTION:
!
!   This macro executes the ASBA command in ANSYS. Its argument structure is
!   identical in use and sequence as ASBA, but has more common default uses,
!   and uses boolean inputs (0 or 1) in place of the ASBA command character
!   inputs of arguments 3, 4 and 5: 'sepo', 'keep' and 'delete'. (See ASBA
!   help for oomparison)
!
!   It is a short-hand version that alleviates the common use of arguments 3, 4
!   and 5. The defaults of these arguments in this macro that are commonly used:
!
!       "Delete the original areas and share their common lines where
!        they intersect." (asba,A1,A2,,delete,delete)
!
!   The other options for these arguments may be excercised by simple boolean
!   selections of 0 or 1.
!
!   The added advantage and rationale for this macro command is the automatic
!   update of the solid model entities maximums (INIT_ENTITY_NUM is used
!   internally), thereby eliminating essentially 2 lines of code with the use
!   of 1. Therefore the lines of code:
!
!                           asba,A1,A2,,delete,delete
!                           init_entity_num
!                           aplot
!
!   may be replaced with the single line of this macro:
!
!                           a_sub_a,A1,A2
!
!
!
*get,prkey_,active,0,prkey
/nopr
!
a1__=arg1
a2__=arg2
sep__=arg3
keepa1__=arg4
keepa2__=arg5
!
*if,sep__,eq,1,then
    sep__='sepo'
*endif
!
*if,keepa1__,eq,0,then
    keepa1__='delete'
*elseif,keepa1__,eq,1,then
    keepa1__='keep'
*endif
!
*if,keepa2__,eq,0,then
    keepa2__='delete'
*elseif,keepa2__,eq,1,then
    keepa2__='keep'
*endif
!
asba,a1__,a2__,sep__,keepa1__,keepa2__
init_entity_num
!
aplot
!
*set,a1__,
*set,a2__,
*set,sep__,
*set,keepa1__,
*set,keepa2__,
!
*if,prkey_,eq,1,then
    /go
*endif