!   TITLE:  v_sub_v.mac (SM_TOOL)
!
!
!   OBJECTIVE:
!
!   This sub-macro executes the booleam operation:  volume-subtract-volume.
!
!
!   COMMAND SYNTAX:
!
!                (1) (2)  (3)    (4)      (5)
!       V_SUB_V, V1, V2, sepo, keep_v1, keep_v2
!
!
!   ARGUMENTS:
!
!       (1) V1 = volume(s) to subtract from.
!                (if a component group name is used, it must be entered
!                                       in single quotes)
!
!       (2) V2 = volume(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 volumes of V1 and V2:
!
!               0 (or blank) = V1 and V2 will share their common areas
!                              where they touch. (DEFAULT)
!
!               1 = volumes V1 and V2 will have separate, but coincident,
!                            areas where they touch.
!
!       (4) keep_V1 = boolean to determine whether to keep/delete volume(s)
!                     V1.
!
!               0 (or blank) = delete the original volume(s), V1, after the
!                              subtraction operation. (DEFAULT)
!
!               1 = keep the original volume(s), V1, after the subtraction
!                   operation.
!
!       (5) keep_V2 = boolean to determine whether to keep/delete volume(s)
!                     V2.
!
!               0 (or blank) = delete the original volume(s), V2, after the
!                              subtraction operation. (DEFAULT)
!
!               1 = keep the original volume(s), V2, after the subtraction
!                   operation.
!
!
!   DESCRIPTION:
!
!   This macro executes the VSBV command in ANSYS. Its argument structure is
!   identical in use and sequence as VSBV, but has more common default uses,
!   and uses boolean inputs (0 or 1) in place of the VSBV command character
!   inputs of arguments 3, 4 and 5: 'sepo', 'keep' and 'delete'. (See VSBV
!   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 volumes and share their common areas where
!        they intersect." (vsbv,V1,V2,,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:
!
!                           vsbv,V1,V2,,delete,delete
!                           init_entity_num
!                           aplot
!
!   may be replaced with the single line of this macro:
!
!                           v_sub_v,V1,V2
!
!
!
*get,prkey_,active,0,prkey
/nopr
!
v1__=arg1
v2__=arg2
sep__=arg3
keepv1__=arg4
keepv2__=arg5
!
*if,sep__,eq,1,then
    sep__='sepo'
*endif
!
*if,keepv1__,eq,0,then
    keepv1__='delete'
*elseif,keepv1__,eq,1,then
    keepv1__='keep'
*endif
!
*if,keepv2__,eq,0,then
    keepv2__='delete'
*elseif,keepv2__,eq,1,then
    keepv2__='keep'
*endif
!
vsbv,v1__,v2__,sep__,keepv1__,keepv2__
init_entity_num
!
vplot
!
*set,v1__,
*set,v2__,
*set,sep__,
*set,keepv1__,
*set,keepv2__,
!
*if,prkey_,eq,1,then
    /go
*endif