Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Need routine to add suffix to xref file names

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
269 Views, 2 Replies

Need routine to add suffix to xref file names

Hey programmers, I would like to find a lisp or vb program that will automatically add a user provided suffix to xrefs to load. For example a sheet might have a number of xrefs loaded with typical paths such as "\jobs\04-100\xbase.dwg", "\jobs\04-100\xrcp.dwg", etc. and I want to be able to run a routine inside the sheet file to automatically add a suffix such as "_001" to each of the existing xref paths. The "\jobs\04-100\xrcp.dwg" would become "\jobs\04-100\xrcp_001.dwg", etc. Is this easy to do? Thanks for any help. Edgetrimmer
2 REPLIES 2
Message 2 of 3
hawstom
in reply to: Anonymous

Try using (tblnext "BLOCK") to get the information for each of your xrefs in turn, then using the xref command to change the paths and the rename command to change the name in the drawing. Something like this:

(defun c:chxrefnames ( / blocki)
(while (setq blocki (tblnext "BLOCK" (not blocki)))
(cond
( (= 4 (logand (cdr (assoc 70 blocki)) 4) ;if block is an XREF
(command "._xref"); do some stuff here to change the path
(command "._rename"); do some stuff here to change the name
)
)
)
)

You need to try the (tblnext "BLOCK") function at the command prompt so you can see how you will use what it gives you to accomplish what you want.

Tom Haws
Message 3 of 3
Anonymous
in reply to: Anonymous

Thanks guy. I'll take a look at your code and (tblnext "BLOCK"). Regards, Edgetrimmer "hawstom" wrote in message news:9158544.1082668114245.JavaMail.javamailuser@localhost... > Try using (tblnext "BLOCK") to get the information for each of your xrefs in turn, then using the xref command to change the paths and the rename command to change the name in the drawing. Something like this: > > (defun c:chxrefnames ( / blocki) > (while (setq blocki (tblnext "BLOCK" (not blocki))) > (cond > ( (= 4 (logand (cdr (assoc 70 blocki)) 4) ;if block is an XREF > (command "._xref"); do some stuff here to change the path > (command "._rename"); do some stuff here to change the name > ) > ) > ) > ) > > You need to try the (tblnext "BLOCK") function at the command prompt so you can see how you will use what it gives you to accomplish what you want. > > Tom Haws

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost