!   TITLE:  config_3.mac (MANAGEMENT)
!
!
!   OBJECTIVE:
!
!   This macro stores (or restores) the current (or previous) configuration
!   of the database at an EXTRA configuration group, 3.
!   (i.e., the currently selected set of keypoints, lines, areas, volumes,
!                           nodes, elements, active CS and entity maximums)
!
!
!   COMMAND SYNTAX:
!
!                         (1)
!           CONFIG_3, save/restore
!
!
!   ARGUMENTS:
!
!       (1) save/restore = save OR restore the database configuration:
!
!             a.) 0 (or blank) = save the current selected solid model and
!                                finite element (FE) entities. (SAVE MODE)
!
!             b.) 1 = restore (select) the solid model and FE entities
!                     saved in the previous run of this macro in save mode.
!
!             c.) -1 = unselect the solid model and FE entities saved in the
!                      previous run of this macro in save mode.
!
!             d.) -2 = delete any currently saved configurations
!                      (i.e., delete all existing component groups created
!                           by this macro in save mode)
!
!
!   DESCRIPTION:
!
!   This is an additional set (group 3) of stored entities that may be used
!   for resetting the saved configuration.
!
!   (See 'DESCRIPTION' section of the help for macro CONFIGURATION.MAC)
!
!
!
*get,prkey_,active,0,prkey
/nopr
!
save3___=arg1
!
*if,save3___,eq,0,then
    *get,acs3____,active,,csys
    !
    kmhld3__=km
    lmhld3__=lm
    amhld3__=am
    vmhld3__=vm
    nmhld3__=nm
    emhld3__=em
    !
    cm,kgrp3___,kp
    cm,lgrp3___,line
    cm,agrp3___,area
    cm,vgrp3___,volu
    cm,ngrp3___,node
    cm,egrp3___,elem
    !
    cmgrp,curgrp3_,kgrp3___,lgrp3___,agrp3___,vgrp3___,ngrp3___,egrp3___
*elseif,save3___,eq,1,then
    !
    ! Type of component Cname:
    !       1=Nodes, 2=Elements, 6=Keypoints, 7=Lines, 8=Areas, 9=Volumes,
    !       11-15=Subcomponents
    !       (11=subcomponent at level 1, 12=subcomponent at level 2, etc.).
    !
    *get,ktyp____,comp,kgrp3___,type
    *get,ltyp____,comp,lgrp3___,type
    *get,atyp____,comp,agrp3___,type
    *get,vtyp____,comp,vgrp3___,type
    *get,ntyp____,comp,ngrp3___,type
    *get,etyp____,comp,egrp3___,type
    !
    *if,ktyp____,eq,6,then
        cmsel,s,kgrp3___
    *endif
    !
    *if,ltyp____,eq,7,then
        cmsel,s,lgrp3___
    *endif
    !
    *if,atyp____,eq,8,then
        cmsel,s,agrp3___
    *endif
    !
    *if,vtyp____,eq,9,then
        cmsel,s,vgrp3___
    *endif
    !
    *if,ntyp____,eq,1,then
        cmsel,s,ngrp3___
    *endif
    !
    *if,etyp____,eq,2,then
        cmsel,s,egrp3___
    *endif
    !
    km=kmhld3__
    lm=lmhld3__
    am=amhld3__
    vm=vmhld3__
    nm=nmhld3__
    em=emhld3__
    !
    csys,acs3____
    !
    *set,ktyp____
    *set,ltyp____
    *set,atyp____
    *set,vtyp____
    *set,ntyp____
    *set,etyp____
*elseif,save3___,eq,-1,then
    cmsel,u,curgrp3_
*elseif,save3___,eq,-2,then
    cmdele,kgrp3___
    cmdele,lgrp3___
    cmdele,agrp3___
    cmdele,vgrp3___
    cmdele,ngrp3___
    cmdele,egrp3___
    cmdele,curgrp3_
    *set,acs3____
*endif
!
*set,save3___,
!
/replot
!
*if,prkey_,eq,1,then
    /go
*endif