I've got the following code to write out xrefs to a text file. Credit goes
to Henry Francis for the original code... My question is, how do I add the
drawing name in front of the xref list path? TIA
IE:
filename.dwg - C:\path\xrefname1.dwg
filename.dwg - C:\path\xrefname2.dwg
============================
(defun c:xreflist (/ blk_def blk_lst xrlst_in xrlst_out line_in ex_xr_lst
tname)
(setq tname (getvar "dwgname")
tname (dos_strreplace tname ".dwg" "-xref.txt"))
(setq blk_def (tblnext "block" T))
(if (assoc 1 blk_def)
(setq blk_lst (list (cdr (assoc 1 blk_def))))
) ;_ end of if
(while (setq blk_def (tblnext "block"))
(if (assoc 1 blk_def)
(setq blk_lst (append (list (cdr (assoc 1 blk_def))) blk_lst))
) ;_ end of if
) ;_ end of while
(if (setq xrlst_file (findfile (strcat (getvar "dwgprefix") tname)))
(progn
(setq xrlst_in (open xrlst_file "r"))
(while (setq line_in (read-line xrlst_in))
(if (not ex_xr_lst)
(setq ex_xr_lst (list line_in))
(setq ex_xr_lst (append (list line_in) ex_xr_lst))
) ;_ end of if
) ;_ end of while
(close xrlst_in)
) ;_ end of progn
) ;_ end of if
(progn
(foreach n blk_lst
(if (member n ex_xr_lst)
nil
(setq ex_xr_lst (append (list n) ex_xr_lst))
) ;_ end of if
) ;_ end of foreach
(if ex_xr_lst
(progn
(setq ex_xr_lst (acad_strlsort ex_xr_lst))
(setq xrlst_out (open (strcat (getvar "dwgprefix") tname) "w"))
(foreach n ex_xr_lst
(write-line n xrlst_out)
) ;_ end of foreach
(close xrlst_out)
) ;_ end of progn
) ;_ end of if
) ;_ end of progn
(mapcar
'(lambda (x) (princ (strcat "\n" x)))
blk_lst
) ;_ end of mapcar
(princ)
) ;_ end of defun