AfraLisp Blog

The AutoLisp/Visual Lisp/VBA Resource Website

AfraLisp Blog

Home Newsletter Utter Rubbish Coding Tips AutoCAD Tips Contact Downloads WAUN

What i need is a list of all xref in a drawing included in your date & time stamp when inserted in a drawing it is automatically write all the xref's that a drawing are using.

earv
----------------------------

I can certainly provide you with a list of Xrefs in your drawing :

;CODING STARTS HERE
(defun c:getxref ()
(vl-load-com)

;retrieve a reference to the Active Document
(setq activedocument (vla-get-activedocument (vlax-get-Acad-Object)))

;retrieve a reference to the blocks
(setq theblocks (vla-get-blocks activedocument))

;create an empty list
(setq theList '())

;process each block
(vlax-for item theblocks

;check if it's an Xref
(setq yesxref (vlax-get-property item 'isXref))

;if it is
(if (= yesxref :vlax-true)

;do the following
(progn

;get the Xref name
(setq ablock (vlax-get-property item 'Name))

;store it in the list
(setq theList (append (list ablock) theList))

);progn

);if

);vlax-for

;print the list
(princ theList)

(princ)

);defun
(princ)
;CODING ENDS HERE

The AutoLisp/Visual Lisp/VBA Resource Website

Copyright 1999-Perpetuity by AfraLisp

All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage

The AutoLisp/Visual Lisp/VBA Resource Website