Accessing Title block attributes without open the drawing

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have tried to get the drawing file name and the title of the drawing from block attributes in paperspace. I have written this code but not working. pls help in this regards
(defun c:test ()
(defun *error* (msg)
(if fo
(progn
(close fo)
);progn
);if
);defun error
(setq fo (open "c:\\Lisp\\Drawing Nmae and Number.xls" "w"))
(setq dDbx (vla-getinterfaceobject (vlax-get-acad-object) (strcat "ObjectDBX.AxDbDocument." (substr (getvar "acadver") 1 2))))
(setq file-list (vl-directory-files (getvar "dwgprefix") "*.dwg"))
(setq m 0)
(repeat (length file-list)
(setq filename (strcat (getvar "dwgprefix") (nth m file-list)))
(vlax-invoke-method dDBX 'Open filename)
(setq n 0)
(repeat (vla-get-count (vla-get-paperspace (vla-get-database dDBX)))
(setq blk (vla-item (vla-get-paperspace (vla-get-database dDBX)) n))
(if (eq (vla-get-objectname blk) "AcDbBlockReference")
(progn
(if (vlax-property-available-p blk 'effectivename)
(setq nam (vlax-get-property blk 'effectivename))
(setq nam (vlax-get-property blk 'name))
);if
(if (eq nam "TB_ATT")
(progn
(setq fn (vla-get-textstring (nth 57 (vlax-safearray->list (vlax-variant-value (vla-getattributes blk))))))
(setq T1 (vla-get-textstring (nth 53 (vlax-safearray->list (vlax-variant-value (vla-getattributes blk))))))
(setq T2 (vla-get-textstring (nth 54 (vlax-safearray->list (vlax-variant-value (vla-getattributes blk))))))
(setq T3 (vla-get-textstring (nth 55 (vlax-safearray->list (vlax-variant-value (vla-getattributes blk))))))
(setq title (strcat T1" "T2" "T3))
(setq fnt (strcat fn" "title))
(write-line fnt fo)
(setq n (1+ n))
);progn
(progn
(setq n (1+ n))
);progn
);if
);progn
(progn
(setq n (1+ n))
);prgn
);if
);repeat
(setq m (1+ m))
);repeat
(close fo)
);defun
Thanks in Advance
STM