    	SUBROUTINE LAYOUT_FILL( IFL )
C
C  PROGRAMMER: R.S. ZHOU	MAY-1986
C
C	THIS ROUTINE FILLS THE PICKED LAYOUT ENTRIES
C	WITH A HATCHING PATTERN --- IFL.
C
    	INCLUDE 'LAYOUT.CBS'
     	LOGICAL SKIP, FIRST

    	IPN = IFL
     	IF( IPN.NE.0 ) GOTO 111
C
C  RELEASE THE FILL GROUP...
C
     	K = NLG
     	FIRST = .TRUE.
     	DO I=1, NLG
     	    SKIP = .TRUE.
     	    IS = NLS(I)
     	    DO J=1, NLC
     		IF( NFL(J).GT.0 .AND. NSN(J).EQ.IS ) THEN
     		    NFL(J) = 0
     	    	    CALL LAYOUT_DRAW( J, 1 )
    	    	    IF(BLINK.GT.0) CALL IFSEG_BLINK(KSG)
     		    K = K + 1
     		    NLS(K) = KSG
     		    FIRST = .FALSE.
     		    SKIP = .FALSE.
     		ENDIF
     	    ENDDO
     	    IF( .NOT.SKIP ) THEN
     		NLS(I) = 0
     		CALL IFSEG_OPEN( -IS )
     	    ENDIF
     	ENDDO
     	NLG = K
     	IF( .NOT.FIRST ) CALL LAYOUT_PACK_NLG   !RESORT PICKED SEGMENT NUMBERS
     	GOTO 222
C
C  ADD A FILL GROUP...
C
111	K = 0
     	FIRST = .TRUE.
     	DO 555 I = 1, NLG
     	    SKIP = .FALSE.
    	    IS = NLS(I)
     	    DO 444 J = 1, NLC
     		IF( NSN(J).NE.IS ) GOTO 444
     		IF( NID(J).LT.6.OR.NID(J).GT.8 ) THEN
     		    IF( FIRST ) THEN
     			FIRST = .FALSE.
     			NFG = NFG + 1
     			NFP(NFG) = IPN
     			KSG = KSG + 1
     			CALL IFSEG_PIVOT(P00(1,J),P00(2,J))
     			CALL IFSEG_OPEN( KSG )
     			CALL IFFILL( IPN )
     		    ENDIF
     		    NSN(J) = KSG
     		    NFL(J) = NFG
     		    CALL LAYOUT_DRAW( -J, 0 )
     		    IF(.NOT.FIRST) K=K+1
     		ELSE
     		    SKIP = .TRUE.
     		    IF(BLINK.GT.0) CALL IFSEG_BLINK(-IS)
     		    GOTO 555
     		ENDIF
444	    CONTINUE
     	    IF(.NOT.SKIP) CALL IFSEG_OPEN(-IS)
555	CONTINUE

     	IF(.NOT.FIRST) THEN
     	    CALL IFFILL( 0 )
     	    CALL IFSEG_OPEN( 0 )
     	    IF(BLINK.GT.0) CALL IFSEG_BLINK(KSG)
     	    NLG = 1
     	    NLS(1) = KSG
     	ENDIF

222	IF(.NOT.FIRST) THEN
     	    CALL IFINIT_DUMP
     	    IF(KSG.GT.2*MNN) CALL LAYOUT_PACK_SEG	!REPACK SEGMENT NUMBERS
     	    IF(K.GT.1) CALL LAYOUT_PACK_NFG		!REPACK FILL GROUPS
     	ENDIF

999	RETURN
    	END

