      SUBROUTINE MYPLOT(X,Y,Z,IBC,LCDX,LCDY,DNX,DNY,DNZ,NCP,LCP,
     1NGPT,NDF,NELT,NLCP,NEXT,IWTYP)
      LOGICAL IGET,RGET
      COMMON/UNIT/II11,II22
      DIMENSION X(NGPT),Y(NGPT),Z(NGPT),IBC(NGPT),LCDX(NGPT),
     1LCDY(NGPT),DNX(NDF),DNY(NDF),DNZ(NDF),NCP(NELT),LCP(NLCP)
      DIMENSION IWTYP(NELT)
      COMMON /PLT/DUMMY(18),SCALE,IBCS,IFILE(4)
      COMMON/NSAP6/ISAP6,LOAD6,MODESH,FREQUE
      DATA BLANK/1H /,UUU/1HU/
      NUMBER=0
      LOAD6=0
      INEXT=-1
      XMIN=10.E+20
      XMAX=-10.E+20
      XLEN=0.
      YMIN=XMIN
      YMAX=XMAX
      ZMIN=XMIN
      ZMAX=XMAX
      DEFMAX=0.
      MONE=-1
10    REWIND 19
      DO    20 I=1,NGPT
      READ(19)X(I),Y(I),Z(I)
      XMIN=AMIN1(X(I),XMIN)
      XMAX=AMAX1(X(I),XMAX)
      YMIN=AMIN1(Y(I),YMIN)
      YMAX=AMAX1(Y(I),YMAX)
      ZMIN=AMIN1(Z(I),ZMIN)
      ZMAX=AMAX1(Z(I),ZMAX)
20    CONTINUE
      XLL=ABS(XMAX-XMIN)
      YLL=ABS(YMAX-YMIN)
      ZLL=ABS(ZMAX-ZMIN)
      XLEN=AMAX1(XLEN,XLL,YLL,ZLL)
      REWIND 17
30    READ(17,END=   40)NE12,MTMTYP
      IWTYP(NE12)=MTMTYP
      GO TO    30
40    CONTINUE
      IF(ISAP6.NE.1)GO TO   160
      IF(NEXT.EQ.0)GO TO 250
      IF(IFILE(4).NE.32)GO TO   250
50    WRITE(*,   60)
60    FORMAT(' LOAD CASE OR MODE SHAPE NUMBER')
      IHAST=0
      WRITE(*,   70)
70    FORMAT(2H ?)
80    READ(*,*)LOAD6
      IF(LOAD6.EQ.0)DUMMY(16)=UUU
      IF(LOAD6.EQ.0)GO TO 250
      REWIND 32
      J6=1
90    READ(32,  100,END=  140,ERR=  120)IN6,IL6,P6X,P6Y,P6Z
100   FORMAT(2I5,3F20.10)
      IF(IL6.EQ.LOAD6)GO TO   110
      GO TO    90
110   DNX(J6)=P6X
      DNY(J6)=P6Y
      DNZ(J6)=P6Z
      DEFMAX=AMAX1(DEFMAX,ABS(P6X),ABS(P6Y),ABS(P6Z))
      IHAST=1
      J6=J6+1
      IF(J6.GT.NGPT)GO TO   140
      GO TO    90
120   CONTINUE
      WRITE(*,  130)
130   FORMAT('  INPUT CONVERSION ERROR ON UNIT 32 ')
      GO TO   250
140   IF(IHAST.EQ.1)GO TO   250
      WRITE(*,  150)LOAD6
150   FORMAT(' LOAD CASE OR MODE SHAPE = ',I4,' DOES NOT EXIST')
      GO TO    50
160   IF(IFILE(4).EQ.0)GO TO   250
      IF(NUMBER.EQ.0)GO TO 250
170   IF(NUMBER.EQ.1)GO TO   200
      IRX=2
      READ(33,210,END=340,ERR=340)IDUM
      IF(IDUM.EQ.MONE)IRX=3
      NUMBER=NUMBER-1
      REWIND 33
      DO 175 I=1,NUMBER
      DO 173 K=1,NGPT
      DO 173 J=1,IRX
173   READ(33,210)
      READ(33,210)
175   CONTINUE
200   READ(33,  210)I
210   FORMAT(I5)
      IF(I.EQ.0)GO TO   250
      IF(I.NE.MONE)GO TO   230
      BACKSPACE 33
      READ(33,  220)I,MODESH,FREQUE
220   FORMAT(2I5,F20.10)
      READ(33,  210)I
230   READ(33,  240)DNX(I),DNY(I),DNZ(I)
      DEFMAX=AMAX1(DEFMAX,ABS(DNX(I)),ABS(DNY(I)),
     &ABS(DNZ(I)))
240   FORMAT(F20.10,1X,F20.10,1X,F20.10)
      GO TO   200
250   N1=1
      IF(NEXT.EQ.1)GO TO 262
      DO   260 I=1,NELT
      READ(19)NCP(I)
      IF(NCP(I).EQ.0)GO TO   260
      N2=N1+NCP(I)-1
      READ(19)(LCP(J),J=N1,N2)
      N1=N2+1
260   CONTINUE
262   CONTINUE
      MAXL=1
      IF(INEXT.GE.1)GO TO 280
      IF(DEFMAX.NE.0.0)GO TO   270
      SCALE=0.0
      GO TO   280
270   SCALE=XLEN/(10.*DEFMAX)
280   CALL ELTPLT(NLCP,NDF,MAXL,NGPT,NELT,NCP,LCP,X,Y,Z,DNX,DNY,DNZ
     1,LCDX,LCDY,IBC,IWTYP,NEXT)
      IF(IFILE(4).EQ.0)GO TO   320
      INEXT=INEXT+1
      NEXT=1
      IF(ISAP6.EQ.1)GO TO    40
      WRITE(*,  290)
290   FORMAT('  INPUT STEP NUMBER ','?')
300   FORMAT(' ?')
310   CALL GETNL(GET001)
      IF(IGET(NUMBER))GO TO   310
      IF(NUMBER.LT.0)NUMBER=0
      LOAD6=NUMBER
      IF(NUMBER.EQ.0)DUMMY(16)=UUU
      GO TO    40
320   WRITE(*,  330)
330   FORMAT(' THE DEFLECTED-SHAPE FILE IS EMPTY.')
      CALL BELL
      DUMMY(16)=UUU
      RETURN
340   NEXT=0
      WRITE(*,  350)
350   FORMAT(' THE DEFLECTED-SHAPE FILE CONTAINS NO MORE DATA')
      RETURN
      END
