(defun C:GTC()
(vl-load-com)
(print "\n请选择需要转换图层的对象:")
(setq ss (ssget))
(setq xx nil T_Nil t)
(while (eq t T_Nil)
(setq xx (getstring "\n输入图层名字:"))
(setq T_Nil (null (tblsearch "layer" xx)))
)
(setq n (sslength ss))
(setq i 0)
(while (< i n)
(setq ent (ssname ss i))
(setq obj (vlax-ename->vla-object ent))
(vla-put-Layer obj xx)
(setq ent nil)
(setq obj nil)
(setq i (+ i 1)))
(princ))
(defun c:ccM (/ ss ent layr)
(princ "\移动到层目标层")
(setq ent (Cdr(Assoc 8 (Entget (Car(Entsel))))))
(setq ss (ssget))
(if ss
(progn
(vl-cmdf "CHANGE" ss "" "P" "LA" ent "");"WEDM"
)
)
(princ)
)