本帖最后由 作者 于 2009-7-28 16:51:49 编辑
已知下面程序可以为直线添加扩展数据。可如何才能像块一样,可以自定义属性,并对应赋值?
会不会要每加一个属性,就加上一个 专属名? (regapp "Track")[color="#000000"] (regapp "Track2")
- (defun c:lsp54()
- (regapp "Track")
- (setq new_s (getstring "\n 第一属性:"))
- (if(= new_s "") (setq new_s "A0001"))
- (setq new_i (getstring "\n 第二属性:"))
- (if (null new_i) (setq new_i "123"))
- (setq new_r (getstring "\n 第三属性:"))
- (if (null new_r) (setq new_r "456"))
- (setq en (car (entsel "\n 选择对象")))
- (if en
- (progn
- (setq new_ext_list(list -3 (list "Track"
- (cons 1000 new_s)
- (cons 1000 new_i)
- (cons 1000 new_r))))
- (setq endata (entget en))
- (setq entype (cdr (assoc 0 endata)))
- (if (setq old_ext_list (assoc -3 endata))
- (setq endata (subst new_ext_list old_ext_list endata))
- (setq endata (append endata(list new_ext_list)))
- )
- (entmod endata)
- (alert (strcat entype "加入扩展数据库成功" new_s "," new_i "," new_r))
-
- )
-
- )
- (prinl)
- )
|