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

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

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