是用了扩展数据 (entget (car (entsel)) '("*")) 可以取出扩展数据
;;;给图元附上扩展数据 ;;;用法(jx_set_xdata (car (entsel)) "test" (list(cons 1000 "test"))) (defun jx_set_xdata (en rname xd_list / old all elist) (setq elist (entget en '("*")) rname (strcase rname) ) (regapp rname) (setq xd_list (cons rname xd_list) old (assoc -3 elist) ) (cond ((and old (assoc rname (cdr old))) (setq all (cons -3 (subst xd_list (assoc rname (cdr old)) (cdr old))) elist (subst all (assoc -3 elist) elist) ) (entmod elist) ) ((and old (not (member rname (cdr old)))) (setq all (append old (list xd_list)) elist (subst all (assoc -3 elist) elist) ) (entmod elist) ) ((not old) (setq xd_list (list -3 xd_list) elist (append elist (list xd_list)) ) (entmod elist) ) ) ) |