DEFUN C:CLOSE9
;SET LAYER
(COMMAND "SETVAR" "CMDECHO" 0)
(SETQ NY (GETVAR "CLAYER"))
;(IF (= (TYPE F1) 'FILE ) "YES"  (STOP))
;(IF (= (TYPE F2) 'FILE ) "YES" (STOP))
(setq G9SET (findfile "/acad/hon/SET/G9.SET"))
(IF (= G9SET NIL)
    (PROGN
       (PROMPT "\nPLEASE SETTING LAYER IN GROUP 9:" )
       (SETQ FC (OPEN "/acad/hon/SET/G9.SET" "w"))
       (SETQ G9NUM (GETINT"\nHOW MANY LAYERS DO YOU WANT IN GROUP 9:"))
       (WRITE-LINE (ITOA G9NUM) FC)
       (SETQ ORDER 0)
       (REPEAT G9NUM
          (SETQ ORDER (+ ORDER 1))
          (SETQ ORDER1 (STRCAT (ITOA ORDER) "TH"))
          (PROMPT"\nKEYIN LAYER NAME:<")(PROMPT ORDER1)(PROMPT">")
          (SETQ G9LAY (GETSTRING T))
          (IF (= G9LAY "")
              (WRITE-LINE "" FC)
              (WRITE-LINE G9LAY FC)
          )
       )
       (CLOSE FC)
    )
)

 (IF (/= G9SET NIL)
     (PROGN
        (SETQ FC (OPEN "/acad/hon/SET/G9.SET" "r"))
        (SETQ G9NUM (READ-LINE FC))
;       (SETQ G9LAY (READ-LINE FC))
        (IF (OR (= G9NUM "") (= G9NUM NIL))
            (PROGN
               (CLOSE FC)
               (COMMAND G9)
            )
        )
       (IF (OR (= G9NUM NIL) (= G9NUM NIL))
         (PROGN
           (PROMPT "\nPLEASE SETTING LAYER IN GROUP 9:" )
           (SETQ FC (OPEN "/acad/hon/SET/G9.SET" "w"))
           (SETQ G9NUM (GETINT"\nHOW MANY LAYERS DO YOU WANT IN GROUP 9:"))
           (WRITE-LINE (ITOA G9NUM) FC)
           (SETQ ORDER 0)
           (REPEAT G9NUM
              (SETQ ORDER (+ ORDER 1))
              (SETQ ORDER1 (STRCAT (ITOA ORDER) "TH"))
              (PROMPT"\nKEYIN LAYER NAME:<")(PROMPT ORDER1)(PROMPT">")
              (SETQ G9LAY (GETSTRING T))
              (IF (= G9LAY "")
                  (WRITE-LINE "" FC)
                  (WRITE-LINE G9LAY FC)
              )
           )
           (CLOSE FC)
         )
       )
        (IF (/= G9NUM NIL)
           (PROGN
              (SETQ FC (OPEN "/acad/hon/SET/G9.SET" "r"))
              (SETQ G9NUM (READ-LINE FC))
              (PROMPT"\nGROUP 9 LAYERS HAVE:")
              (PROMPT "<" )
              (SETQ G9NUM (ATOI G9NUM))
              (SETQ FY1 "")
              (SETQ FY "")
              (REPEAT G9NUM
                 (SETQ G9LAY (READ-LINE FC))
                 (SETQ FY (STRCAT G9LAY "," FY))
                 (SETQ FY1 FY)
                 (PROMPT G9LAY)(PROMPT"  ")
                 (IF (= G9LAY "")
                     (PROGN
                       (COMMAND "G9")
                       (SETQ G9NUM 0)
                     )
                 )
              )
              (PROMPT">")
           (CLOSE FC)
           )
        )
     )
 )

(COMMAND "LAYER" "FREEZE" FY "")

