;;启动监视
(defun c:tt()
(or *dbreactor*
(setq *dbreactor* (vlr-acdb-reactor nil '((:vlr-objectModified . Dbdified)
)
)
)
)
(princ "\n文字编辑监视器启动")
(princ)
)
;;反应器
(defun Dbdified (reactor_object obj / e)
(if (or (= "MTEXT" (GXL-DXF (cadr obj) 0))
(= "TEXT" (GXL-DXF (cadr obj) 0))
)
(progn
(if (not (member (setq e (cadr obj)) *ModifiedList*))
(progn
(setq *ModifiedList* (cons (cadr obj) *ModifiedList*)
*enlst* nil)
(princ (strcat "\n" (itoa (length *ModifiedList*)) "个文字对象被修改!"))
)
)
)
)
)
;;显示更改文字
(defun c:tt1 ()
(if *ModifiedList*
(foreach en *ModifiedList*
(if (entget en)
(progn
(vlr-remove *dbreactor*)
(setq *ModifiedData*
(cons (cond ((setq color (gxl-dxf en 62)) (cons en color))
(t (cons en 256))
)
*ModifiedData*)
)
(gxl-ch_ent en 62 1)
(vlr-add *dbreactor*)
)
)
)
)
(princ)
)
;;关闭监视
(defun c:tt2 ()
(foreach a *ModifiedData*
(gxl-ch_ent (car a) 62 (cdr a))
)
(setq *ModifiedData* nil *ModifiedList* nil)
(vlr-remove *dbreactor*)
(setq *dbreactor* nil)
(princ "\n文字编辑监视器关闭")
(princ)
)
(defun gxl-dxf (ent i)
(cond ((= (type ent) 'ename)
(cdr (assoc i (entget ent '("*"))))
)
((= (type ent) 'list)
(cdr (assoc i ent))
)
) ;_ if
)
(defun gxl-CH_Ent (ent i pt / en)
(if (assoc i (setq en (entget ent)))
(setq en (subst (cons i pt) (assoc i en) en))
(setq en (append en (list (cons i pt))))
)
(entmod en)
)