Need routine to add suffix to xref file names

Discussion in 'AutoCAD' started by Edgetrimmer, Apr 22, 2004.

  1. Edgetrimmer

    Edgetrimmer Guest

    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
     
    Edgetrimmer, Apr 22, 2004
    #1
  2. Edgetrimmer

    hawstom Guest

    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
     
    hawstom, Apr 22, 2004
    #2
  3. Edgetrimmer

    Edgetrimmer Guest

    Thanks guy. I'll take a look at your code and (tblnext "BLOCK").

    Regards,
    Edgetrimmer


    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:
    you can see how you will use what it gives you to accomplish what you want.
     
    Edgetrimmer, Apr 22, 2004
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.