使用实际$
您好,我想知道是否有人可以告诉我如何编写脚本或lisp来更新标题栏中名为DRAWINGNAME的属性。具有实际$FILENAME$的DWG。我正在尝试更新旧的标题栏,这些标题栏不是在考虑字段概念的情况下创建的。提前感谢您,
卡梅隆 我在这里可能有点离题,但我的理解是,您希望更新旧图形中的标题栏,以便名为“DRAWINGNAME”的属性包含图形的文件名。
我说得对吗? 是的,李。我需要DRAWINGNAME属性使用的实际文件名(无论其名称如何)。非常感谢。 试一试{Untested}
(defun c:dwgupd (/ ss eLst dNme aEnt aEntLst)
(vl-load-com)
(if (setq ss (ssget "X" (list (cons 0 "INSERT") (cons 2 "TITLE") (cons 66 1)
(if (getvar "CTAB")
(cons 410 (getvar "CTAB"))
(cons 67 (- 1 (getvar "TILEMODE")))))))
(progn
(setq eLst (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
dNme (vl-filename-base (getvar "DWGNAME")))
(foreach e eLst
(setq aEnt (entnext e))
(while (not (eq "SEQEND" (cdadr (setq aEntLst (entget aEnt)))))
(if (= "DRAWINGNAME" (cdr (assoc 2 aEntLst)))
(entmod (subst (cons 1 dNme)(assoc 1 aEntLst) aEntLst)))
(setq aEnt (entnext aEnt)))))
(princ "\n<!> No Title Blocks Found <!> "))
(princ))
这听起来很熟悉,是不是李。 太好了,李!你真有学问。非常感谢。我现在只需要重新生成它,这样我就知道已经发生了变化。我会设法弄明白的。再次感谢!
我已经花了很多时间练习编写块属性更新例程,现在我闭上眼睛就可以完成了 啊,是的,我没有在里面放摄政王。。。只需在末尾加上这个(就在最后一个(普林斯)之前):
(command "_regenall")
即
(defun c:dwgupd (/ ss eLst dNme aEnt aEntLst)
(vl-load-com)
(if (setq ss (ssget "X" (list (cons 0 "INSERT") (cons 2 "TITLE") (cons 66 1)
(if (getvar "CTAB")
(cons 410 (getvar "CTAB"))
(cons 67 (- 1 (getvar "TILEMODE")))))))
(progn
(setq eLst (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
dNme (vl-filename-base (getvar "DWGNAME")))
(foreach e eLst
(setq aEnt (entnext e))
(while (not (eq "SEQEND" (cdadr (setq aEntLst (entget aEnt)))))
(if (= "DRAWINGNAME" (cdr (assoc 2 aEntLst)))
(entmod (subst (cons 1 dNme)(assoc 1 aEntLst) aEntLst)))
(setq aEnt (entnext aEnt)))))
(princ "\n<!> No Title Blocks Found <!> "))
(command "_regenall")
(princ))
非常感谢。我最终也明白了,在你建议的位置使用这个命令。似乎也能做到,但我想我会用你的。。。那样更专业!
(princ“\n未找到标题栏”))
(普林斯)
(命令“REGEN”)
)
页:
[1]
2