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

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

(COMMAND "LAYER" "THAW" FY "")
