      SUBROUTINE TRACE(NBON,IOPT,GEOM,ITYP,IREFRE,IABAND,IBOUT,IBIT)
C
      INCLUDE 'com_boutons.f'
      INCLUDE 'com_coor.f'
      INCLUDE 'com_faces.f'
      INCLUDE 'com_ombreiso.f'
      INCLUDE 'com_options.f'
      INCLUDE 'com_savetrace.f'
      INCLUDE 'com_val.f'
C
      REAL*8    UU1,UU2,UU3,UU,UN,VN
      REAL*4    XXX(4),YYY(4),VV(4),VIVI(2)
      LOGICAL*4 ARET,ARETF,FRO,BLO,COLORIE,NOUVNU,NOUVFL,GEOM,FLTRID
     &         ,OLDFEN,NOUVAL
      INTEGER   IBBID(4)
      DATA IBBID / 1,1,1,1 /
      DATA US3   / .3333333333333333 /
C
      CALL TEMPS(UU1,IS0)
      XFMIN = BIG
      XFMAX = -BIG
      YFMIN = BIG
      YFMAX = -BIG
      IABAND = 0
      IF (ICTFAC.GT.15) THEN
        ICTFAC1 = 0
      ELSE
        ICTFAC1 = ICTFAC
      ENDIF
      ISOMBRE = 16
      FACSHR0 = .65
      NOUVNU  = INUMER.EQ.-1.AND.INUMER0.EQ.0
      NOUVAL  = IVALMAR.EQ.1.AND.IVALMAR0.EQ.0.AND.ISO.EQ.ISO0
     &                      .AND.ICENTRISO0.EQ.ICENTRISO
      FLTRID  = I2D.EQ.0.AND.IVIT.LT.0.AND.IFC.GE.0.AND.VITMAX.GT.0.
      NOUVFL  = IVIT.LT.0.AND.IVIT0.GT.0.AND.(.NOT.FLTRID)
      ARET    = (IBORD.NE.-1.OR.ISHRINK.LT.0).AND.IMAILL.GT.0
      FRO     = IFRONT.LT.0.AND.ISHRINK.GT.0
      BLO     = (IFRONT.EQ.1.OR.IFRONT.EQ.3).AND.IFBLO.NE.0
      COLORIE = I2D.EQ.0.OR.ICTFON.NE.ICTFAC.OR.ISO.EQ.1.OR.ISO.EQ.3
     &                  .OR.(IDEFOR.EQ.2.AND.FACEXA.NE.0.)
      CLIGNE  = ISAUVEGRAPH.EQ.0.AND.IPOST.NE.-2.AND.IBATCH.EQ.0
     &     .AND.(IOPT.NE.-2.OR.IABS(IANG(IANGLE)).GT.5)
      IF (ICENTR.EQ.0) THEN
        INTERPCENTRE = 0
      ELSE
        IF (ICENTRISO.EQ.0) THEN
          INTERPCENTRE = 1
        ELSE
          INTERPCENTRE = 0
        ENDIF
      ENDIF
C
      EPSLON  = XLARG*.001
      CALL CALCDIM(YYLAR,0)
C
      XSHIFT = (XDMAX-XHELP)*5.7E-3
      YSHIFT = XSHIFT
      CALL VRAIECOORD(XDMIN,YDMAX,IX0,IY0)
      CALL VRAIECOORD(XDMA2,YDMIN,IX1,IY1)
      ISHIFTX = (IX1-IX0)/2
      ISHIFTY = (IY1-IY0)/2
      IF (IBATCH.EQ.0) THEN
        IF (IX0.NE.IX00.OR.IX1.NE.IX10
     &  .OR.IY0.NE.IY00.OR.IY1.NE.IY10) THEN
ccc        print*,'ca passe',IX0,IX00,IX1,IX10,IY0,IY00,IY1,IY10
          OLDFEN = .FALSE.
ccc        GEOM = .FALSE.
          IREFRE = 1
          CALL x11szscrn(IDX,IDY)
          IX00 = IX0
          IX10 = IX1
          IY00 = IY0
          IY10 = IY1
          IF (IPOST.EQ.1.OR.IPOST.EQ.-2) THEN
            FAFA = MAX(REAL(IDX)/REAL(IDX0),REAL(IDY)/REAL(IDY0))
            CALL PTIFON(FAFA,IFONT0,IFONT1,IFONT2,IFONT3,IFONT4,IFONT5
     &                 ,IFONT7,IFONT8,IEPBOR)
          ENDIF
        ELSE
          OLDFEN = .TRUE.
        ENDIF
      ENDIF
      IF (IPOST.EQ.1.AND.CLIGNE) CALL CLNINF(1)
C
      ARETF = ARET
      IMAILLF = IMAILL
      IF ((ISO.NE.0.AND.(IFC.GE.0.OR.NSURF.GT.0))
     &.OR.(IVIT.LT.0.AND.ICTFLE.GT.15)) THEN
        IF (IVFIXE.EQ.0) CALL CREVAL(VAL,NBCOL,VMIN,VMAX)
        IF (ISOFRO.NE.0) THEN
          NBCBID = NBCOL-1
          IF (NBCBID.GT.0) THEN
cnew            VMIBID = VMIN + (VMAX-VMIN)/REAL(2*NBCOL)
cnew            VMABID = VMAX - (VMAX-VMIN)/REAL(2*NBCOL)
cnew            CALL CREVAL(VALFRO,NBCBID,VMIBID,VMABID)
            DO I=2,NBCOL
              VALFRO(I-1) = VAL(I)
            ENDDO
            ARETF = .FALSE.
            IMAILLF = 0
          ENDIF
        ELSEIF(ISO.EQ.2) THEN
          DO I=1,NBCOL
            VALFRO(I) = (VAL(I+1)+VAL(I))*.5
          ENDDO
        ENDIF
      ELSEIF((ICTFAC.EQ.97.OR.ICTFAC.EQ.96).AND.
     &   ((IFC.GE.0.AND.ISO.EQ.0).OR.(IFC.LT.0.AND.NSURF.GT.0))) THEN
        CALL CREVAL(VAL,NBCOL,0.,1.)
      ENDIF
      IF (IPOST.EQ.1) THEN
        CALL DEF_ZONE(XHELP,XDMAX,YDMI2,YDMAX,1)
        CALL DEF_ZONE(XDMIN,XHELP,YDMI2,YDMAX,0)
        IF (ITYP.NE.-14.AND.ISAUVEGRAPH.EQ.0.AND.IOPT.NE.-3) THEN
          CALL GSBND(XDMIN,XHELP,YDMI2,YDMAX)
          CALL HELP(XDMIN,XHELP,YDMI2,YDMAX,IREFRE,ITYP,IOPT,IBOUT)
        ENDIF
      ENDIF
      IF (IOPT.EQ.-3.OR.IFREEZE.NE.0) THEN
c        print*,'return1'
        RETURN
      ELSEIF(IOPT.EQ.0.AND.OLDFEN.AND.IPOST.EQ.1) THEN
        CALL GSBND(XDMIN,XDMA2,YDMIN,YDMAX)
c        print*,'return2'
        RETURN
      ENDIF
      IF (NPSUR.EQ.0) THEN
        TBOX = 0.01*MIN(XDMA2-XDMIN,YDMAX-YDMIN)
      ELSE
        TBOX = 0.007*FACPTS*MIN(XDMA2-XDMIN,YDMAX-YDMIN)
      ENDIF
      CALL GSMB(TBOX,TBOX)
C
Cfj      print*,iopt,ivit,ivit0,ipost,isauvegraph,nouval,nouvfl
Cfj     &     ,nouvnu,geom,ityp,icadps,idseul
      IF (IOPT.EQ.-1.OR.IVIT.LT.0.OR.IVIT0.LT.0.OR.IPOST.LT.0.OR.
     &     (IPOST.GT.0.AND.ISAUVEGRAPH.EQ.0
     &     .AND.(.NOT.NOUVAL).AND.(.NOT.NOUVFL)
     &     .AND.(.NOT.NOUVNU).AND.(.NOT.GEOM).AND.ITYP.EQ.0)) THEN
        IF (IPOST.LT.0.AND.(ICADPS.LE.0.OR.IDSEUL.EQ.1)) THEN
          IIIINFO = 0
        ELSE
          CALL INFO(XDMAX,XDMA2,YDMIN,YDMAX,NSURF)
          IIIINFO = 1
        ENDIF
      ELSE
        IIIINFO = 0
      ENDIF
C
      ICENTRISO0 = ICENTRISO
      INUMER0    = INUMER
      ISO0       = ISO
      IVALMAR0   = IVALMAR
      IVIT0      = IVIT
C
      IF ((IPOST.LT.0.AND.IDSEUL.EQ.2).OR.
     &    (IOPT.EQ.-1.AND.OLDFEN.AND.IPOST.EQ.1)) THEN
        CALL GSBND(XDMIN,XDMA2,YDMIN,YDMAX)
        IF (IPOST.LT.0) THEN
          CALL CHANGE_CURS(1)
          CALL METS_CURSEUR(XMIL,YMIL)
        ENDIF
c        print*,'return3'
        RETURN
      ENDIF
C
      ICTFAC0 = ICTFAC1
      IF (IPOST.EQ.1.OR.IDSEUL.EQ.0) THEN
        CALL GSBND(XHELP,XDMAX,YDMIN,YDMAX)
      ELSE
        CALL GSBND(XXMIN,XXMAX,YYMIN,YYMAX)
      ENDIF
