Results 1 to 5 of 5

Thread: extract xref name-path to text file

  1. #1
    Member
    Join Date
    2001-12
    Posts
    8
    Login to Give a bone
    0

    Default extract xref name-path to text file

    Have searched for an hour to find a previous solution, and got some interesting reading, but no cigar.

    Anyone know of a routine to extract xref name/path from (prefereably multiple) drawings, and send them to a text file?

    The purpose is to repair all those paths that have been orphaned, due to other people renaming folders and moving folders, not realizing the havoc they are creating with xref paths.

    Having a printout of the paths required by each drawing in front of me, I can go more quickly (and with less stress) to find the xref child drawing and re-unite it with the parent sheet drawing.

    Thanks in advance, once again (I hope) you will have saved my ***(ignment)

    John
    Akol & Yoshii Architects
    Walnut Creek Ca

  2. #2
    100 Club
    Join Date
    2005-09
    Posts
    111
    Login to Give a bone
    0

    Default Re: extract xref name-path to text file

    Dear John,

    You mean something like my first attempt:

    Code:
    (defun C:XrPath( / ss1 DirOutput DwgName OutFile filedes i Ent Obj)
    (setq ss1 nil ss1 (ssget "X" (list '(0 . "INSERT"))))
    (if ss1
    (progn
    (setq DirOutput "C:\\") ;(setq DirOutput (getvar "DWGPREFIX"))
    (setq DwgName (getvar "DwgName"))
    (setq DwgName (substr DwgName 1 (- (strlen DwgName) 4)))
    (setq OutFile (strcat DirOutput DwgName ".txt"))
    (setq filedes (open OutFile "w"))
    (setq i 0)
    (repeat (sslength ss1)
    (setq Ent (ssname ss1 i))
    (setq Obj (vlax-Ename->Vla-Object Ent))
    (if (vlax-property-available-p Obj 'Path)
    (progn
    (princ (vla-get-path Obj) filedes)
    (princ "\n" filedes)
    ))
    (setq i (1+ i))
    )
    (close filedes)
    ))
    )
    Regards, HofCAD CSI
    Last edited by hofcad; 2008-01-22 at 09:22 AM.

  3. #3
    Member vmichl's Avatar
    Join Date
    2002-04
    Location
    C.Budejovice, Czechia
    Posts
    34
    Login to Give a bone
    0

    Default Re: extract xref name-path to text file

    You can also use the Reference Manager tool (installed with AutoCAD) and its Report export function to create a .CSV text file with reference path. Or you can fix the paths immediately.

    Vladimir Michl, www.xanadu.cz

  4. #4
    100 Club
    Join Date
    2005-09
    Posts
    111
    Login to Give a bone
    0

    Default Re: extract xref name-path to text file

    Dear John,

    You mean something like my second attempt:

    Code:
    (defun C:XrPath2( / DirOutput DwgName OutFile filedes Block)
    (setq DirOutput "C:\\")
    (setq DwgName (getvar "DwgName"))
    (setq DwgName (substr DwgName 1 (- (strlen DwgName) 4)))
    (setq OutFile (strcat DirOutput DwgName ".txt"))
    (setq filedes (open OutFile "w"))
    (vlax-for BLOCK (vla-get-blocks (vla-get-activedocument(vlax-get-acad-object)))
    (if (= (vla-get-isxref BLOCK):vlax-true)
    (progn 
    (princ (vla-get-path Block) filedes)
    (princ "\n" filedes)))
    )
    (close filedes)
    )
    Regards, HofCAD CSI

  5. #5
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: extract xref name-path to text file

    Quote Originally Posted by vmichl View Post
    You can also use the Reference Manager tool (installed with AutoCAD) and its Report export function to create a .CSV text file with reference path. Or you can fix the paths immediately.

    Vladimir Michl, www.xanadu.cz
    Probably what you wanted. This operates on multiple drawings at once, no extra lisp routine required - it's installed with AutoCAD. You can find it in the Start Menu --> All Programs --> AutoDesk --> AutoCAD ... --> Reference Manager.

    You can then select the drawing(s) you want top check, export a report on xrefs, images, dwf underlays, etc. to a spreadsheet file (xml, csv or xls). You can even change the path(s) of several xrefs at once - just remember that they might then be unloaded when you open the drawing.

Similar Threads

  1. 2012 Extract the arborescence and properties in a text file
    By the_djodjo351945 in forum NavisWorks - General
    Replies: 5
    Last Post: 2013-04-22, 05:31 PM
  2. Change Xref from Full Path to Relative Path
    By ccowgill in forum AutoLISP
    Replies: 6
    Last Post: 2009-05-27, 11:54 AM
  3. Replies: 1
    Last Post: 2007-05-05, 02:59 PM
  4. Relevative Path vs Full Path Xref Swap *
    By tomdillenbeck in forum AutoCAD Wish List
    Replies: 3
    Last Post: 2005-05-26, 06:19 PM
  5. Replies: 5
    Last Post: 2004-09-13, 01:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •