!   TITLE:  glu_ar_attr.mac (MANAGEMENT)
!
!
!   OBJECTIVE:
!
!   This sub-macro performs a glue operation on a selected set of areas and
!   transfers the original attributes to those same areas after the glue.
!
!
!   COMMAND SYNTAX:
!
!        GLU_AR_ATTR
!
!
!   DESCRIPTION:
!
!   The area attributes of the original set of areas are stored and reassigned
!   to the resulting areas occupying the same area-space as the original areas
!   before the glue operation. This allows the transfer of area information of
!   the original parts to be transferred to the the resulting areas with new
!   area numbers.
!
!
!
*get,prkey_,active,0,prkey
/nopr
!
cm,CA001,area
*get,actcs_,active,,csys
!
entity_array,'a','arset_','array',1,,8,1    ! ar, mat, R, typ, esys, x, y, z
numar_=ecount
!
*do,klm_,1,numar_,1
    cmsel,s,CA001
    !
    *get,amat_,area,arset_(klm_,1),attr,mat
    *get,areal_,area,arset_(klm_,1),attr,real
    *get,atyp_,area,arset_(klm_,1),attr,type
    *get,aesys_,area,arset_(klm_,1),attr,esys
    !
    arset_(klm_,2)=amat_
    arset_(klm_,3)=areal_
    arset_(klm_,4)=atyp_
    arset_(klm_,5)=aesys_
    !
    asel,s,area,,arset_(klm_,1)
    asum
    !
    csys,0
    !
    *get,acx_,area,,cent,x
    *get,acy_,area,,cent,y
    *get,acz_,area,,cent,z
    !
    arset_(klm_,6)=acx_
    arset_(klm_,7)=acy_
    arset_(klm_,8)=acz_
*enddo
!
cmsel,s,CA001
!
aglue,all
!
cm,CAglu_,area
!
csys,0
!
*do,klm_,1,numar_,1
    cmsel,s,CAglu_
    asel,r,loc,x,arset_(klm_,6)
    asel,r,loc,y,arset_(klm_,7)
    asel,r,loc,z,arset_(klm_,8)
    !
    amat_=arset_(klm_,2)
    areal_=arset_(klm_,3)
    atyp_=arset_(klm_,4)
    aesys_=arset_(klm_,5)
    !
    aatt,amat_,areal_,atyp_,aesys_
*enddo
!
init_entity_num
!
csys,actcs_
!
lplot
!
*set,klm_,
*set,amat_,
*set,areal_,
*set,atyp_,
*set,aesys_,
*set,numar_,
*set,ecount,
*set,acx_,
*set,acy_,
*set,acz_,
*set,arset_(1),
cmdele,CA001
!
*if,prkey_,eq,1,then
    /go
*endif