C
      IF (IPROGRE.LT.0.AND.(IPOST.EQ.1.OR.IPOST.EQ.-2)) THEN
        NOUVFL = NOUVFL.AND.IIIINFO.EQ.0
        CALL GSPROGRE(2)
        CALL VRAIECOORD(XHELP,YDMAX,IX0,IY0)
        CALL VRAIECOORD(XDMAX,YDMIN,IX1,IY1)
        IF (IPOST.NE.-2) THEN
          IX0 = IX0+IEPBOR/2
          IY0 = IY0+IEPBOR/2
          IX1 = IX1-IEPBOR/2
          IY1 = IY1-IEPBOR/2
        ENDIF
        ILARG = IX1-IX0
        IHAUT = IY1-IY0
        CALL SHIFT_ORIG(ISHIFTX,ISHIFTY)
        CALL GSBND(XHELP*2.-XDMAX,XDMAX*2.-XHELP
     &            ,YDMIN*2.-YDMAX,YDMAX*2.-YDMIN)
        IF ((.NOT.NOUVAL).AND.(.NOT.NOUVFL)) THEN
          CALL GSPATF(ICTFON)
          CALL GSPAT(16)
          CALL MY_GSAREA2B(XHELP*2.-XDMAX,XDMAX*2.-XHELP
     &                    ,YDMIN*2.-YDMAX,YDMAX*2.-YDMIN)
        ENDIF
      ENDIF
C
      IF (NOUVAL) GOTO 201
C
      IF (ISO.EQ.2.OR.ISOFRO.NE.0) THEN
        XMMIN = XHELP
        XMMAX = XDMAX
        YMMIN = YDMIN
        YMMAX = YDMAX
        DO I=1,NBCOL+1
          VALMAR(1,I) = BIGS
          VALMAR(2,I) = BIGS
        ENDDO
      ENDIF
C
      IF (IVIT.LT.0.AND.VITMAX.GT.0.) THEN
        DIM    = .2*FACVIT*SQRT((XDMAX-XHELP)**2+(YDMIN-YDMAX)**2)
        USDIM  = 1./DIM
        TAILVI = DIM/VITMAX
        EPSLON = ABS(EPSLON/TAILVI)
        IQUAR  = 1
      ENDIF
      IMAIL2 = IABS(IMAILL)
      IF (IMAIL2.EQ.2.OR.IMAIL2.EQ.5) THEN
        RBOUL = (YDMAX-YDMIN)/120.
      ELSEIF(IMAIL2.EQ.4.OR.IMAIL2.EQ.7) THEN
        RBOUL = (YDMAX-YDMIN)/60.
      ELSE
        RBOUL = (YDMAX-YDMIN)/250.
      ENDIF
      IF (IMAIL2.GE.5) THEN
        IB3D = 0
        ICB3D = 1
cc        ICB3D = 2
      ELSE
        IB3D = 1
        ICB3D = 1
      ENDIF
C
      IF (NOUVFL) GOTO 201
C
      IF ((ITYP.EQ.0.OR.PREM).AND..NOT.NOUVAL) THEN
        CALL GSPATF(ICTFON)
        CALL GSPAT(16)
        CALL MY_GSAREA2B(XHELP,XDMAX,YDMIN,YDMAX)
        PREM = .FALSE.
        IF (IPOST.EQ.1.AND.IOPT.EQ.-2) THEN
          CALL GSCOL(ICOLAX)
          IF (IAXES.NE.0) CALL AXES(XHELP,XDMAX,YDMIN,YDMIN)
          CALL LECADRE
        ENDIF
      ENDIF
      CALL GSPATF(ICTFAC1)
      IF (INUMER.NE.0) THEN
        CALL ASFCOL(ICTLEG)
        CALL GSLSS(IFONT0)
        DXCA = .004*(XDMAX-XHELP)
        DYCA = .004*(YDMIN-YDMAX)
        IF (INUMER.LT.0) THEN
          DO N=1,NUMNP
            ITOUCH2(N) = 0
          ENDDO
        ENDIF
      ENDIF
C
C Echelles
C
      IF (IBOITE.NE.0) CALL ECHEL(1,YYLAR)
Cfj      IF (ITYP.EQ.0.AND.ICOURB.LT.0.AND.IBOITE.NE.0) THEN
Cfj        CALL ECHEL(1,YYLAR)
Cfj      ELSEIF(ITYP.NE.0) THEN 
Cfj        CALL ECHEL(-2,YYLAR)
Cfj        IF (ITYP.EQ.-13.AND.IAXES.NE.0) 
Cfj     &       CALL AXES(XHELP,XDMAX,YDMIN,YDMAX)
Cfj        RETURN
Cfj      ENDIF
C
      IF (I2D.EQ.0.AND.IPS2D.EQ.0) THEN
        IBLBID = 2
      ELSE
        IBLBID = 1
      ENDIF
C
      IF (IFC.GE.0) THEN
        NBON2 = NBON
      ELSEIF(NSURF.GT.0) THEN
        NBON2 = NBON+NSURF
      ELSE
        NBON2 = NBON
      ENDIF
      IF (CLIGNE) THEN
        IF (ITEMPS.LE.1000) THEN
          IF (NBON2.LE.1000) THEN
            NMODC = MAX(1,NBON2/3)
          ELSEIF(NBON2.LE.2500) THEN
            NMODC = NBON2/5
          ELSEIF(NBON2.LE.10000) THEN
            NMODC = NBON2/10
          ELSE
            NMODC = NBON2/20
          ENDIF
          IF (IPOST.EQ.1) CLIGNE = .FALSE.
        ELSE
          NMODC = MAX(1,NBON2/MIN(ITEMPS/500,30))
        ENDIF
        IF (IPOST.EQ.-1) THEN
          JCPS = 1
        ELSEIF(CLIGNE) THEN
          XLH = XHELP-XDMIN
          XPTHER = (XDMIN+XHELP)*.5
          YPTHER = YDMI2+XLH*.075
          DXTHER = XLH*.9
          DYTHER = XLH*.1
          IF (ILANG.EQ.0) THEN
            SAUVPS = CHAR(199)//'a bosse...'
            LSPS = 11
          ELSE
            SAUVPS = 'Working...'
            LSPS = 10
          ENDIF
          IF (IPROGRE.LT.0) THEN
            CALL GSPROGRE(0)
            CALL SHIFT_ORIG(-ISHIFTX,-ISHIFTY)
          ENDIF
          CALL GSBND(XDMIN,XHELP,YDMI2,YDMAX)
          CALL GSLSS(IFONT8)
          CALL THERMOMETRE(SAUVPS,LSPS,XPTHER,YPTHER,DXTHER,DYTHER,0,0
     &                    ,15,7,8,0,IBORDTHERMO,IRC)
          CALL GSLSS(IFONT0)
          CALL GSBND(XHELP,XDMAX,YDMIN,YDMAX)
          IF (IPROGRE.LT.0) THEN
            CALL GSPROGRE(2)
            CALL SHIFT_ORIG(ISHIFTX,ISHIFTY)
            CALL GSBND(XHELP*2.-XDMAX,XDMAX*2.-XHELP
     &                ,YDMIN*2.-YDMAX,YDMAX*2.-YDMIN)
          ENDIF
        ENDIF
      ELSE
        NMODC = 1
      ENDIF
C
      IF (IFC.GE.0) THEN
        ICOUL = ICOLAR
        ICOUL3 = ICTFAC1
        CALL GSCOL(ICOUL)
        CALL GSPAT(16)
        IF (IBATCH.EQ.0.AND.IBOUT.EQ.0) CALL CHANGE_CURS(5)
