!   TITLE:  radial_asel.mac (MANAGEMENT)
!
!
!   OBJECTIVE:
!
!   This sub-macro selects an area, or set of areas, by radial position.
!
!   COMMAND SYNTAX:
!
!                      (1)   (2)   (3)   (4)    (5)   (6)    (7)   (8)
!        RADIAL_ASEL, stype, acs, rlow, rhigh, alow, ahigh, zlow, zhigh
!
!
!   ARGUMENTS:
!
!       (1) stype = label outlining the selection type
!
!                   'u' = unselect
!                   's' = select
!                   'r' = reselect
!
!       (2) acs = active cylindrical C.S. in which selection process occurs
!
!       (3) rlow = lower limit radius of envelope
!
!       (4) rhigh = upper limit radius of envelope
!
!       (5) alow = lower limit angle of envelope
!
!       (6) ahigh = upper limit angle of envelope
!
!       (7) zlow = lower limit axial position of envelope
!
!       (8) zhigh = upper limit axial position of envelope
!
!
!   DESCRIPTION:
!
!   This macro allows a user to specify radial and angular position limits
!   of an area(s) without knowledge of the area centroid.  It is useful for
!   arc-shaped areas where the centoid is off of the area.
!
!   This macro uses the keypoint positions and their attached lines to select,
!   reselect and unselect the area(s) in question. Therefore, the envelope
!   containing the area boundary keypoints is used to either select, unselect
!   or reselect the desired area(s).
!
!
!
!
*get,prkey_,active,0,prkey
/nopr

cm,kset2_,kp
cm,lset2_,line
!
cm,aset1_,area
!
typ_=arg1
acs_=arg2
rlow_=arg3
rhigh_=arg4
alow_=arg5
ahigh_=arg6
zlow_=arg7
zhigh_=arg8
!
!
*get,actcs_,active,,csys
!
csys,acs_
!
ksel,s,loc,x,rlow_,rhigh_
ksel,r,loc,y,alow_,ahigh_
ksel,r,loc,z,zlow_,zhigh_
!
lslk,s,1
!
*if,typ_,eq,'r',then
    asll,r,1
*else
    asll,s,1
*endif
!
*get,acount_,area,,count
!
*if,acount_,eq,0,then
    *if,typ_,eq,'r',then
        asll,r,0
    *else
        asll,s,0
    *endif
*endif
!
*if,typ_,eq,'u',then
    cm,aset2_,area
    cmsel,s,aset1_
    cmsel,u,aset2_
*endif
!
cmsel,s,kset2_
cmsel,s,lset2_
!
csys,actcs_
!
*set,acount_,
*set,actcs_,
*set,acs_,
*set,rlow_,
*set,rhigh_,
*set,alow_,
*set,ahigh_,
*set,zlow_,
*set,zhigh_,
cmdele,aset1_
cmdele,aset2_
cmdele,kset2_
cmdele,lset2_

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