如何用lisp直接写入多个扩展属性
如何用lisp直接写入多个扩展属性,如在程序名"SOUTH"中同时写入"111111"、"一"、"251"等。谢谢!(-3 ("SOUTH" (1000 . "300000") (1000 . "111111") (1000 . "一") (1000
. "251")))
本帖最后由 llsheng_73 于 2016-8-25 09:28 编辑
(defun tt(e xdatas / ty app);;e为图元名或者有效的图元数据,xdatas扩展数据表((appname data data...)(appname data data...)...(appname data data...))
(setq ty(type e)
app(mapcar'car xdatas))
(vl-every'regapp app)
(if(member ty'(ename list))
(entmod(append(if(= ty'ename)(entget e)e)
(list(cons -3(mapcar'(lambda(x)(cons(car x)
(mapcar'(lambda(x / ty)
(cons(cond((=(setq ty(type x))'str)1000)
((= ty'real)1040)
(t 1070))x))(cdr x))))xdatas)))))))
(tt(car(entsel))'(("SOUTH""300000""111111""一""251"))) llsheng_73 发表于 2016-8-24 22:50 static/image/common/back.gif
(tt(car(entsel))'(("SOUTH""300000""111111""一""251")))
指令: (tt(car(entsel))'(("SOUTH" "300000" "111111" "一" "251")))
选取物件: 损坏的 DXF 群组: (-3 ("SOUTH" (1070 . "300000") (1070 . "111111") (1070 . "一")
(1070 . "251")))
测试没成功 yoyoho 发表于 2016-8-25 07:59 static/image/common/back.gif
指令: (tt(car(entsel))'(("SOUTH" "300000" "111111" "一" "251")))
选取物件: 损坏的 DXF 群组: (-3 ...
已修改'string为'str,经测试正确。。。 llsheng_73 发表于 2016-8-25 09:29 static/image/common/back.gif
已修改'string为'str,经测试正确。。。
感謝 llsheng_73 'string改为'str,测试o.k. llsheng_73 发表于 2016-8-24 22:50 static/image/common/back.gif
(tt(car(entsel))'(("SOUTH""300000""111111""一""251")))
感谢!非常好用,但不知为什么我先用setq赋值时不能写入呢?如(defun c:ttt ()
(setq a "某某")
(tt (car (entsel)) '(("SOUTH""300000" "111111" a "251")))
)这样写为什么不能写入扩展属性,求解,谢谢! yhly555 发表于 2016-8-25 10:42 static/image/common/back.gif
感谢!非常好用,但不知为什么我先用setq赋值时不能写入呢?如这样写为什么不能写入扩展属性,求解,谢谢 ...
(defun c:ttt ()
(setq a "某某")
(tt (car (entsel)) (list(list"SOUTH""300000" "111111" a "251")))
) yoyoho 发表于 2016-8-25 11:22 static/image/common/back.gif
(defun c:ttt ()
(setq a "某某")
(tt (car (entsel)) (list(list"SOUTH""300000" "111111" a "251"))) ...
欧了,谢谢大家!
页:
[1]