C
        IF (I2D.NE.0.AND.ICTFON.EQ.0) THEN
          IF (FLTRID) THEN
            IF (ICTFLE.LE.15) CALL METS2DFOND(1)
          ELSE
            CALL METS2DFOND(1)
          ENDIF
        ENDIF
        IF (ISHRINK.GE.0.AND.IFRONT.EQ.0.AND.ICTFAC.GE.0
     & .AND.IFBLO.EQ.0.AND.INUMER.LE.0.AND..NOT.FLTRID) THEN
          DO 50 N=1,NBON
            NN = IORDRE(N)
            NE = NPROJE(NN)
            IF (ISO.EQ.0) THEN
              IF (ICTFAC.GT.15.AND.NDS.EQ.4) THEN
                IF (ICTFAC.LE.97) THEN
                  CALL GOURAU(ICTFAC,NDS,VV,DIRLUM,PHONG,NFAC(1,NE)
     &                       ,BSOMB,0)
                  CALL ISOCAR(XX(1,NN),YY(1,NN),VV,VALF(5,NE),NBOR(1,NE)
     &                       ,VAL,NBCOL,ARET,NDSEL,IMAILL,IBORD
     &                       ,INTERPCENTRE,NE,NDS,ICOUL,MODTET)
                ELSE
                  ICTLUM = 17+NINT(REAL(NBCOL)*REFLEC(NN))
                  CALL GSPAT(ICTLUM)
                  IF (ARET) THEN
                    IF (MODTET.EQ.40) THEN
                      CALL MY_GSAREA(0,XX(1,NN),YY(1,NN),4)
                      CALL GSMOVE(XX(2,NN),YY(2,NN))
                      CALL GSPLNE(2,XX(3,NN),YY(3,NN))
                    ELSE
                      CALL MY_GSAREA(1,XX(1,NN),YY(1,NN),4)
                    ENDIF
                    IF (IMAIL2.GE.2) THEN
                      DO I=1,NDS
                        CALL BOULE3D(XX(I,NN),YY(I,NN),RBOUL
     &                              ,ICB3D,IB3D,1)
                      ENDDO
                    ELSEIF(IBORD.EQ.0) THEN
                      CALL BORD(NBOR(1,NE),XX(1,NN),YY(1,NN)
     &                         ,ICOUL,ICOUL,NE)
                    ENDIF
                  ELSE
                    CALL MY_GSAREA(0,XX(1,NN),YY(1,NN),NDS)
                    IF (IMAIL2.GE.2) THEN
                      DO I=1,NDS
                        CALL BOULE3D(XX(I,NN),YY(I,NN),RBOUL
     &                              ,ICB3D,IB3D,1)
                      ENDDO
                    ELSEIF(IMAILL.GT.0) THEN
                      CALL BORD(NBOR(1,NE),XX(1,NN),YY(1,NN)
     &                         ,ICOUL,ICOUL,NE)
                    ENDIF
                  ENDIF
                ENDIF
              ELSEIF(ARET) THEN
                IF (COLORIE) THEN
                  IF (ICTFAC.GT.15) THEN
                    IF (ICTFAC.LE.97) THEN
                      CALL GOURAU(ICTFAC,NDS,VV,DIRLUM,PHONG,NFAC(1,NE)
     &                           ,BSOMB,0)
                      CALL ISOCAR(XX(1,NN),YY(1,NN),VV,VALF(5,NE)
     &                           ,NBOR(1,NE),VAL,NBCOL,ARET,NDSEL,IMAILL
     &                           ,IBORD,INTERPCENTRE,NE,NDS,ICOUL
     &                           ,MODTET)
                    ELSE
                      ICTLUM = 17+NINT(REAL(NBCOL)*REFLEC(NN))
                      CALL GSPAT(ICTLUM)
                      IF (MODTET.EQ.40) THEN
                        CALL MY_GSAREA(0,XX(1,NN),YY(1,NN),NDS)
                        IF (NDS.EQ.4) THEN
                          CALL GSMOVE(XX(2,NN),YY(2,NN))
                          CALL GSPLNE(2,XX(3,NN),YY(3,NN))
                        ELSEIF(MOD(NE,4).NE.0) THEN
                          CALL GSMOVE(XX(1,NN),YY(1,NN))
                          CALL GSPLNE(2,XX(2,NN),YY(2,NN))
                        ENDIF
                      ELSE
                        CALL MY_GSAREA(1,XX(1,NN),YY(1,NN),NDS)
                      ENDIF
                    ENDIF
                  ELSE
                    IF (MODTET.EQ.40) THEN
                      CALL MY_GSAREA(0,XX(1,NN),YY(1,NN),NDS)
                      IF (NDS.EQ.4) THEN
                        CALL GSMOVE(XX(2,NN),YY(2,NN))
                        CALL GSPLNE(2,XX(3,NN),YY(3,NN))
                      ELSEIF(MOD(NE,4).NE.0) THEN
                        CALL GSMOVE(XX(1,NN),YY(1,NN))
                        CALL GSPLNE(2,XX(2,NN),YY(2,NN))
                      ENDIF
                    ELSE
                      CALL MY_GSAREA(1,XX(1,NN),YY(1,NN),NDS)
                    ENDIF
                  ENDIF
                ELSE
                  IF (MODTET.EQ.40) THEN
                    IF (NDS.EQ.4) THEN
                      CALL GSMOVE(XX(2,NN),YY(2,NN))
                      CALL GSPLNE(2,XX(3,NN),YY(3,NN))
                    ELSEIF(MOD(NE,4).NE.0) THEN
                      CALL GSMOVE(XX(1,NN),YY(1,NN))
                      CALL GSPLNE(2,XX(2,NN),YY(2,NN))
                    ENDIF
                  ELSE
                    CALL GSPLNEC(NDS,XX(1,NN),YY(1,NN))
                  ENDIF
                ENDIF
                IF (IMAIL2.GE.2) THEN
                  DO I=1,NDS
                    CALL BOULE3D(XX(I,NN),YY(I,NN),RBOUL,ICB3D,IB3D,1)
                  ENDDO
                ELSEIF(IBORD.EQ.0) THEN
                  CALL BORD(NBOR(1,NE),XX(1,NN),YY(1,NN),ICOUL,ICOUL,NE)
                ENDIF
              ELSE
                IF (ICTFAC.GT.15) THEN
                  IF (ICTFAC.LE.97) THEN
                    CALL GOURAU(ICTFAC,NDS,VV,DIRLUM,PHONG,NFAC(1,NE)
     &                         ,BSOMB,0)
                    CALL ISOCAR(XX(1,NN),YY(1,NN),VV,VALF(5,NE)
     &                         ,NBOR(1,NE),VAL,NBCOL,ARET,NDSEL,IMAILL
     &                         ,IBORD,INTERPCENTRE,NE,NDS,ICOUL
     &                         ,MODTET)
                  ELSE
                    ICTLUM = 17+NINT(REAL(NBCOL)*REFLEC(NN))
                    CALL GSPAT(ICTLUM)
                    CALL MY_GSAREA(0,XX(1,NN),YY(1,NN),NDS)
                  ENDIF
                ELSEIF(COLORIE) THEN
                  CALL MY_GSAREA(0,XX(1,NN),YY(1,NN),NDS)
                ENDIF
                IF (IMAIL2.GE.2) THEN
                  DO I=1,NDS
                    CALL BOULE3D(XX(I,NN),YY(I,NN),RBOUL,ICB3D,IB3D,1)
                  ENDDO
                ELSEIF(IMAILL.GT.0) THEN
                  CALL BORD(NBOR(1,NE),XX(1,NN),YY(1,NN),ICOUL,ICOUL,NE)
                ENDIF
              ENDIF
            ELSE
              IF (ICTFAC.GT.15)
     &        ISOMBRE = 16+(IMUL-NINT(REAL(IMUL)*REFLEC(NN)))*(NBCOL+2)
              IF (ISO.EQ.1) THEN
                CALL ISOCAR(XX(1,NN),YY(1,NN),VALF(1,NE),VALF(5,NE)
     &                     ,NBOR(1,NE),VAL,NBCOL,ARETF,NDSEL,IMAILLF
     &                     ,IBORD,INTERPCENTRE,NE,NDS,ICOUL,MODTET)
                IF (ISOFRO.NE.0.AND.NBCBID.GT.0)
     &          CALL ISOCARL(XX(1,NN),YY(1,NN),VALF(1,NE),VALF(5,NE)
     &                      ,NBOR(1,NE),VALFRO,NBCBID,-1,ARET,NDSEL
     &                      ,IMAILL,IBORD,INTERPCENTRE,NE,.FALSE.
     &                      ,NDS,ICOUL,ICOLAR,MODTET,0)
                IF (IMAIL2.GE.2) THEN
                  DO I=1,NDS
                    CALL BOULE3D(XX(I,NN),YY(I,NN),RBOUL,ICB3D,IB3D,1)
                  ENDDO
                ENDIF
              ELSEIF(ISO.EQ.2) THEN
                CALL ISOCARL(XX(1,NN),YY(1,NN),VALF(1,NE),VALF(5,NE)
     &                      ,NBOR(1,NE),VALFRO,NBCOL,IEPISO,ARET,NDSEL
     &                      ,IMAILL,IBORD,INTERPCENTRE,NE,COLORIE
     &                      ,NDS,ICOUL,ICOLAR,MODTET,-1)
                IF (IMAIL2.GE.2) THEN
                  DO I=1,NDS
                    CALL BOULE3D(XX(I,NN),YY(I,NN),RBOUL,ICB3D,IB3D,1)
                  ENDDO
                ENDIF
              ELSE
                NCCC = ICHERCHE(VAL,NBCOL,VALF(5,NE))
                CALL GSPAT(ISOMBRE+NCCC)
                IF (ARET) THEN
                  IF (MODTET.EQ.40) THEN
                    CALL MY_GSAREA(0,XX(1,NN),YY(1,NN),NDS)
                    IF (NDS.EQ.4) THEN
                      CALL GSMOVE(XX(2,NN),YY(2,NN))
                      CALL GSPLNE(2,XX(3,NN),YY(3,NN))
                    ELSEIF(MOD(NE,4).NE.0) THEN
                      CALL GSMOVE(XX(1,NN),YY(1,NN))
                      CALL GSPLNE(2,XX(2,NN),YY(2,NN))
                    ENDIF
                  ELSE
                    CALL MY_GSAREA(1,XX(1,NN),YY(1,NN),NDS)
                  ENDIF
                  IF (IMAIL2.GE.2) THEN
                    DO I=1,NDS
                      CALL BOULE3D(XX(I,NN),YY(I,NN),RBOUL,ICB3D,IB3D,1)
                    ENDDO
                  ELSEIF(IBORD.EQ.0) THEN
                    CALL BORD(NBOR(1,NE),XX(1,NN),YY(1,NN)
     &                       ,ICOUL,ICOUL,NE)
                  ENDIF
                ELSE
                  CALL MY_GSAREA(0,XX(1,NN),YY(1,NN),NDS)
                  IF (IMAIL2.GE.2) THEN
                    DO I=1,NDS
                      CALL BOULE3D(XX(I,NN),YY(I,NN),RBOUL,ICB3D,IB3D,1)
                    ENDDO
                  ELSEIF(IMAILL.GT.0) THEN
                    CALL BORD(NBOR(1,NE),XX(1,NN),YY(1,NN)
     &                       ,ICOUL,ICOUL,NE)
                  ENDIF
                ENDIF
              ENDIF
            ENDIF
            IF (FRO) 
     &      CALL FRONT(ISD(NN),XX(1,NN),YY(1,NN),ICOUL,NE,NF,NDS)
