!   TITLE:  tv_isolate_areas.mac (MANAGEMENT)
!
!
!   TOOLBAR VERSION
!
!   This sub-macro is used to isolate (select out) a set of areas (and
!   associated lines and keypoints) that are to be used in the creation
!   of a new volume (e.g., using the 'VA' command). These lines are
!   unattached to any volumes that may already exist. The remaining solid
!   model entities are maintained unselected and therefore do not inter-
!   fere with these areas to be operated on to create new volumes.
!
!
*get,prkey_,active,0,prkey
/nopr

allsel,all                  ! selects all existing entities
!
*if,kp_pssof,gt,0,then      ! unselects all previous model entities
    ksel,u,kp,,_kset_
*endif
!
*if,ln_pssof,gt,0,then
    lsel,u,line,,_lset_
*endif
!
*if,ar_pssof,gt,0,then
    asel,u,area,,_aset_
*endif
!
*if,vl_pssof,gt,0,then
    vsel,u,volu,,_vset_
*endif
!
*if,el_pssof,gt,0,then
    esel,u,elem,,_eset_
*endif
!
*if,nd_pssof,gt,0,then
    nsel,u,node,,_ndset_
*endif
!
*get,vm,volu,,num,max
!
*if,vm,ne,vmu,then              ! decision: 'There exists new volumes?'
    !
    cm,vset_100,volu            ! store new volumes in a group
    !
    aslv,selv                   ! store all existing entities associated with
        cm,aset_100,area        ! all existing new volumes in groups
    lsla,selv
        cm,lset_100,line
    ksll,selv
        cm,kset_100,kp
    !
    allsel,all                  ! selects all existing entities
    !
    *if,kp_pssof,gt,0,then      ! unselects all previous model entities
        ksel,u,kp,,_kset_
    *endif
    !
    *if,ln_pssof,gt,0,then
        lsel,u,line,,_lset_
    *endif
    !
    *if,ar_pssof,gt,0,then
        asel,u,area,,_aset_
    *endif
    !
    *if,vl_pssof,gt,0,then
        vsel,u,volu,,_vset_
    *endif
    !
    *if,el_pssof,gt,0,then
        esel,u,elem,,_eset_
    *endif
    !
    *if,nd_pssof,gt,0,then
        nsel,u,node,,_ndset_
    *endif
    !
    vsel,u,volu,,vset_100       ! unselects all existing solid model entities
    asel,u,area,,aset_100       ! associated with new volumes
    lsel,u,line,,lset_100
    ksel,u,kp,,kset_100
*endif
!
*get,am,area,,num,max           ! store maximum area # in 'am'
*get,lm,line,,num,max           ! store maximum line # in 'lm'
*get,km,kp,,num,max             ! store maximum keypoint # in 'km'
!
*if,am,ne,0,then
    _usecntr=1
    ar_tog_=1
    /PNUM,AREA,ar_tog_
    aplot
*else
    _usecntr=1
    ln_tog_=1
    /PNUM,LINE,ln_tog_
    lplot
*endif
!
cmdele,vset_100
cmdele,aset_100
cmdele,lset_100
cmdele,kset_100

*if,prkey_,eq,1,then
    /go
*endif