你好
首先,我要提到我不熟悉编写LISP表达式。有人很好,为我写了这封信。不幸的是,我不能完全让它工作,我希望有人在这里可以帮助我。
我的公司更新了服务器以及外部参照的文件路径。以下是之前和之后的示例:
W: 06-5214 Dunhams农场
同样的路径现在是:
W: \HILLSBOROUGH\W\U WINDOWS\06-5214 Dunhams Farm\000\Cad
目标是在打开新图形时运行此LISP,并通过插入上面的红色部分自动重定向外部参照路径。当我执行为我编写的LISP时,它会重定向外部参照,但会将文件夹添加到路径中两次,如下所示:
W: \HILLSBOROUGH\W\u WINDOWS\HILLSBOROUGH\W\u WINDOWS\06-5214 Dunhams Farm\000\Cad
有没有办法修改LISP以只插入文件夹一次?我真的很感谢你的帮助。以下是例行程序:
- ((lambda ( / activeDwgObj pathStr block-list xref-list xrefPathStr)
- (vl-load-com)
- (princ "\nUpdating XREF paths....")
- (setq
- activeDwgObj (vla-get-activedocument (vlax-get-acad-object))
- pathStr (vlax-get activeDwgObj 'Path)
- )
- (vlax-for for-item
- (vla-get-blocks activeDwgObj)
- (setq block-list (append block-list (list for-item)))
- )
- (setq xref-list (vl-remove-if '(lambda (x) (= (vla-get-isxref x) :vlax-false)) block-list))
- (foreach n xref-list
- (setq xrefPathStr (vlax-get n 'Path))
- (if (eq (substr xrefpathstr 1 1) ".")
- (vlax-put n 'Path (strcat (vl-string-subst "W:\\HILLSBOROUGH\\W_WINDOWS" "W:" PathStr 0) (substr xrefPathStr 2)))
- (vlax-put n 'Path (vl-string-subst "W:\\HILLSBOROUGH\\W_WINDOWS" "W:" xrefPathStr 0))
- )
- )
- ))
|