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

 (IF (/= G7SET NIL)
     (PROGN
        (SETQ FC (OPEN "/ACAD/HON/SET/G7.SET" "r"))
        (SETQ G7NUM (READ-LINE FC))
;       (SETQ G7LAY (READ-LINE FC))
        (IF (OR (= G7NUM "") (= G7NUM NIL))
            (PROGN
               (CLOSE FC)
               (COMMAND G7)
            )
        )
       (IF (OR (= G7NUM NIL) (= G7NUM NIL))
         (PROGN
           (PROMPT "\nPLEASE SETTING LAYER IN GROUP 7:" )
           (SETQ FC (OPEN "/ACAD/HON/SET/G7.SET" "w"))
           (SETQ G7NUM (GETINT"\nHOW MANY LAYERS DO YOU WANT IN GROUP 7:"))
           (WRITE-LINE (ITOA G7NUM) FC)
           (SETQ ORDER 0)
           (REPEAT G7NUM
              (SETQ ORDER (+ ORDER 1))
              (SETQ ORDER1 (STRCAT (ITOA ORDER) "TH"))
              (PROMPT"\nKEYIN LAYER NAME:<")(PROMPT ORDER1)(PROMPT">")
              (SETQ G7LAY (GETSTRING T))
              (IF (= G7LAY "")
                  (WRITE-LINE "" FC)
                  (WRITE-LINE G7LAY FC)
              )
           )
           (CLOSE FC)
         )
       )
        (IF (/= G7NUM NIL)
           (PROGN
              (SETQ FC (OPEN "/ACAD/HON/SET/G7.SET" "r"))
              (SETQ G7NUM (READ-LINE FC))
              (SETQ G7NUM (ATOI G7NUM))
              (SETQ FY1 "")
              (SETQ FY "")
              (SETQ P1 (GETPOINT"\nBASE POINT:"))
              (SETQ P2 (GETPOINT P1"\nTO POINT:"))
              (PROMPT"\nGROUP 7 LAYERS HAVE:")
              (PROMPT "<" )
              (REPEAT G7NUM
                 (SETQ G7LAY (READ-LINE FC))

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

                 (SETQ FY (STRCAT G7LAY "," FY))
                 (SETQ FY1 FY)
                 (PROMPT G7LAY)(PROMPT"  ")
                 (IF (= G7LAY "")
                     (PROGN
                       (COMMAND "G7")
                       (SETQ G7NUM 0)
                     )
                 )
              )
              (PROMPT">")
           (CLOSE FC)
           )
        )
     )
 )
