    	SUBROUTINE IFBOXS( IR, ARRAY )
C
C  PROGRAMMER: R.S. ZHOU		FEB-1986
C
C  	THIS ROUTINE DRAWS A BOX WITH ROUND CORNERS.
C
C	IR --------- LENGTH OF "ARRAY".
C	ARRAY(1) --- BOX LENGTH IN INCHES IN X-AXIS.
C	ARRAY(2) --- BOX HEIGHT IN INCHES IN Y-AXIS.
C	ARRAY(3) --- BOX BORDER WIDTH IN INCHES.
C	ARRAY(4) --- CENTER OF BOX IN INCHES (X).
C	ARRAY(5) --- CENTER OF BOX IN INCHES (Y).
C	ARRAY(6) --- ROTATION ANGLE OF BOX IN DEGREES.
C
     	DIMENSION ARRAY(1)
C
C  INITIALIZE...
C
     	IRR = IR
     	RD1 = 0.5
     	RD2 = 0.5
     	WID = 0.0
     	XPS = 0.0
     	YPS = 0.0
     	ANG = 0.0
     	IF( IRR.GT.0 .AND. ARRAY(1).NE.0.0 ) RD1 = 0.5*ABS(ARRAY(1))
     	IF( IRR.GT.1 .AND. ARRAY(2).NE.0.0 ) RD2 = 0.5*ABS(ARRAY(2))
     	IF( IRR.GT.2 .AND. ARRAY(3).NE.0.0 ) THEN
     	    WID = ABS(ARRAY(3))
     	    IF( WID.GE.RD1 .OR. WID.GE.RD2 ) WID = 0.0
     	ENDIF
     	IF( IRR.GT.4 ) THEN
     	    XPS = ARRAY(4)
     	    YPS = ARRAY(5)
     	ENDIF
     	IF( IRR.GT.5 ) ANG = AMOD( ARRAY(6), 360.0 )
C
C  MOVE ORIGIN TO (XPS,YPS) ...
C
     	IF( IRR.GT.4 ) CALL IFDRAW( XPS, YPS, -9 )
C
C  SET ROTATION IF AT ALL...
C
     	IF( IRR.GT.5 .AND. ANG.NE.0.0 ) THEN
     	    CALL IFROTA_NOW( XANG, YANG )
     	    CALL IFROTA( ANG+XANG, ANG+YANG )
     	ENDIF
C
C  GET THE CORNER RADIUS...
C
111	IF( RD1.LT.RD2 ) THEN
     	    CRAD = 0.4*RD1
     	    IF( CRAD.LT..05 ) CRAD = .05
     	    IF( CRAD.GT.RD1 ) CRAD = RD1
     	ELSE
     	    CRAD = 0.4*RD2
     	    IF( CRAD.LT..05 ) CRAD = .05
     	    IF( CRAD.GT.RD2 ) CRAD = RD2
     	ENDIF
C
C  START THE DRAWING...
C
     	CALL IFPLOT( RD1,  0.0, 3 )
     	IF( CRAD.LT.RD2 ) CALL IFPLOT( RD1, RD2-CRAD, 2 )
     	CALL IFBOXS_ARC( RD1-CRAD, RD2-CRAD, CRAD, 0.0  )
     	IF( CRAD.LT.RD1 ) CALL IFPLOT( CRAD-RD1, RD2, 2 )
     	CALL IFBOXS_ARC( CRAD-RD1, RD2-CRAD, CRAD, 90.0 )
     	IF( CRAD.LT.RD2 ) CALL IFPLOT( -RD1, CRAD-RD2, 2 )
     	CALL IFBOXS_ARC( CRAD-RD1, CRAD-RD2, CRAD, 180.0 )
     	IF( CRAD.LT.RD1 ) CALL IFPLOT( RD1-CRAD, -RD2, 2 )
     	CALL IFBOXS_ARC( RD1-CRAD, CRAD-RD2, CRAD, 270.0 )
     	IF( CRAD.LT.RD2 ) CALL IFPLOT( RD1, 0.0, 2 )

     	IF( WID.EQ.0.0 ) GOTO 222
     	RD1 = RD1 - WID
     	RD2 = RD2 - WID
     	WID = 0.0
     	GOTO 111
C
C  RESTORE...
C
222	IF( IRR.GT.5 .AND. ANG.NE.0.0 ) CALL IFROTA( XANG, YANG )
     	IF( IRR.GT.4 ) CALL IFDRAW( -ARRAY(4), -ARRAY(5), -9 )

999	RETURN
    	END

     	SUBROUTINE IFBOXS_ARC( XPS, YPS, RAD, ANS )
C
C	THIS ROUTINE DRAWS AN ARC OF A BOX.
C
    	PARAMETER D2R= 0.17453292E-1

     	XPP = XPS
     	YPP = YPS
     	ANG = ANS
     	RDD = RAD
     	DO I=1, 9
     	   ANG = ANG + 10.0
     	   XOP = RDD*COS(ANG*D2R) + XPP
     	   YOP = RDD*SIN(ANG*D2R) + YPP
     	   CALL IFPLOT( XOP, YOP, 2 )
     	ENDDO
     	RETURN
     	END

