!   TITLE:  min_enty_dim.mac (MANAGEMENT)
!
!
!       Updated macro to use 'ENTITY_ARRAY' for querying minimum values.
!
!   OBJECTIVE:
!
!   This sub-macro is used to retrieve the minimum value of the dimension
!   of a specified entity within a selected set along with the entity number.
!
!   COMMAND SYNTAX:
!
!                       (1)
!       MIN_ENTY_DIM, ent_typ
!
!
!   ARGUMENTS:
!
!       (1) ent_typ = entity type with which to retrieve minimum dimension
!                     value within [entity type must be in single quotes]:
!
!               'l' = retrieves the minimum length of all selected lines
!
!               'a' = retrieves the minimum area of all selected areas
!
!               'v' = retrieves the minimum volume of all selected volumes
!
!
!   DESCRIPTION:
!
!   The entity types that may be queried are:
!
!                       ENTITY      DIMENSION
!                      --------    -----------
!               (1)     line        line length
!               (2)     area        surface area
!               (3)     volume      volume
!
!   From within the selected set of any given entity, the minimum value of
!   its pertinent dimension, and the entity number with the minimum dimension,
!   is queried and returned in one of the corresponding sets of parameters,
!   respectively:
!
!                     DIMENSION      ENTITY NUMBER
!                    -----------     -------------
!               (1)   min_leng         min_lnum
!
!               (2)   min_area         min_anum
!
!               (3)   min_vol          min_vnum
!
!
!
*get,prkey_,active,0,prkey
/nopr
!
entity__=arg1
!
*if,entity__,eq,'a',then
    asum
*elseif,entity__,eq,'v',then
    vsum
*endif
!
!                          (1)     (2)   (3)  (4)   (5)    (6)   (7)
!           ENTITY_ARRAY, entity, aname, typ, dir, #rows, #col, #pln
!
!
entity_array,entity__,'min_arry','array',,,2
!
*if,entity__,eq,'l',then
    *do,ii__,1,ecount,1
        *get,min_arry(ii__,2),line,min_arry(ii__,1),leng
    *enddo
*elseif,entity__,eq,'a',then
    *do,ii__,1,ecount,1
        *get,min_arry(ii__,2),area,min_arry(ii__,1),area
    *enddo
*elseif,entity__,eq,'v',then
    *do,ii__,1,ecount,1
        *get,min_arry(ii__,2),volu,min_arry(ii__,1),volu
    *enddo
*endif
!
!                        (1)     (2) (3) (4) (5) (6) (7)
!       ARRY_MIN_VAL, 'arrynam', ri, rf, ci, cf, pi, pf
!
!
arry_min_val,'min_arry',,,2
!
*if,entity__,eq,'l',then
    min_leng=min_val
    min_lnum=min_arry(min_ir,1)
*elseif,entity__,eq,'a',then
    min_area=min_val
    min_anum=min_arry(min_ir,1)
*elseif,entity__,eq,'v',then
    min_vol=min_val
    min_vnum=min_arry(min_ir,1)
*endif
!
*set,min_arry(1),
*set,entity__,
*set,ecount,
*set,ii_,
*set,min_val,
*set,min_ir,
*set,min_ic,
*set,min_ip,
!
*if,prkey_,eq,1,then
    /go
*endif