C
C Courbes sur surface 3d
C
            IF (NPSUR.GT.0) CALL COUSUR(XX(1,NN),YY(1,NN),NE)
C
C Clignotement ou thermometre
C
            IF (CLIGNE.AND.MOD(N,NMODC).EQ.0) THEN
              CALL THERMO(JCPS,N,NBON,IABAND)
              IF (IABAND.NE.0) RETURN
            ENDIF
C
 50       CONTINUE
C
        ELSE
          DO 100 N=1,NBON
            NN = IORDRE(N)
            NE = NPROJE(NN)
            IF (ISHRINK.LT.0) THEN
              IF (ISHPRO.GT.0) THEN
                FACSHR = FACSHR0
              ELSEIF(ISHPRO.EQ.-1) THEN
                FACSHR = ((VALF(5,NE)-VMIN)/(VMAX-VMIN))**US3
              ELSE
                FACSHR = (VALF(5,NE)-VMIN)/(VMAX-VMIN)
              ENDIF
              IF (FACSHR.LT.VSHPRO) GOTO 100
              DO I=1,NDS
                XSH = XF(NDS2,NN) + FACSHR*(XF(I,NN)-XF(NDS2,NN))
                YSH = YF(NDS2,NN) + FACSHR*(YF(I,NN)-YF(NDS2,NN))
                ZSH = ZF(NDS2,NN) + FACSHR*(ZF(I,NN)-ZF(NDS2,NN))
                CALL PROJEC(XSH,YSH,ZSH
     &               ,REAL(ISENS),XXX(I),YYY(I),IPERSP,XPUP,DIST)
              ENDDO
            ELSE
              DO I=1,NDS
                XXX(I) = XX(I,NN)
                YYY(I) = YY(I,NN)
              ENDDO
            ENDIF
            IF (IFRONT.NE.0) THEN
              IF (IFRONT.LT.0) THEN
                IIII = MOD(MOD(ISD(NN),1000),15)
                ICOUL2 = ICA(IIII)
                ICOUL3 = ICF(IIII)
              ELSEIF(IFRONT.GT.1) THEN
                MIMI = MIN(IREF(NFAC(1,NE)),IREF(NFAC(2,NE))
     &                    ,IREF(NFAC(3,NE)),IREF(NFAC(4,NE)))
                MAMA = MAX(IREF(NFAC(1,NE)),IREF(NFAC(2,NE))
     &                    ,IREF(NFAC(3,NE)),IREF(NFAC(4,NE)))
                IF (MIMI.EQ.MAMA) THEN
                  ICOUL2 = ICC(MIN(16,MAX(0,MIMI)))
                ELSE
                  ICOUL2 = ICOLAR
                ENDIF
              ELSE
                ICOUL2 = ICOLAR
              ENDIF
              IF (ICOUL.NE.ICOUL2) THEN 
                ICOUL = ICOUL2
                CALL GSCOL(ICOUL)
              ENDIF
              IF (ICTFAC1.NE.ICOUL3.AND.ICTFAC.LE.15) THEN
                ICTFAC1 = ICOUL3
                CALL GSPATF(ICTFAC1)
                CALL GSPAT(16)
              ENDIF
            ENDIF
            IF (ISO.EQ.0) THEN
              IF (ICTFAC.EQ.-1) THEN
                CALL GSPAT(ICREF(NRFAC(NE)))
              ELSEIF(ICTFAC.EQ.-2) THEN
                NTEMP = MOD(ISD3(NE),16)
                CALL GSPAT(ICREF(NTEMP))
              ELSEIF(ICTFAC.EQ.-3) THEN
                NTEMP = MOD(ISD(NN),1000)
                CALL GSPAT(ICREF(NTEMP))
              ENDIF
              IF (ICTFAC.GT.15.AND.NDS.EQ.4) THEN
                IF (ICTFAC.LE.97) THEN
                  CALL GOURAU(ICTFAC,NDS,VV,DIRLUM,PHONG,NFAC(1,NE)
     &                       ,BSOMB,0)
                  CALL ISOCAR(XXX,YYY,VV,VALF(5,NE),NBOR(1,NE),VAL,NBCOL
     &                       ,ARET,NDSEL,IMAILL,IBORD,INTERPCENTRE
     &                       ,NE,NDS,ICOUL,MODTET)
                ELSE
                  ICTLUM = 17+NINT(REAL(NBCOL)*REFLEC(NN))
                  CALL GSPAT(ICTLUM)
                  IF (ARET) THEN
                    IF (MODTET.EQ.40) THEN
                      CALL MY_GSAREA(0,XXX,YYY,NDS)
                      IF (NDS.EQ.4) THEN
                        CALL GSMOVE(XXX(2),YYY(2))
                        CALL GSPLNE(2,XXX(3),YYY(3))
                      ELSEIF(MOD(NE,4).NE.0) THEN
                        CALL GSMOVE(XXX(1),YYY(1))
                        CALL GSPLNE(2,XXX(2),YYY(2))
                      ENDIF
                    ELSE
                      CALL MY_GSAREA(1,XXX,YYY,NDS)
                    ENDIF
                    IF (IMAIL2.GE.2) THEN
                      DO I=1,NDS
                        CALL BOULE3D(XXX(I),YYY(I),RBOUL,ICB3D,IB3D,1)
                      ENDDO
                    ELSEIF(IBORD.EQ.0) THEN
                      CALL BORD(NBOR(1,NE),XXX,YYY,ICOUL,ICOUL,NE)
                    ENDIF
                  ELSE
                    CALL MY_GSAREA(0,XXX,YYY,NDS)
                    IF (IMAIL2.GE.2) THEN
                      DO I=1,NDS
                        CALL BOULE3D(XXX(I),YYY(I),RBOUL,ICB3D,IB3D,1)
                      ENDDO
                    ELSEIF(IMAILL.GT.0) THEN
                      CALL BORD(NBOR(1,NE),XXX,YYY,ICOUL,ICOUL,NE)
                    ENDIF
                  ENDIF
                ENDIF
              ELSEIF(ARET) THEN
                IF (COLORIE) THEN
                  IF (ICTFAC.GT.15) THEN
                    IF (ICTFAC.LE.97) THEN
                      CALL GOURAU(ICTFAC,NDS,VV,DIRLUM,PHONG,NFAC(1,NE)
     &                           ,BSOMB,0)
                      CALL ISOCAR(XXX,YYY,VV,VALF(5,NE),NBOR(1,NE),VAL
     &                           ,NBCOL,ARET,NDSEL,IMAILL,IBORD
     &                           ,INTERPCENTRE,NE,NDS,ICOUL,MODTET)
                    ELSE
                      ICTLUM = 17+NINT(REAL(NBCOL)*REFLEC(NN))
                      CALL GSPAT(ICTLUM)
                      IF (MODTET.EQ.40) THEN
                        CALL MY_GSAREA(0,XXX,YYY,NDS)
                        IF (NDS.EQ.4) THEN
                          CALL GSMOVE(XXX(2),YYY(2))
                          CALL GSPLNE(2,XXX(3),YYY(3))
                        ELSEIF(MOD(NE,4).NE.0) THEN
                          CALL GSMOVE(XXX(1),YYY(1))
                          CALL GSPLNE(2,XXX(2),YYY(2))
                        ENDIF
                      ELSE
                        CALL MY_GSAREA(1,XXX,YYY,NDS)
                      ENDIF
                    ENDIF
                  ELSE
                    IF (MODTET.EQ.40) THEN
                      CALL MY_GSAREA(0,XXX,YYY,NDS)
                      IF (NDS.EQ.4) THEN
                        CALL GSMOVE(XXX(2),YYY(2))
                        CALL GSPLNE(2,XXX(3),YYY(3))
                      ELSEIF(MOD(NE,4).NE.0) THEN
                        CALL GSMOVE(XXX(1),YYY(1))
                        CALL GSPLNE(2,XXX(2),YYY(2))
                      ENDIF
                    ELSE
                      CALL MY_GSAREA(1,XXX,YYY,NDS)
                    ENDIF
                  ENDIF
                ELSE
                  IF (MODTET.EQ.40) THEN
                    IF (NDS.EQ.4) THEN
                      CALL GSMOVE(XXX(2),YYY(2))
                      CALL GSPLNE(2,XXX(3),YYY(3))
                    ELSEIF(MOD(NE,4).NE.0) THEN
                      CALL GSMOVE(XXX(1),YYY(1))
                      CALL GSPLNE(2,XXX(2),YYY(2))
                    ENDIF
                  ELSE
                    CALL GSPLNEC(NDS,XXX,YYY)
                  ENDIF
                ENDIF
                IF (IMAIL2.GE.2) THEN
                  DO I=1,NDS
                    CALL BOULE3D(XXX(I),YYY(I),RBOUL,ICB3D,IB3D,1)
                  ENDDO
                ELSEIF(IBORD.EQ.0) THEN
                  CALL BORD(NBOR(1,NE),XXX,YYY,ICOUL,ICOUL,NE)
                ENDIF
              ELSE
                IF (ICTFAC.GT.15) THEN
                  IF (ICTFAC.LE.97) THEN
                    CALL GOURAU(ICTFAC,NDS,VV,DIRLUM,PHONG,NFAC(1,NE)
     &                         ,BSOMB,0)
                    CALL ISOCAR(XXX,YYY,VV,VALF(5,NE),NBOR(1,NE),VAL
     &                         ,NBCOL,ARET,NDSEL,IMAILL,IBORD
     &                         ,INTERPCENTRE,NE,NDS,ICOUL,MODTET)
                  ELSE
                    ICTLUM = 17+NINT(REAL(NBCOL)*REFLEC(NN))
                    CALL GSPAT(ICTLUM)
                    CALL MY_GSAREA(0,XXX,YYY,NDS)
                  ENDIF
                ELSEIF(COLORIE) THEN
                  CALL MY_GSAREA(0,XXX,YYY,NDS)
                ENDIF
                IF (IMAIL2.GE.2) THEN
                  DO I=1,NDS
                    CALL BOULE3D(XXX(I),YYY(I),RBOUL,ICB3D,IB3D,1)
                  ENDDO
                ELSEIF(IMAILL.GT.0) THEN
                  CALL BORD(NBOR(1,NE),XXX,YYY,ICOUL,ICOUL,NE)
                ENDIF
              ENDIF
            ELSE
              IF (ICTFAC.GT.15)
     &        ISOMBRE = 16+(IMUL-NINT(REAL(IMUL)*REFLEC(NN)))*(NBCOL+2)
              IF (ISO.EQ.1) THEN
                CALL ISOCAR(XXX,YYY,VALF(1,NE),VALF(5,NE),NBOR(1,NE)
     &                     ,VAL,NBCOL,ARETF,NDSEL,IMAILLF,IBORD
     &                     ,INTERPCENTRE,NE,NDS,ICOUL,MODTET)
                IF (ISOFRO.NE.0.AND.NBCBID.GT.0)
     &          CALL ISOCARL(XXX,YYY,VALF(1,NE),VALF(5,NE),NBOR(1,NE)
     &                      ,VALFRO,NBCBID,-1,ARET,NDSEL,IMAILL,IBORD
     &                      ,INTERPCENTRE,NE,.FALSE.,NDS,ICOUL,ICOLAR
     &                      ,MODTET,0)
                IF (IMAIL2.GE.2) THEN
                  DO I=1,NDS
                    CALL BOULE3D(XXX(I),YYY(I),RBOUL,ICB3D,IB3D,1)
                  ENDDO
                ENDIF
              ELSEIF(ISO.EQ.2) THEN
                CALL ISOCARL(XXX,YYY,VALF(1,NE),VALF(5,NE),NBOR(1,NE)
     &                      ,VALFRO,NBCOL,IEPISO,ARET,NDSEL,IMAILL,IBORD
     &                      ,INTERPCENTRE,NE,COLORIE,NDS,ICOUL
     &                      ,ICOLAR,MODTET,-1)
                IF (IMAIL2.GE.2) THEN
                  DO I=1,NDS
                    CALL BOULE3D(XXX(I),YYY(I),RBOUL,ICB3D,IB3D,1)
                  ENDDO
                ENDIF
              ELSE
                NCCC = ICHERCHE(VAL,NBCOL,VALF(5,NE))
                CALL GSPAT(ISOMBRE+NCCC)
                IF (ARET) THEN
                  IF (MODTET.EQ.40) THEN
                    CALL MY_GSAREA(0,XXX,YYY,NDS)
                    IF (NDS.EQ.4) THEN
                      CALL GSMOVE(XXX(2),YYY(2))
                      CALL GSPLNE(2,XXX(3),YYY(3))
                    ELSEIF(MOD(NE,4).NE.0) THEN
                      CALL GSMOVE(XXX(1),YYY(1))
                      CALL GSPLNE(2,XXX(2),YYY(2))
                    ENDIF
                  ELSE
                    CALL MY_GSAREA(1,XXX,YYY,NDS)
                  ENDIF
                  IF (IMAIL2.GE.2) THEN
                    DO I=1,NDS
                      CALL BOULE3D(XXX(I),YYY(I),RBOUL,ICB3D,IB3D,1)
                    ENDDO
                  ELSEIF(IBORD.EQ.0) THEN
                    CALL BORD(NBOR(1,NE),XXX,YYY,ICOUL,ICOUL,NE)
                  ENDIF
                ELSE
                  CALL MY_GSAREA(0,XXX,YYY,NDS)
                  IF (IMAIL2.GE.2) THEN
                    DO I=1,NDS
                      CALL BOULE3D(XXX(I),YYY(I),RBOUL,ICB3D,IB3D,1)
                    ENDDO
                  ELSEIF(IMAILL.GT.0) THEN
                    CALL BORD(NBOR(1,NE),XXX,YYY,ICOUL,ICOUL,NE)
                  ENDIF
                ENDIF
              ENDIF
            ENDIF
            IF (FRO) CALL FRONT(ISD(NN),XXX,YYY,ICOUL,NE,NF,NDS)        
