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

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

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

(SETQ ANS (strcase (GETSTRING "\nDO YOU WANT TO CHANGE LAST SETTING <Y/N> N:")))
 (IF (= ANS "Y")
     (PROGN
       (PROMPT "\nPLEASE SETTING LAYER IN GROUP 2:" )
       (SETQ FC (OPEN "/ACAD/HON/SET/G2.SET" "w"))
       (PROMPT"\nHOW MANY LAYERS DO YOU WANT IN GROUP 2:")
       (PROMPT"<")(PRIN1 G2NUM)(PROMPT">")
       (SETQ G2NUMN G2NUM)
       (SETQ G2NUM (GETINT))
       (IF (OR (= G2NUM "") (= G2NUM NIL))
           (WRITE-LINE (ITOA G2NUMN) FC)
           (WRITE-LINE (ITOA G2NUM) FC)
       )
       (SETQ ORDER 0)
       (IF (OR (= G2NUM "") (= G2NUM NIL))
           (SETQ G2NUM G2NUMN)
       )
       (REPEAT G2NUM
          (SETQ ORDER (+ ORDER 1))
          (SETQ ORDER1 (STRCAT (ITOA ORDER) "TH"))
          (PROMPT"\nKEYIN LAYER NAME:<")(PROMPT ORDER1)(PROMPT">")
          (SETQ G2LAY (GETSTRING T))
          (IF (= G2LAY "")
              (WRITE-LINE "" FC)
              (WRITE-LINE G2LAY FC)
          )
       )
       (CLOSE FC)
     )
 )

