      SUBROUTINE GRAFIX(NT,NN,NB,X,F)
      LOGICAL ISENSW
      DIMENSION PNODE(10,3),IVECT(100),DIR(3),PERP(3),DIR2(3)
      DIMENSION F(10,3),X(10,3)
      COMMON/BULK/I3S,LN3,OBJ(3,60)
      COMMON/EYCEP/EYE(3),CEN(3),UP(3)
      COMMON/PAINT/I2S,IDUM,PICT(2,60)
      COMMON/GENDAT/MCON(20,2),NTYPE(20),BSCALE(20),
     9KOLOR(20),IDENT(20)
      COMMON/MODDAT/IAX,DIST,SMODEL(7,17,2),MODNO(10)
C
C  OUTPUT TO SCREEN
      DO 15 J=1,NB
15    CALL DISPLY(3,J)
      I2S=1
      I3S=1
C
C  CALC. COORDS OF ALL NODES.
C
      DO 4000 K=1,3
4000  PNODE(NN,K)=0.0
      DO 4100 I=1,NT
      NODEF=MCON(I,1)
      DO 4100 K=1,3
      PNODE(I,K)=PNODE(NODEF,K)+X(I,K)
4100  CONTINUE
C
C
C  BEGIN LOOP FOR LINE MATRIX FOR GRAPHIC OUTPUT.
      DO 4800 I=1,NB
      NODEF=MCON(I,1)
      NODEL=MCON(I,2)
      ISYM=NTYPE(I)
      LN=MODNO(ISYM)
      LN3=LN/2+1
      IF(ISYM.EQ.10)GO TO 4800
      IF(ISYM.EQ.9)GO TO 4500
      IF(ISYM.NE.7)GO TO 4998
C    ---DIR. COS. FOR FORCE ARROW.
      R1=F(I,1)*F(I,1)+F(I,2)*F(I,2)+F(I,3)*F(I,3)
      IF(R1.EQ.0.0)GO TO 4800
      R1=-SQRT(R1)
      DIR(1)=F(I,1)/R1
      DIR(2)=F(I,2)/R1
      DIR(3)=F(I,3)/R1
      GO TO 4999
C   CALC DIRECTION COSINES.
4998  R1=SQRT(X(I,1)*X(I,1)+X(I,2)*X(I,2)+X(I,3)*X(I,3))
      DIR(1)=X(I,1)/R1
      DIR(2)=X(I,2)/R1
      DIR(3)=X(I,3)/R1
4999  CONTINUE
      X2=PNODE(NODEL,1)-EYE(1)
      Y2=PNODE(NODEL,2)-EYE(2)
      Z2=PNODE(NODEL,3)-EYE(3)
      R2=SQRT(X2*X2+Y2*Y2+Z2*Z2)
      ALFA2=X2/R2
      BETA2=Y2/R2
      GAMA2=Z2/R2
      FAC1=DIR(1)*ALFA2+DIR(2)*BETA2+DIR(3)*GAMA2
      FAC2=1./SQRT(1.-FAC1*FAC1)
C  DIR. COS. FOR R3
      PERP(1)=FAC2*(DIR(2)*GAMA2-DIR(3)*BETA2)
      PERP(2)=FAC2*(DIR(3)*ALFA2-DIR(1)*GAMA2)
      PERP(3)=FAC2*(DIR(1)*BETA2-DIR(2)*ALFA2)
CC  PUT END-PTS OF LINES IN MATRIX OBJ.
      IF(ISYM.GT.3)GO TO 4300
C  END-PTS OF LINES FOR VETOR SYMBOLS
      DO 4200 J=1,LN
      DO 4200 K=1,3
      OBJ(K,J)=PNODE(NODEF,K)+X(I,K)*SMODEL(ISYM,J
     9,1)+PERP(K)*BSCALE(I)*SMODEL(ISYM,J,2)
C
4200  CONTINUE
      GO TO 76
C  END-PTS OF LINES FOR POINT SYMBOLS
4300  CONTINUE
      DIR2(1)=BETA2*PERP(3)-GAMA2*PERP(2)
      DIR2(2)=GAMA2*PERP(1)-ALFA2*PERP(3)
      DIR2(3)=ALFA2*PERP(2)-BETA2*PERP(1)
      DO 4400 J=1,LN
      DO 4400 K=1,3
      OBJ(K,J)=PNODE(NODEL,K)+BSCALE(I)*(DIR2(K)*SMODEL(ISYM
     1,J,1)+PERP(K)*SMODEL(ISYM,J,2))
C
4400  CONTINUE
      GO TO 76
C  END-PTS OF A LINE.
4500  LN=2
      LN3=1
      DO 4600 K=1,3
      OBJ(K,1)=PNODE(NODEF,K)
      OBJ(K,2)=PNODE(NODEL,K)
4600  CONTINUE
76    CALL MAPPER(DIST)
C  PASS OBJ TO PERSPECTIVE ROUTINE.
      CALL VECTOR(3,PICT,I2S,LN,IVECT,1,LAST,7,0,0)
      CALL DISPLY(6,I,IVECT,1,LAST)
C
4800  CONTINUE
C  --- CHECK FOR FILM OPTION---
      IF(ISENSW(13))GO TO 90
C  ---REPLAY---
      CALL  PULSE(MX,MX)
      RETURN
C  ---FILM---
90    CALL CAMERA(NB)
      RETURN
      END
