Is there a lisp that will rename xrefs in tool palette (not the file name) in multiple drawings?
regards,
roldan
Solved! Go to Solution.
Solved by hmsilva. Go to Solution.
@rulep21 wrote:
Is there a lisp that will rename xrefs in tool palette (not the file name) in multiple drawings?
Hi Roldan,
this is not the program you're looking for, is just a 'demo' and a starting point.
If the xref names are like those in example 'Some-Name-Final Name' the code will remove part of the name until the last '-' at the xref name and will try to put the xref with that name if no other with the same name.
To process more than one dwg, do a search at 'Search This Board' for batch or process, and you'll get many examples how to accomplish that.
(defun c:demo (/ name newn pos) (vlax-For blk (vla-Get-Blocks (vla-Get-ActiveDocument (vlax-Get-Acad-Object))) (if (and (= (vla-Get-IsXref blk) :vlax-True) (wcmatch (setq name (vla-get-Name blk)) "*-*") ) (progn (setq pos (vl-string-position (ascii "-") name nil T) newn (substr name (+ pos 2)) ) (if (not (vl-catch-all-error-p (vl-catch-all-apply '(lambda () (vla-put-Name blk newn))) ) ) (vla-reload blk) ) ) ) ) (princ) )
Hope that helps
Henrique