C
C Blocages
C
            IF (BLO) CALL AFFBLO(NDS,NFAC(1,NE),IBLOQ,I2D,ICBLO,IBLBID
     &                          ,XX(1,NN),YY(1,NN),TBOX)
C
C Numeros
C
            IF (INUMER.GT.0) THEN
              IF (ICOIN.EQ.0.OR.ISHRINK.EQ.-1) THEN
                IF (NDS.EQ.3) THEN
                  XC = (XX(1,NN)+XX(2,NN)+XX(3,NN))*US3
                  YC = (YY(1,NN)+YY(2,NN)+YY(3,NN))*US3
                ELSE
                  XC = .25*(XX(1,NN)+XX(2,NN)+XX(3,NN)+XX(4,NN))
                  YC = .25*(YY(1,NN)+YY(2,NN)+YY(3,NN)+YY(4,NN))
                ENDIF
              ELSE
                XC = XX(1,NN)
                YC = YY(1,NN)
              ENDIF
              CALL ECRIT(XC,YC,DXCA,NNUMFA(NE))
            ENDIF
C
C Fleches
C
            IF (FLTRID) THEN
              CALL GSCOL(ICTFLE)
              IF (ABS(ITYPFL).GE.3) THEN
                IF (ICTFLE.EQ.0) THEN
                  CALL GSPATF(7)
                ELSE
                  CALL GSPATF(ICTFLE)
                ENDIF
                CALL GSPAT(-16)
              ENDIF
              IF (IVIT.EQ.-1) THEN
                DO I=1,NDS
                  IF (ICTFLE.GT.15) THEN
                    LACOUL = ICHERCHE(VAL,NBCOL,VALX(NFAC(I,NE)))
                    CALL GSCOL(16+LACOUL)
                    CALL GSPAT(16+LACOUL)
                  ENDIF
                  VAVA = SQRT(VITF(1,I,NE)**2+VITF(2,I,NE)**2
     &                       +VITF(3,I,NE)**2)
                  CALL PROFLE(VIVI,NN,NE,I)
                  CALL FLECHE(TAILVI,USDIM,VAVA,VIVI,XX(I,NN),YY(I,NN)
     &                       ,ITYPFL,EPSLON,XFMIN,XFMAX,YFMIN,YFMAX)
                ENDDO
              ELSE
                IF (NDS.EQ.3) THEN
                  XC = (XX(1,NN)+XX(2,NN)+XX(3,NN))*US3
                  YC = (YY(1,NN)+YY(2,NN)+YY(3,NN))*US3
                  VAVA2 = (VALX(NFAC(1,NE)) + VALX(NFAC(2,NE))
     &                    +VALX(NFAC(3,NE)) )*US3
                ELSE
                  XC = .25*(XX(1,NN)+XX(2,NN)+XX(3,NN)+XX(4,NN))
                  YC = .25*(YY(1,NN)+YY(2,NN)+YY(3,NN)+YY(4,NN))
                  VAVA2 = (VALX(NFAC(1,NE)) + VALX(NFAC(2,NE))
     &                    +VALX(NFAC(3,NE)) + VALX(NFAC(4,NE)))*.25
                ENDIF
                VAVA = VITF(1,2,NE)
                IF (ICTFLE.GT.15) THEN
                  LACOUL = ICHERCHE(VAL,NBCOL,VAVA2)
                  CALL GSCOL(16+LACOUL)
                  CALL GSPAT(16+LACOUL)
                ENDIF
                CALL PROFLE(VIVI,NN,NE,1)
                CALL FLECHE(TAILVI,USDIM,VAVA,VIVI,XC,YC
     &                     ,ITYPFL,EPSLON,XFMIN,XFMAX,YFMIN,YFMAX)
              ENDIF
              CALL GSCOL(ICOUL)
              IF (ABS(ITYPFL).GE.3) THEN
                CALL GSPATF(ICTFAC1)
                CALL GSPAT(-16)
              ENDIF
            ENDIF
C
C Courbes sur surface 3d
C
            IF (NPSUR.GT.0) CALL COUSUR(XX(1,NN),YY(1,NN),NE)
C
C Clignotement ou thermometre
C
            IF (CLIGNE.AND.MOD(N,NMODC).EQ.0) THEN
              CALL THERMO(JCPS,N,NBON,IABAND)
              IF (IABAND.NE.0) RETURN
            ENDIF
C
 100      CONTINUE
        ENDIF
        IF (NPSUR.GT.0) THEN
          IF (IOPMAR.NE.0) THEN
            DO N=1,NBON
              NN = IORDRE(N)
              NE = NPROJE(NN)
              CALL COUSUR(XX(1,NN),YY(1,NN),NE)
            ENDDO
          ENDIF
        ENDIF
        CALL METS2DFOND(0)
C
C Dessin sans faces cachees
C
      ELSE
