DEFUN C:GRCOPY3
;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))
              (SETQ G3NUM (ATOI G3NUM))
              (SETQ FY1 "")
              (SETQ FY "")
              (SETQ P1 (GETPOINT"\nBASE POINT:"))
              (SETQ P2 (GETPOINT P1"\nTO POINT:"))
              (PROMPT"\nGROUP 3 LAYERS HAVE:")
              (PROMPT "<" )
              (REPEAT G3NUM
                 (SETQ G3LAY (READ-LINE FC))

                 (SETQ MAX (GETVAR "EXTMAX"))
                 (SETQ MIN (GETVAR "EXTMIN"))
                 (COMMAND "SELECT" "CROSSING" MIN MAX "")
                 (SETQ LA G3LAY)
                 (SETQ SA (SSGET "X" (LIST (CONS 8 LA))))
                 (IF (/= SA NIL)
                     (PROGN
                       (COMMAND "COPY" SA "" P1 P2)
                       (SETQ SA NIL)
                     )
                 )

                 (SETQ FY (STRCAT G3LAY "," FY))
                 (SETQ FY1 FY)
                 (PROMPT G3LAY)(PROMPT"  ")
                 (IF (= G3LAY "")
                     (PROGN
                       (COMMAND "G3")
                       (SETQ G3NUM 0)
                     )
                 )
              )
              (PROMPT">")
           (CLOSE FC)
           )
        )
     )
 )
