- (defun c:c8 (/ co ent get-dxf lm-get-color tcm ty)
- (defun get-dxf(en n)
- (if (not (listp en)) (setq en (entget en)))
- (cdr (assoc n en))
- )
- (defun lm-get-color (ty / co)
- (if (setq co (get-dxf ty 62))
- (progn co)
- (progn (cdr (assoc 62 (tblsearch "layer" (get-dxf ty 8)))))
- )
- )
- (princ "\nc8将对象的图层置为当前--且图层颜色跟随对象")
- (setq ty (car(entsel "\n选择对象:")))
- (setq co (lm-get-color ty))
- (setvar "clayer"(setq tcm (get-dxf ty 8)))
- (setq ty (tblobjname "layer" tcm))
- (setq ent (entget ty))
- (setq ent (subst (cons 62 co) (assoc 62 ent) ent))
- (entmod ent)
- (princ)
- )
|