Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Reply
Message 1 of 8
kulfi
453 Views, 7 Replies

Xref files

i am looking for a lisp routine which can write all the xrefs attached to the drawings and write to the Text files complete path one by one and in any case if the AutoCAD crashes i can check where the programs stops and start from there.
thanks
Kulfi
Electronics Engineer

Pind Saudi Arabia



7 REPLIES 7
Message 2 of 8
Anonymous
in reply to: kulfi

Try using the reference manager (a separate module on the autocad install
available through the start menu). I think that will do all you want.


wrote in message news:6378907@discussion.autodesk.com...
i am looking for a lisp routine which can write all the xrefs attached to
the drawings and write to the Text files complete path one by one and in any
case if the AutoCAD crashes i can check where the programs stops and start
from there.
thanks
Message 3 of 8
Anonymous
in reply to: kulfi

Hi,

Here is a function which lists all Xrefs found in a drawing and opens the
txt file when done:

;;;=============================
(defun getpaths ( / outputfile fopen)
(defun *error*(msg)(if fopen (close fopen)))
(setq outputfile
(strcat
(getvar 'dwgprefix)
(vl-filename-base (getvar 'dwgname))
".txt"
)
)
(setq fopen (open outputfile "w"))
(vlax-for
item
(vla-get-blocks
(vla-get-activedocument
(vlax-get-acad-object)
)
)
(if (= (vla-get-isxref item) :vlax-true)
(write-line (vla-get-path item) fopen)
)
)
(close fopen)
(startapp "notepad.exe" outputfile)
(princ)
)
;;;=============================

a écrit dans le message de news: 6378907@discussion.autodesk.com...
i am looking for a lisp routine which can write all the xrefs attached to
the drawings and write to the Text files complete path one by one and in any
case if the AutoCAD crashes i can check where the programs stops and start
from there.
thanks
Message 4 of 8
kulfi
in reply to: kulfi

Hi, can u tell me how can i install that reference manager can u tell me step by step.
thanks
Kulfi
Electronics Engineer

Pind Saudi Arabia



Message 5 of 8
Anonymous
in reply to: kulfi

It is installed with AutoCAD. To access it, use the windows start menu
Example: Start->All programs->Autodesk->Autocad 2010->Reference Manager.

You can't access it from within AutoCAD as far as I know but this tool lets
you
explore whole folders and projects of file interactions, not just xrefs
within a single
drawing. It can also explore nested xrefs and their relationships.

wrote in message news:6379800@discussion.autodesk.com...
Hi, can u tell me how can i install that reference manager can u tell me
step by step.
thanks
Message 6 of 8
kulfi
in reply to: kulfi

Thanks for this routine but some time it is collecting all the xrefs and some time it is not so what is the problem why some time why.
THanks
Kulfi
Electronics Engineer

Pind Saudi Arabia



Message 7 of 8
kulfi
in reply to: kulfi

Hi, why this code do not work some times , some it is working but some time not what is the problem let me know.
thanks
(defun Get_Xref_Paths ()
(vl-load-com)
(defun *error*(msg)(if fopen (close fopen)))

;;;; Creat the Drectory if it do not exist
(if (not (vl-file-directory-p "D:\\CAD_Xref_Files\\"))(vl-mkdir "D:\\CAD_Xref_Files\\"))

(if (not (findfile "D:\\CAD_Xref_Files\\Xref_Dwgs_Path.txt"))
(progn
(setq outputfile (strcat "D:\\CAD_Xref_Files\\" "Xref_Dwgs_Path" ".txt"))
(setq fopen (open outputfile "w"))
(setq jbActiveDoc (vlax-get-property (vlax-get-acad-object) 'activedocument))
(vlax-for X (vla-get-blocks jbActiveDoc)(if (= (vlax-get-property X "IsXRef") :vlax-true)
(write-line (vla-get-path X) fopen)))

;(vlax-For aBlk (vla-Get-Blocks (vla-Get-ActiveDocument (vlax-Get-Acad-Object)))(cond ((= (vla-Get-IsXref aBlk) :vlax-True)
;(write-line (vla-get-path aBlk) fopen))))
;(vlax-for item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) (if (= (vla-get-isxref item) :vlax-true)
;(write-line (vla-get-path item) fopen)))
(write-line "-------------------" fopen)
(close fopen)
(startapp "notepad.exe" outputfile)
(princ)
))

;(if (findfile "D:\\CAD_Xref_Files\\Xref_Dwgs_Path.txt")
;(progn
;(Alert "\n File Xref_Dwgs_Path.txt Exists!")
;(initget 1 "D A")
;(setq Question (strcat (getkword "\nDo you want to append the Records OR Delete the File Use D for Deleting the File and A for Appending the Records .....")))
;))
;;; In anyway if u like to delete the file
;(if (= Question "D")
; (progn
;...







































Kulfi
Electronics Engineer

Pind Saudi Arabia



Message 8 of 8
kulfi
in reply to: kulfi

Actually i want to do this process through a Batch Process which means i have different files in different folders and i select a main folder and automatically it goes to every folder open the drawing and if there is any xref in the drawing write it to the file (The path and the file name only).
THanks Edited by: kulfi on Apr 27, 2010 8:18 AM
Kulfi
Electronics Engineer

Pind Saudi Arabia



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

Post to forums  

Autodesk Design & Make Report

”Boost