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

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

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