!   TITLE:  numbers_toggle.mac (MANAGEMENT)
!
!
!               Added the capability to do multiple number toggles before
!               exiting to main toolbar button layout.
!
!               Added the capability to toggle material numbers and/or
!               colors.
!
!               Added the capability to toggle the triad and area direction
!               vectors.
!
!
!
!   This sub-macro toggles entity numbers on/off. Called by
!   ENTITY_NUMBER_BUTTONS.
!
!
!
*get,prkey_,active,0,prkey
/nopr
!
*get,_usestat,parm,_usecntr,type
!
*if,_usestat,eq,-1,then
    _usecntr=1
    kp_tog_=0
    ln_tog_=0
    ar_tog_=0
    vl_tog_=0
    nd_tog_=0
    elm_tog_=0
    cs_tog_=0
    matntog_=0
    matctog_=0
    adirtog_=0
    triadtog=1
    *set,_usestat,
*endif
!
*if,arg1,eq,1,then
    *if,kp_tog_,eq,0,then
        kp_tog_=1
    *else
        kp_tog_=0
    *endif
    !
    /NUMBER,0
    /PNUM,KP,kp_tog_
    !
    *if,kp_tog_,eq,1,then
        lplot
    *else
        /replot
    *endif
*elseif,arg1,eq,2,then
    *if,ln_tog_,eq,0,then
        ln_tog_=1
    *else
        ln_tog_=0
    *endif
    !
    /NUMBER,0
    /PNUM,LINE,ln_tog_
    !
    *if,ln_tog_,eq,1,then
        lplot
    *else
        /replot
    *endif
*elseif,arg1,eq,3,then
    *if,ar_tog_,eq,0,then
        ar_tog_=1
    *else
        ar_tog_=0
    *endif
    !
    /NUMBER,0
    /PNUM,AREA,ar_tog_
    !
    *if,ar_tog_,eq,1,then
        aplot
    *else
        /replot
    *endif
*elseif,arg1,eq,4,then
    *if,vl_tog_,eq,0,then
        vl_tog_=1
    *else
        vl_tog_=0
    *endif
    !
    /NUMBER,0
    /PNUM,VOLU,vl_tog_
    !
    *if,vl_tog_,eq,1,then
        vplot
    *else
        /replot
    *endif
*elseif,arg1,eq,5,then
    *if,nd_tog_,eq,0,then
        nd_tog_=1
    *else
        nd_tog_=0
    *endif
    !
    /NUMBER,0
    /PNUM,NODE,nd_tog_
    !
    *if,nd_tog_,eq,1,then
        nplot
    *else
        /replot
    *endif
*elseif,arg1,eq,6,then
    *if,elm_tog_,eq,0,then
        elm_tog_=1
    *else
        elm_tog_=0
    *endif
    !
    /NUMBER,0
    /PNUM,ELEM,elm_tog_
    !
    *if,elm_tog_,eq,1,then
        eplot
    *else
        /replot
    *endif
    *if,matntog_,eq,0,then
        matntog_=1
    *else
        matntog_=0
    *endif
    !
    /NUMBER,0
    /PNUM,MAT,matntog_
    !
    *if,matntog_,eq,1,then
        eplot
    *else
        /replot
    *endif
    *if,matctog_,eq,0,then
        matctog_=1
    *else
        matctog_=0
    *endif
    !
    /NUMBER,1
    /PNUM,MAT,matctog_
    !
    *if,matctog_,eq,1,then
        eplot
    *else
        /replot
    *endif
*elseif,arg1,eq,9,then
    *if,cs_tog_,eq,0,then
        cs_tog_=1
    *else
        cs_tog_=0
    *endif
    !
    /PSYMB,CS,cs_tog_
    !
    *if,cs_tog_,eq,1,then
        lplot
    *else
        /replot
    *endif
*elseif,arg1,eq,10,then
    /PNUM,KP,0
    /PNUM,LINE,0
    /PNUM,AREA,0
    /PNUM,VOLU,0
    /PNUM,NODE,0
    /PNUM,ELEM,0
    /PSYMB,CS,0
    /PNUM,MAT,0
    *set,_usecntr,
    /replot
    entity_numbers
*elseif,arg1,eq,11,then
    *if,adirtog_,eq,0,then
        adirtog_=1
    *else
        adirtog_=0
    *endif
    !
    /PSYMB,ADIR,adirtog_
    !
    *if,adirtog_,eq,1,then
        aplot
    *else
        aplot
        /replot
    *endif
*elseif,arg1,eq,12,then
    *if,triadtog,eq,0,then
        triadtog=1
        tritog_='orig'
    *else
        triadtog=0
        tritog_='off'
    *endif
    !
    /TRIAD,tritog_
    !
    /replot
*endif
!
*set,_usestat,
!
    entity_number_buttons
*endif
!
*if,prkey_,eq,1,then
    /go
*endif