C
        ICOUL = 4
        SENS = REAL(ISENS)
        PMIXT = 1.
        IF (IBATCH.EQ.0.AND.IBOUT.EQ.0) CALL CHANGE_CURS(5)
        IF (NSURF.GT.0) THEN
          IF (ICSUR.LE.15) THEN
            ARET = .TRUE.
          ELSE
            ARET = .FALSE.
          ENDIF
          IF (ISO.EQ.0.AND.(ICTFAC.EQ.96.OR.ICTFAC.EQ.97)) THEN
            DO I=NUMBIS+1,NUMTER
              PHONG(1,I) = 0.
              PHONG(2,I) = 0.
              PHONG(3,I) = 0.
              ITOUCH(I)  = 0
            ENDDO
            DO N=1,NSURF
              IF (NFIS(5,N).GE.0) THEN
                U1 = XIS(3,N)-XIS(1,N)
                U2 = YIS(3,N)-YIS(1,N)
                U3 = ZIS(3,N)-ZIS(1,N)
                V1 = XIS(4,N)-XIS(2,N)
                V2 = YIS(4,N)-YIS(2,N)
                V3 = ZIS(4,N)-ZIS(2,N)
                UU1 = U2*V3 - V2*U3
                UU2 = U3*V1 - V3*U1
                UU3 = U1*V2 - V1*U2
                UU = UU1**2+UU2**2 +UU3**2
                UN = U1**2 + U2**2 + U3**2
                VN = V1**2 + V2**2 + V3**2
                IF (UU**2.LE.1.D-50*UN*VN) UU = 1.
                USQU = 1./SQRT(UU)
                IF (NFIS(3,N).EQ.NFIS(4,N)) THEN
                  NSOM = 3
                ELSE
                  NSOM = 4
                ENDIF
                DO K=1,NSOM
                  PHONG(1,NFIS(K,N)) = PHONG(1,NFIS(K,N)) + UU1*USQU
                  PHONG(2,NFIS(K,N)) = PHONG(2,NFIS(K,N)) + UU2*USQU
                  PHONG(3,NFIS(K,N)) = PHONG(3,NFIS(K,N)) + UU3*USQU
                  ITOUCH(NFIS(K,N))  = 1
                ENDDO
              ENDIF
            ENDDO
            DO I=NUMBIS+1,NUMTER
              IF (ITOUCH(I).NE.0) THEN
                UU = PHONG(1,I)**2 + PHONG(2,I)**2 + PHONG(3,I)**2
                IF (UU.LT.1.D-30) UU = 1.
                USQU = 1./SQRT(UU)
                DO K=1,3
                  PHONG(K,I) = PHONG(K,I)*USQU
                ENDDO
              ENDIF
            ENDDO
          ENDIF
          NBPNS = NBON+NSURF
        ELSE
          NBPNS = NBON
        ENDIF
        DO 200 N=1,NBPNS
          NN = IORDRE(N)
          NE = NPROJE(NN)
          IF (NN.LE.NBON) THEN
            IF (IMAILL.GT.0) THEN
              IF (IBORD.NE.-1) THEN
                IF (IFRONT.LT.0.OR.ICTFAC.EQ.-3) THEN
                  ICOUL2 = ICA(MOD(1+MOD(ISD(NN),1000),15))
                  IF (ICOUL.NE.ICOUL2) ICOUL = ICOUL2
                ELSEIF(IFC.EQ.-2) THEN
                  ICOUL = 17+NINT(REAL(NBCOL)*(CENTR(N)-CMINI)*USDC)
                ENDIF
                CALL GSCOL(ICOUL)
                IF (MODTET.EQ.40) THEN
                  IF (NDS.EQ.4) THEN
                    CALL GSMOVE(XX(2,NN),YY(2,NN))
                    CALL GSPLNE(2,XX(3,NN),YY(3,NN))
                  ELSEIF(MOD(NE,4).NE.0) THEN
                    CALL GSMOVE(XX(1,NN),YY(1,NN))
                    CALL GSPLNE(2,XX(2,NN),YY(2,NN))
                  ENDIF
                ELSE
                  CALL GSPLNEC(NDS,XX(1,NN),YY(1,NN))
                ENDIF
              ENDIF
              IF (IBORD.NE.1) THEN
                IF (ICTFAC.EQ.-3.AND.IBORD.EQ.-1) THEN
                  ICOUL2 = ICA(MOD(1+MOD(ISD(NN),1000),15))
                ELSE
                  ICOUL2 = ICOLAR
                ENDIF
                CALL BORD(NBOR(1,NE),XX(1,NN),YY(1,NN)
     &                   ,ICOUL2,ICOUL,NE)
              ENDIF
              IF (IFRONT.LT.0)
     &             CALL FRONT(ISD(NN),XX(1,NN),YY(1,NN),ICOUL,NE,NF,NDS)
            ELSEIF(IMAIL2.GE.2) THEN
              DO I=1,NDS
                CALL BOULE3D(XX(I,NN),YY(I,NN),RBOUL,ICB3D,IB3D,1)
              ENDDO
            ENDIF
C
C Courbes sur surface 3d
C
            IF (NPSUR.GT.0) CALL COUSUR(XX(1,NN),YY(1,NN),NE)
C
C Blocages
C
            IF (BLO) CALL AFFBLO(NDS,NFAC(1,NE),IBLOQ,I2D,ICBLO,IBLBID
     &                          ,XX(1,NN),YY(1,NN),TBOX)
          ELSEIF(NFIS(5,NN-NBON).GE.0) THEN
C
C Isosurface
C
            I = NN-NBON
            U1 = XIS(3,I)-XIS(1,I)
            U2 = YIS(3,I)-YIS(1,I)
            U3 = ZIS(3,I)-ZIS(1,I)
            V1 = XIS(4,I)-XIS(2,I)
            V2 = YIS(4,I)-YIS(2,I)
            V3 = ZIS(4,I)-ZIS(2,I)
            UU1 = U2*V3-V2*U3
            UU2 = U3*V1-V3*U1
            UU3 = U1*V2-V1*U2
C
            IF (ICALSU.NE.0) THEN
              IF (IPERSP.NE.1) THEN
                IF (NSOM.EQ.3) THEN
                  OBS1 = XPUP(1)-US3*(XIS(1,I) + XIS(2,I) + XIS(3,I))
                  OBS2 = XPUP(2)-US3*(YIS(1,I) + YIS(2,I) + YIS(3,I))
                  OBS3 = XPUP(3)-US3*(ZIS(1,I) + ZIS(2,I) + ZIS(3,I))
                ELSE
                  OBS1 = XPUP(1)
     &                 -.25*(XIS(1,I)+XIS(2,I)+XIS(3,I)+XIS(4,I))
                  OBS2 = XPUP(2)
     &                 -.25*(YIS(1,I)+YIS(2,I)+YIS(3,I)+YIS(4,I))
                  OBS3 = XPUP(3)
     &                 -.25*(ZIS(1,I)+ZIS(2,I)+ZIS(3,I)+ZIS(4,I))
                ENDIF
                PMIXT = ( UU1*OBS1 + UU2*OBS2 + UU3*OBS3 )*SENS
              ELSE
                PMIXT = ( UU1 + UU2 + UU3 )*SENS
              ENDIF
            ENDIF
            IF (PMIXT.GT.0.) THEN
              IF (XIS(3,I).NE.XIS(4,I).OR.YIS(3,I).NE.YIS(4,I)
     &        .OR.ZIS(3,I).NE.ZIS(4,I)) THEN
                NSOM = 4
              ELSE
                NSOM = 3
              ENDIF
              DO K=1,NSOM
                CALL PROJEC(XIS(K,I),YIS(K,I),ZIS(K,I)
     &                     ,SENS,XXX(K),YYY(K),IPERSP,XPUP,DIST)
              ENDDO
              UU = UU1**2 + UU2**2 + UU3**2
              UN = U1**2  + U2**2  + U3**2
              VN = V1**2  + V2**2  + V3**2
              IF (UU**2.LE.1.D-50*UN*VN) UU = 1.
              IF (ISO.EQ.0.OR.IFVISO.EQ.0) THEN
                IF (ICTFAC.EQ.96.OR.ICTFAC.EQ.97) THEN
                  CALL GOURAU(ICTFAC,NSOM,VV,DIRLUM,PHONG,NFIS(1,I)
     &                       ,BSOMB,1)
                  CALL GSCOL(ICSUR)
                  CALL ISOCAR(XXX,YYY,VV,BID,IBBID,VAL,NBCOL
     &                       ,ARET,NDSEL,0,1,0,NBID,NSOM,ICSUR,IBID)
                  CALL GSCOL(ICOUL)
                ELSE
                  TOTO = ABS( DIRLUM(1)*UU1 +
     &                        DIRLUM(2)*UU2 +
     &                        DIRLUM(3)*UU3 ) / SQRT(UU)
                  IF (ICTFAC.EQ.99) THEN
                    IF (NFIS(5,I).EQ.0) THEN
