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