Xref Relative pathing

Discussion in 'AutoCAD' started by tjprice, Feb 26, 2004.

  1. tjprice

    tjprice Guest

    I'm not sure of the most efficient method is to replace xref pathing with relative by use of script or lisp routine. Using AutoDesk Building Systems 2004.
    Objective: run a routine against a list of drawings to search xref paths find a set path in the filename location and replace with ..\ preceding that directory. e.g. replace L:\123456\DISCIPLINE\*.DWG with ..\DISCIPLINE\*.DWG. Can this be done?
    I've already gotten as far as using the command line:
    -XREF
    PATH
    *.DWG (CORRECT?) to capture all xrefs attached to the drawing.

    Will any of this work?

    Help!!!
     
    tjprice, Feb 26, 2004
    #1
  2. tjprice

    Casey Guest

    Just a suggestion, but you may want to look into the command REDIR. This is
    basically what it is designed for.

    Casey


    relative by use of script or lisp routine. Using AutoDesk Building Systems
    2004.
    find a set path in the filename location and replace with ..\ preceding that
    directory. e.g. replace L:\123456\DISCIPLINE\*.DWG with ..\DISCIPLINE\*.DWG.
    Can this be done?
     
    Casey, Feb 26, 2004
    #2
  3. Suggestions:
    1. Use the Express Tool REDIR and REDIRMODE (read the Express Tools HELP to
    understand how it works). Personally, I don't like how it works.

    2. Use the Autodesk 2004 "Reference Manager", a seperate executable that
    ships and installs with AutoCAD 2004.

    3. In your scenario, it sounds like you just want to do a search and
    replace, rather than use some sort of relative pathing utility that
    acctually analyzes the paths for variable circumstances. Such a utility
    must figure out whether the XREF is "above", "lateral to" or "below" the
    parent file, test whether it's on another drive or not (can't be relative if
    on another drive), and other such conditions. It's an exercise of comparing
    paths for all XREFs and Images then determining how to strip off just the
    correct amount of superfluous upper level path information. I have written
    such a utility, called XRP14.LSP. I have posted this on a couple CAD
    utility types of web sites, but I think the version that's out there checks
    the AutoCAD version and prevents running in 2004 (even though it will
    function in 2004). I can post a version for 2004 to customer-files if your
    interested.... it'll work on images and xrefs, and will run 100 tries.

    --
    Mark McDonough
    Sasaki Associates
    http://www.sasaki.com

    relative by use of script or lisp routine. Using AutoDesk Building Systems
    2004.
    find a set path in the filename location and replace with ..\ preceding that
    directory. e.g. replace L:\123456\DISCIPLINE\*.DWG with ..\DISCIPLINE\*.DWG.
    Can this be done?
     
    Mark McDonough, Feb 26, 2004
    #3
  4. (defun c:Xpathrel ( / cmd cnt cntm cntx info npath xdat )
    (setq xdat (tblnext "block" T)
    cnt 1
    cntx 0
    cntm 0
    info (fileinfo)
    cmd (getvar"cmdecho")
    );setq
    (setvar"cmdecho" 0)
    (terpri)
    (while xdat
    (princ (strcat"\rPath Fix - Processing Block: "(itoa cnt)"\tXrefs:
    "(itoa cntx)"\tModified: "(itoa cntm)" "))
    (if (assoc 1 xdat)
    (progn
    (setq cntx (+ cntx 1))
    (if (wcmatch (strcase(cdr (assoc 1 xdat)))(strcat
    (strcase(nth 3 info))"*"))
    (progn
    (setq npath (substr (cdr (assoc 1 xdat))(+(strlen
    (nth 3 info)) 1))
    cntm (+ cntm 1)
    );setq
    (command ".-xref" "p" (cdr (assoc 2 xdat)) npath)
    );progn
    (progn
    ; (princ "OK!")(terpri);*for debugging
    );progn
    );if
    );progn
    ()
    );if
    (setq xdat (tblnext "block")
    cnt (+ cnt 1)
    );setq
    );while
    (setvar"cmdecho" cmd)
    (princ)
    );defun c:Xpathrel
     
    Martin Wright, Feb 27, 2004
    #4
  5. tjprice

    tjprice Guest

    Thanks for your lisp routine. I will certainly give it a try! All replies to my question were valid and helpful!
     
    tjprice, Mar 2, 2004
    #5
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.