Xref repath like find command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi I found a lisp that I want.
But It changes only 1 word.
Help me please...
ex.
O : C:\before\before\before.dwg -> C:\after/after/after.dwg
X : C:\before\before\before.dwg -> C:\after/before/before.dwg
----------------------- LISP CODE -------------------
;;Written by Clinton Cogswell
;;November 19, 2013
(defun c:path ( / sFullPath )
(vl-load-com)
;;Requests text in path to be replaced
(setq oldPath (getstring t "\nEnter Existing Path to be replaced: "))
;;Requests text to replace the old with
(setq newPath (getstring t "\nEnter New path: "))
(vlax-for x
;;grabs all blocks including xref's
(vla-get-Blocks
(vla-get-ActiveDocument
(vlax-get-acad-object)
)
)
;;goes thru blocks and changes the path for xrefs
(if
(eq :vlax-true (vla-get-isXref x))
(progn
(setq sFullPath (vla-get-path x))
;;Checks if the path contains the oldPath text and if the
;;path contains the text it then replaces it with the new text
(if
(vl-string-search oldPath sFullPath 0)
(progn
(setq sNewFullPath (vl-string-subst newPath oldPath sFullPath 0))
(vla-put-path x sNewFullPath)
(vla-reload x)
) ; progn
) ; if
) ; progn
) ; if
) ; for
(princ)
)