(DEFUN C:MATCH2 (/ SSET QO# OBJ Q|# Q%# Q?0 Qj0 Q@0 QQ0 Ql0)
;(F:MODS (quote  ("cmdecho")))
 (SETVAR"cmdecho"0)
 (MENUCMD"s=aj01ab")
 (PROMPT"\n \n \nSelect the objects that will be altered: ")
 (SETQ SSET (SSGET))
 (INITGET"Color Elev LAyer LType Thick Ins.Pt")
 (MENUCMD"s=ay22b")
 (WHILE
  (SETQ QO# (GETKWORD
        "\nMatch what property  (Color/Elev/LAyer/LType/Thick/Ins.Pt):"))
  (SETQ Q&0 T)
  (WHILE Q&0
   (PROMPT"\nSelect the object that you want to match: ")
   (SETQ OBJ (ENTSEL))
   (COND
    ((EQ OBJ NIL)
     (PROMPT"\nNo object found.  Try again.")
    )
    (T
     (SETQ OBJ (ENTGET (CAR OBJ))Q&0 NIL)
    )
   )
  )
  (COND
   ((EQ QO#"Color")
    (IF (NULL (SETQ Q|# (CDR (ASSOC 62 OBJ))))
     (PROGN
      (SETQ Q|# (CDR (ASSOC 62 (TBLSEARCH"layer" (CDR (ASSOC 8 OBJ))))))
     )
    )
    (COMMAND "change" SSET "" "p" "c" Q|# "")
   )
   ((EQ QO# "Elev")
    (SETQ Q|# (CDR (ASSOC 38 OBJ)))
    (IF (EQ Q|# NIL)
     (SETQ Q|# "0")
    )
    (COMMAND "change" SSET "" "p" "e" Q|# "")
   )
   ((EQ QO# "Thick")
    (SETQ Q|# (CDR (ASSOC 39 OBJ)))
    (IF (EQ Q|# NIL)
     (SETQ Q|# "0")
    )
    (COMMAND "change" SSET "" "p" "t" Q|# "")
   )
   ((EQ QO# "LAyer")
    (SETQ Q|# (CDR (ASSOC 8 OBJ)))
    (COMMAND "change" SSET "" "p" "la" Q|# "")
   )
   ((EQ QO# "LType")
    (IF (NULL (SETQ Q|# (CDR (ASSOC 6 OBJ))))
     (PROGN
      (SETQ Q|# (CDR (ASSOC 6 (TBLSEARCH "layer" (CDR (ASSOC 8 OBJ))))))
     )
    )
    (COMMAND "change" SSET "" "p" "lt" Q|# "")
   )
   ((EQ QO# "Ins.Pt")
    (SETQ Q%# (CDR (ASSOC 0 OBJ))Q?0 NIL)
    (COND
     ((OR (EQ Q%# "3DLINE") (EQ Q%# "3DFACE"))
      (SETQ Q?0 (CADDDR (ASSOC 10 OBJ)))
      (SETQ Q@0 11)
      (WHILE
       (SETQ Qj0 (CADDDR (ASSOC Q@0 OBJ)))
       (IF (> Qj0 Q?0)
        (SETQ Q?0 Qj0)
       )
       (SETQ Q@0 (1+ Q@0))
      )
     )
     (T
      (SETQ Ql0 (CDR (ASSOC 39 OBJ)) QQ0 (CDR (ASSOC 38 OBJ)))
      (IF (NULL Ql0)
       (SETQ Ql0 0)
      )
      (IF (NULL QQ0)
       (SETQ QQ0 0)
      )
      (SETQ Q?0 (+ QQ0 Ql0))
     )
    )
    (IF Q?0
     (COMMAND "change" SSET "" "p" "elev" Q?0 "")))
  )
  (COMMAND "undo" "end" "undo" "mark")
  (MENUCMD "s=ay22b")
  (INITGET "Color Elev LAyer LType Thick Ins.Pt")
 )
 (MENUCMD "s=ay22a")
;(F:MODR)
 (PROMPT "\n \n \nProcessing completed.")
 (PRINC)
)