CCC                      RRR = .15+.85*ABS( DIRLUM(1)*UU1 +
                      RRR = TOTO
                    ELSE
                      RRR = BSOMB+.45*TOTO
                    ENDIF
                  ELSE
                    IF (NFIS(5,I).EQ.0) THEN
Cfj                      RRR = .1 + .9*(( DIRLUM(1)*UU1 +
Cfj     &                                 DIRLUM(2)*UU2 +
Cfj     &                                 DIRLUM(3)*UU3 )**2 / UU )**2
                      RRR = 2.5*TOTO*TOTO*(TOTO-1.)+TOTO
                    ELSE
Cfj                      RRR = BSOMB + .5*(( DIRLUM(1)*UU1 +
Cfj     &                                    DIRLUM(2)*UU2 +
Cfj     &                                    DIRLUM(3)*UU3 )**2 / UU )**2
                      RRR = BSOMB+ .5*(2.5*TOTO*TOTO*(TOTO-1.)+TOTO)
                    ENDIF
                  ENDIF
                  ICTLUM = 17+NINT(REAL(NBCOL)*RRR)
                  CALL GSPAT(ICTLUM)
                  IF (ICSUR.LE.15) THEN
                    CALL GSCOL(ICSUR)
                    CALL MY_GSAREA(1,XXX,YYY,NSOM)
                  ELSE
                    CALL MY_GSAREA(0,XXX,YYY,NSOM)
                  ENDIF
                ENDIF
              ELSE
                IF (ICTFAC.GT.15) THEN
                  TOTO = ABS( DIRLUM(1)*UU1 +
     &                        DIRLUM(2)*UU2 +
     &                        DIRLUM(3)*UU3 ) / SQRT(UU)
                  IF (ICTFAC.EQ.99.OR.ICTFAC.EQ.97) THEN
                    RRR = TOTO
Cfj                    RRR = .15+.85*ABS( DIRLUM(1)*UU1 +
Cfj     &                                 DIRLUM(2)*UU2 +
Cfj     &                                 DIRLUM(3)*UU3 ) / SQRT(UU)
                  ELSE
                    RRR = 2.5*TOTO*TOTO*(TOTO-1.)+TOTO
Cfj                    RRR = .1 + .9*(( DIRLUM(1)*UU1 +
Cfj     &                               DIRLUM(2)*UU2 +
Cfj     &                               DIRLUM(3)*UU3 )**2 / UU )**2
                  ENDIF
                  ISOMBRE = 16+(IMUL-NINT(REAL(IMUL)*RRR))*(NBCOL+2)
                ENDIF
                CALL GSCOL(ICSUR)
                IF (ISO.EQ.1) THEN
                  CALL ISOCAR(XXX,YYY,VIS(1,I),BID,IBBID,VAL,NBCOL
     &                       ,ARETF,NDSEL,0,1,0,NBID,NSOM,ICSUR,IBID)
                  IF (ISOFRO.NE.0.AND.NBCBID.GT.0)
     &            CALL ISOCARL(XXX,YYY,VIS(1,I),BID,IBBID,VALFRO,NBCBID
     &                        ,-1,ARET,NDSEL,0,1,0,NBID,.FALSE.,NSOM
     &                        ,ICSUR,ICOLAR,IBID,0)
                ELSEIF(ISO.EQ.3) THEN
                  NNE = NEIS(I)
                  NCCC = ICHERCHE(VAL,NBCOL,VALF(5,ITAB(NNE)))
                  CALL GSPAT(ISOMBRE+NCCC)
                  IF (ICSUR.LE.15) THEN
                    CALL MY_GSAREA(1,XXX,YYY,NSOM)
                  ELSE
                    CALL MY_GSAREA(0,XXX,YYY,NSOM)
                  ENDIF
                ELSE
                  CALL ISOCARL(XXX,YYY,VIS(1,I),BID,IBBID,VALFRO,NBCOL
     &                        ,IEPISO,ARET,NDSEL,0,1,0,NBID,COLORIE
     &                        ,NSOM,ICSUR,ICOLAR,IBID,-1)
                ENDIF
                CALL GSCOL(ICOUL)
              ENDIF
            ENDIF
          ENDIF
C
C Clignotement ou thermometre
C
          IF (CLIGNE.AND.MOD(N,NMODC).EQ.0) THEN
            CALL THERMO(JCPS,N,NBPNS,IABAND)
            IF (IABAND.NE.0) RETURN
          ENDIF
C
 200    CONTINUE
C
      ENDIF
C
 201  ICTFAC1 = ICTFAC0
C
C Valeurs pour iso au trait
C
      IF (IVALMAR.NE.0) THEN
        DXCA = .004*(XDMAX-XHELP)
        IF (ISO.EQ.1) THEN
          CALL VALISO(DXCA,NBCBID)
        ELSEIF(ISO.EQ.2) THEN
          CALL VALISO(DXCA,NBCOL)
        ENDIF
      ENDIF
C
C Vitesses
C
      IF (IVIT.LT.0.AND.VITMAX.GT.0..AND.(.NOT.FLTRID)) THEN
        CALL GSCOL(ICTFLE)
        IF (ABS(ITYPFL).GE.3) THEN
          IF (ICTFLE.EQ.0) THEN
            CALL GSPATF(7)
          ELSE
            CALL GSPATF(ICTFLE)
          ENDIF
          CALL GSPAT(-16)
        ENDIF
C
C Vitesses aux noeuds
C
        IF (IVIT.EQ.-1) THEN
          DO N=1,NUMNP
            ITOUCH(N) = 0
          ENDDO
          DO N=1,NBON
            NE = NPROJE(N)
            NQ = 1+(NE-1)/NF
            IF (NQ.GT.IQUAR) THEN
              IQUAR = IQUAR+1
              DO I=1,NUMNP
                ITOUCH(I) = 0
              ENDDO
            ENDIF
            DO I=1,NDS
              NN = NFAC(I,NE)
              IF (ITOUCH(NN).EQ.0) THEN
                ITOUCH(NN) = 1
                IF (ICTFLE.GT.15) THEN
                  LACOUL = ICHERCHE(VAL,NBCOL,VALX(NFAC(I,NE)))
                  CALL GSCOL(16+LACOUL)
                  CALL GSPAT(16+LACOUL)
                ENDIF
                VAVA = SQRT(VITF(1,I,NE)**2+VITF(2,I,NE)**2
     &                     +VITF(3,I,NE)**2)
                CALL PROFLE(VIVI,N,NE,I)
cc                CALL FLECHE(TAILVI,USDIM,VALX(NN)
                CALL FLECHE(TAILVI,USDIM,VAVA,VIVI,XX(I,N),YY(I,N)
     &                     ,ITYPFL,EPSLON,XFMIN,XFMAX,YFMIN,YFMAX)
              ENDIF
            ENDDO
          ENDDO
C
C Vitesses au centre des cellules
C
        ELSE
          DO N=1,NBON
            NE = NPROJE(N)
            IF (NDS.EQ.3) THEN
              XC = (XX(1,N)+XX(2,N)+XX(3,N))*US3
              YC = (YY(1,N)+YY(2,N)+YY(3,N))*US3
            ELSE
              XC = .25*(XX(1,N)+XX(2,N)+XX(3,N)+XX(4,N))
              YC = .25*(YY(1,N)+YY(2,N)+YY(3,N)+YY(4,N))
            ENDIF
            IF (ICTFLE.GT.15) THEN
              IF (NDS.EQ.3) THEN
                VAVA = (VALX(NFAC(1,NE))+VALX(NFAC(2,NE))
     &                 +VALX(NFAC(3,NE)))*US3
              ELSE
                VAVA = .25*(VALX(NFAC(1,NE))+VALX(NFAC(2,NE))
     &                     +VALX(NFAC(3,NE))+VALX(NFAC(4,NE)))
              ENDIF
              LACOUL = ICHERCHE(VAL,NBCOL,VAVA)
              CALL GSCOL(16+LACOUL)
              CALL GSPAT(16+LACOUL)
            ENDIF
            CALL PROFLE(VIVI,N,NE,1)
            CALL FLECHE(TAILVI,USDIM,VITF(1,2,NE),VIVI,XC,YC
     &                 ,ITYPFL,EPSLON,XFMIN,XFMAX,YFMIN,YFMAX)
          ENDDO
        ENDIF
        CALL GSPATF(ICTFLE)
        CALL GSPAT(16)
      ENDIF
C
C Numeros
C
      IF (IFC.LT.0.OR.INUMER.LT.0) THEN
        IF (INUMER.NE.0) THEN
          CALL ASFCOL(ICTLEG)
          CALL GSLSS(IFONT0)
          CALL GSPATF(ICTFAC1)
          CALL GSPAT(16)
          DXCA = .004*(XDMAX-XHELP)
          DYCA = .004*(YDMAX-YDMIN)
        ENDIF
        IF (INUMER.LT.0) THEN
          DO N=1,NUMNP
            ITOUCH2(N) = 0
          ENDDO
          DIM = .3*SQRT((XDMAX-XHELP)**2+(YDMAX-YDMIN)**2)
          DO N=1,NBON
            IF (NDS.EQ.3) THEN
              XC = (XX(1,N)+XX(2,N)+XX(3,N))*US3
              YC = (YY(1,N)+YY(2,N)+YY(3,N))*US3
              DI = 2.*SQRT(MAX((XC-XX(1,N))**2+(YC-YY(1,N))**2
     &                        ,(XC-XX(2,N))**2+(YC-YY(2,N))**2 
     &                        ,(XC-XX(3,N))**2+(YC-YY(3,N))**2))
            ELSE
              XC = .25*(XX(1,N)+XX(2,N)+XX(3,N)+XX(4,N))
              YC = .25*(YY(1,N)+YY(2,N)+YY(3,N)+YY(4,N))
              DI = SQRT(MAX((XX(1,N)-XX(3,N))**2+(YY(1,N)-YY(3,N))**2
     &                     ,(XX(2,N)-XX(4,N))**2+(YY(2,N)-YY(4,N))**2))
            ENDIF
            IF (DI.LT.DIM) DI = DIM
cc????
            IF (ISHRINK.EQ.0) THEN
cc????
              FFF = 1. + .2*DIM/DI
            ELSE
              FFF = .7*(1. + .2*DIM/DI)
            ENDIF
            NE = NPROJE(N)
            DO I=1,NDS
              NN = NFAC(I,NE)
              IF (ITOUCH2(NN).EQ.0.OR.ISHRINK.EQ.-1) THEN
                ITOUCH2(NN) = 1
                XNUM = XC + FFF*(XX(I,N)-XC)
                YNUM = YC + FFF*(YY(I,N)-YC)-DYCA
                IF (INUMER.EQ.-1) THEN
                  NNN = NN
                ELSE
                  NNN = IREF(NN)
                  IF (IFRONT.GT.1) CALL ASFCOL(ICREF(MOD(NNN,16)))
                ENDIF
                IF (INUMER.GT.-3.OR.NNN.NE.0)
     &               CALL ECRIT(XNUM,YNUM,DXCA,NNN)
              ENDIF
            ENDDO
          ENDDO
        ELSEIF(INUMER.GT.0) THEN
          DO N=1,NBON
            NE = NPROJE(N)
            IF (ICOIN.EQ.0) THEN
              IF (NDS.EQ.3) THEN
                XNUM = (XX(1,N)+XX(2,N)+XX(3,N))*US3
                YNUM = (YY(1,N)+YY(2,N)+YY(3,N))*US3-DYCA
              ELSE
                XNUM = .25*(XX(1,N)+XX(2,N)+XX(3,N)+XX(4,N))
                YNUM = .25*(YY(1,N)+YY(2,N)+YY(3,N)+YY(4,N))-DYCA
              ENDIF
            ELSE
              XNUM = XX(1,N)
              YNUM = YY(1,N)
            ENDIF
            CALL ECRIT(XNUM,YNUM,DXCA,NNUMFA(NE))
          ENDDO
        ENDIF
      ENDIF
C
C echelles (fin)
C
cc      IF (ICOURB.LT.0.AND.IBOITE.NE.0) CALL ECHEL(-1,YYLAR)
      IF (ISAUVEGRAPH.NE.0) THEN
        CALL FERMESAUVE
        CALL CALCDIM(YYLAR,0)
        ISAUVEGRAPH = 0
        CALL CHANGE_CURS(1)
        CALL METS_CURSEUR(XMIL,YMIL)
        RETURN
      ENDIF
      CALL ECHEL(-3,YYLAR)
C
C Pour eviter le clignotement des axes dans les animations
C
      IF (IBIT.NE.0) THEN
        IF (IAXES.NE.0) CALL AXES(XHELP,XDMAX,YDMIN,YDMAX)
        IF (ILEG.GT.0) 
     &       CALL LEGENDE(XHELP,XDMAX,YDMIN,YDMAX,BID,BID,BID,BID,1)
        IF (ICADPS.EQ.1) CALL LECADRE
      ENDIF
C
C Affichage de la pixmap en cas de double buffer,
C ou sauvegarde dans pix sinon
C
      IF (IPOST.EQ.1.OR.IPOST.EQ.-2) THEN
        IF (IPROGRE.LT.0) THEN
          CALL GSPROGRE(0)
          CALL SHIFT_ORIG(-ISHIFTX,-ISHIFTY)
          CALL x11metrect2(IX0+ISHIFTX,IY0+ISHIFTY,ILARG,IHAUT,IX0,IY0)
        ELSE
          CALL VRAIECOORD(XHELP,YDMAX,IX0,IY0)
          CALL VRAIECOORD(XDMAX,YDMIN,IX1,IY1)
ccc??          PIPI = .5*REAL(IEPBOR)*(XDMAX-XHELP)/REAL(IABS(IX0-IX1))
          ILARG = IX1-IX0-IEPBOR
          IHAUT = IY1-IY0-IEPBOR
          IX0 = IX0+IEPBOR/2
          IY0 = IY0+IEPBOR/2
          ISHIFTX = 0
          ISHIFTY = 0
          CALL GSBND(XDMIN,XDMAX,YDMIN,YDMAX)
          CALL x11garderect(IX0,IY0,ILARG,IHAUT)
        ENDIF
        CALL GSBND(XHELP,XDMAX,YDMIN,YDMAX)
      ENDIF
C
C Valeurs sur le graphique
C
      IF (NBPG.NE.0) THEN
        DO N=1,NBPG
          CALL ECRVAL(XXXG(N),YYYG(N),VALG(N))
        ENDDO
      ENDIF
C
C Axes
C
      IF ((IPOST.EQ.1.OR.IDSEUL.EQ.0).AND.IBIT.EQ.0) THEN
        IF (IAXES.NE.0.AND.(IPOST.EQ.1.OR.IDSEUL.EQ.0)) 
     &       CALL AXES(XHELP,XDMAX,YDMIN,YDMAX)
C
C Legende
C
        IF (ILEG.GT.0) 
     &       CALL LEGENDE(XHELP,XDMAX,YDMIN,YDMAX,BID,BID,BID,BID,1)
        IF (ITITAV.LT.0) CALL TITIT(XHELP,XDMAX,YDMIN,YDMAX)
      ENDIF
      IF ((IBIT.EQ.0.OR.ICADPS.EQ.1)
     &.AND.(IPOST.EQ.1.OR.IDSEUL.EQ.0)) CALL LECADRE
cc      IF (IBIT.EQ.0.OR.ICADPS.EQ.1) CALL LECADRE
C
      IF (IPOST.EQ.1.OR.ICADPS.EQ.1) CALL GSBND(XDMIN,XDMA2,YDMIN,YDMAX)
C
C Affichage du curseur
C
      XMIL = .5*(XHELP+XDMAX)
      YMIL = .5*(YDMIN+YDMAX)
      IF (IBATCH.EQ.0) THEN
        IF (IBOUT.LE.0) THEN
          CALL CHANGE_CURS(1)
          IF (-IBOUT.NE.IBROT) CALL METS_CURSEUR(XMIL,YMIL)
        ELSEIF(IBOUT.EQ.IBROT
     &  .OR.KBOUT(IBOUT).EQ.2.OR.KBOUT(IBOUT).EQ.24) THEN
          CALL CHANGE_CURS(1)
        ELSEIF(CLIGNE) THEN
          CALL CHANGE_CURS(2)
        ELSE
          CALL CHANGE_CURS(2)
cc          CALL CHANGE_CURS(1)
        ENDIF
      ENDIF
      PREM = .TRUE.
      CALL TEMPS(UU1,IS1)
      ITEMPS = IS1-IS0
C
      END
C-----------------------------------------------------------------------
      SUBROUTINE LECADRE
      INCLUDE 'com_options.f'
      CALL GSCOL(ICOLAX)
      CALL GSLW(IEPBOR)
      CALL GSMOVE(XDMAX,YDMIN)
      CALL GSLINE(XDMAX,YDMAX)
      CALL GSLINE(XHELP,YDMAX)
      CALL GSLINE(XHELP,YDMIN)
      CALL GSLINE(XDMAX,YDMIN)
      CALL GSLW(0)
      END
C-----------------------------------------------------------------------
      SUBROUTINE AFFBLO(NDS,NFAC,IBLOQ,I2D,ICBLO,IBLBID,XX,YY,TBOX)
      DIMENSION XX(*),YY(*)
      INTEGER   NFAC(*),IBLOQ(*),ICBLO(7,2)
C
      III = 0
      TBOX2 = TBOX*0.7
      CALL GSQCOL(IOLDC)
      DO I=1,NDS
        NB = IBLOQ(NFAC(I))
        IF (NB.NE.0) THEN
          NBB = MOD(NB,100)
          NBC = NB/100
          III = 1
          NBBB = NBB/8
c          print*,nb,nbb,nbc
          IF (NBBB.GT.0) THEN
            NBBBB = NBB-8*NBBB
            IF (I2D.EQ.0) THEN
              IF (NBBB.EQ.1.AND.NBBBB.EQ.0) THEN
                MS = 10
              ELSE
                MS = 11
              ENDIF
              IF (NBBBB.EQ.0) THEN
                CALL GSCOL(7)
              ELSE
                CALL GSCOL(ICBLO(NBBBB,IBLBID))
              ENDIF
            ELSE
              CALL GSCOL(7)
              IF (NBBBB.EQ.0) THEN
                MS = 10
              ELSE
                MS = 4
              ENDIF
            ENDIF
            CALL GSMS(MS)
            IF (MS.EQ.4) THEN
              CALL GSMARK(XX(I),YY(I))
            ELSE
              CALL GSMB(TBOX2,TBOX2)
              CALL GSMARK(XX(I),YY(I))
              CALL GSMB(TBOX,TBOX)
            ENDIF
          ELSEIF(NBB.NE.0) THEN
            CALL GSMS(4)
            NBB = MIN(7,NBB)
            CALL GSCOL(ICBLO(NBB,IBLBID))
            CALL GSMARK(XX(I),YY(I))
          ENDIF
          IF (NBC.GT.0) THEN
            IF (NBC.GE.10000) THEN
              NBCC = NBC/10000
              CALL GSMS(7)
            ELSEIF(NBC.GE.100) THEN
              NBCC = NBC/100
              IF (NBCC.EQ.31.OR.NBCC.EQ.32) THEN
                NBCC = NBCC-30
                CALL GSMS(8)
              ELSE
                CALL GSMS(6)
              ENDIF
            ELSE
              NBCC = NBC
              CALL GSMS(5)
            ENDIF
            NBCC = MIN(7,NBCC)
            CALL GSCOL(ICBLO(NBCC,IBLBID))
            CALL GSMB(TBOX2,TBOX2)
            CALL GSMARK(XX(I),YY(I))
            CALL GSMB(TBOX,TBOX)
          ENDIF
        ENDIF
      ENDDO
      IF (III.NE.0) CALL GSCOL(IOLDC)
      END
