! pilesel,type                                                   tbl
!
! Selects all pile elements (MATRIX27 with relevant KEYOPT)
!
! type     
!         = 0, for stiffness (default)
!         = 1, for mass                     
!
! Notes
!

/nopr

_type=arg1
*if,_type,ne,1,then
   _type=0
*endif

! --- scan through all element types and retain only MATRIX27
_maxEtypes=ETYIQR(0,14)
esel,none

*if,_maxEtypes,gt,0,then
   *do,_et,1,_maxEtypes
      *if,ETYIQR(_et,1),le,0,cycle
      *get,_etype,ETYP,_et,ATTR,ENAM
      *if,_etype,ne,27,cycle
      *get,_kopt3,ETYP,_et,ATTR,KOP3

!--- KEYOPT(3)=4 for stiffness
      *if,_type,eq,0,then
         *if,_kopt3,ne,4,cycle

!--- KEYOPT(3)=2 for mass
      *else
         *if,_kopt3,ne,2,cycle
      *endif

      esel,a,TYPE,,_et
   *enddo
*endif

*if,ELMIQR(0,13),eq,0,then
   *if,_type,eq,0,then
      *msg,warn
No pile stiffness elements are selected. These must be MATRIX27 with KEYOPT(3)=4.
   *else
      *msg,warn
No pile mass elements are selected. These must be MATRIX27 with KEYOPT(3)=2.
   *endif
*endif

_type=
_maxEtypes=
_et=
_etype=
_kopt3=

/go
