!   TITLE:  config_1.mac (MANAGEMENT)
!
!
!   OBJECTIVE:
!
!   This macro stores (or restores) the current (or previous) configuration
!   of the database at an EXTRA configuration group, 1.
!   (i.e., the currently selected set of keypoints, lines, areas, volumes,
!                           nodes, elements, active CS and entity maximums)
!
!
!   COMMAND SYNTAX:
!
!                         (1)
!           CONFIG_1, 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 1) 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
!
save1___=arg1
!
*if,save1___,eq,0,then
    *get,acs1____,active,,csys
    !
    kmhld1__=km
    lmhld1__=lm
    amhld1__=am
    vmhld1__=vm
    nmhld1__=nm
    emhld1__=em
    !
    cm,kgrp1___,kp
    cm,lgrp1___,line
    cm,agrp1___,area
    cm,vgrp1___,volu
    cm,ngrp1___,node
    cm,egrp1___,elem
    !
    cmgrp,curgrp1_,kgrp1___,lgrp1___,agrp1___,vgrp1___,ngrp1___,egrp1___
*elseif,save1___,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,kgrp1___,type
    *get,ltyp____,comp,lgrp1___,type
    *get,atyp____,comp,agrp1___,type
    *get,vtyp____,comp,vgrp1___,type
    *get,ntyp____,comp,ngrp1___,type
    *get,etyp____,comp,egrp1___,type
    !
    *if,ktyp____,eq,6,then
        cmsel,s,kgrp1___
    *endif
    !
    *if,ltyp____,eq,7,then
        cmsel,s,lgrp1___
    *endif
    !
    *if,atyp____,eq,8,then
        cmsel,s,agrp1___
    *endif
    !
    *if,vtyp____,eq,9,then
        cmsel,s,vgrp1___
    *endif
    !
    *if,ntyp____,eq,1,then
        cmsel,s,ngrp1___
    *endif
    !
    *if,etyp____,eq,2,then
        cmsel,s,egrp1___
    *endif
    !
    km=kmhld1__
    lm=lmhld1__
    am=amhld1__
    vm=vmhld1__
    nm=nmhld1__
    em=emhld1__
    !
    csys,acs1____
    !
    *set,ktyp____
    *set,ltyp____
    *set,atyp____
    *set,vtyp____
    *set,ntyp____
    *set,etyp____
*elseif,save1___,eq,-1,then
    cmsel,u,curgrp1_
*elseif,save1___,eq,-2,then
    cmdele,kgrp1___
    cmdele,lgrp1___
    cmdele,agrp1___
    cmdele,vgrp1___
    cmdele,ngrp1___
    cmdele,egrp1___
    cmdele,curgrp1_
    *set,acs1____
*endif
!
*set,save1___,
!
/replot
!
*if,prkey_,eq,1,then
    /go
*endif