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

 (IF (/= G4SET NIL)
     (PROGN
        (SETQ FC (OPEN "C:/ACAD/ACAD/SUPPORT/G4.SET" "r"))
        (SETQ G4NUM (READ-LINE FC))
        (IF (OR (= G4NUM "") (= G4NUM NIL))
            (PROGN
               (CLOSE FC)
               (COMMAND "G4")
            )
        )
        (IF (/= G4NUM NIL)
           (PROGN
              (SETQ G4NUM (ATOI G4NUM))
              (SETQ FY4 "")
              (SETQ FY "")
              (REPEAT G4NUM
                 (SETQ G4LAY (READ-LINE FC))
                 (SETQ FY (STRCAT G4LAY "," FY))
                 (SETQ FY4 FY)
                 (PROMPT "\n" )(PROMPT G4LAY)
                 (IF (= G4LAY "")
                     (PROGN
                       (COMMAND "G4")
                       (SETQ G4NUM 0)
                     )
                 )
              )
           )
        )
     )
 )
