PDA

View Full Version : List of Blocks in Xref



cadconcepts
2004-06-16, 07:29 PM
Hi Everyone-

I need help writing a routine that will build a list of all the blocks in the current drawing including those residing in an xreference. I tried using the tblsearch function but it only returns those blocks in the current drawing. Any help is greatly appreciated. Thanks.

Manuel

MarkTheSwampThomas
2004-06-16, 07:54 PM
probably more than you need but ........


(defun get-active-doc ()
(vla-get-activedocument (vlax-get-acad-object))
)

(defun get-blk-names2 (/ blk layout_blks
xref_blks blks blk_name_list
)

(vlax-for blk (vlax-get-property (get-active-doc) 'Blocks)
(cond ((= (vlax-get-property blk 'IsLayout) :vlax-true)
(setq layout_blks
(cons (vlax-get-property blk 'Name) layout_blks)
)
)
((= (vlax-get-property blk 'IsXRef) :vlax-true)
(setq xref_blks
(cons (vlax-get-property blk 'Name) xref_blks)
)
)
(T (setq blks (cons (vlax-get-property blk 'Name) blks)))
)
)
(setq blk_name_list (list layout_blks xref_blks blks))
)

(setq blst (get-blk-names2))

cadconcepts
2004-06-17, 01:20 AM
Mark-

Thanks for the code. I'll try it out.

Manuel