! abelem4

! read ABAQUS 4-node quad *ELEMENTs and translate to ANSYS commands
!     Input:
!       _buffer    - buffer containing the ABAQUS file
!     Output:
!       *vwrite of the ANSYS commands
!     Input/Output:
!       _curline   - current line of the file
!       _readnext  - if 1, read a new line    0, process the current one

! read the elements
*dowhile,_readnext
   _curline = _curline + 1
   *if,_curline,gt,_nlines,then
      _readnext = 0
      *cycle
   *endif
   _lineIn(1) = _buffer(1,_curline)
   _c1=_buffer(1,_curline)
   ! check for a "*"
   _tt = STRSUB(_c1,1,1)
   *if,_tt,eq,'*',then
      ! check if comment - just add to input file as an ANSYS comment
      _tt = STRSUB(_c1,1,2)
      *if,_tt,eq,'**',then
         *vwrite,_lineIn(1)
! %C
         *cycle
      *endif
      ! it is a keyword - indicates that we've read these nodes in
      *if,_cmname,ne,' ',and,_nnodes,gt,0,then
         ! create the component if there was an ELSET=
         *vwrite,_cmname
         CM,e_%C,ELEMENT
      *endif
      *vwrite
      ('ESEL,ALL')
      _readnext = 0            ! we've already processed this line
      *cycle
   *endif
   *vwrite,_lineIn(1)
EN,%C
*enddo

_cmname=
_enum=
_tt=
_n=
_n1= $_n2= $_n3= $_n4= $_n5= $_n6= $_n7= $_n8= $_n9= $_n10=
