Extracting X-Ref information (Autocad)
Extracting X-Ref information (Autocad)
(OP)
Hi, i have these few lines of lisp code which can automatically extract attributes from blocks which are in an X-Ref. i was wondering if anyone knows of a VBA equivalent to this code
Lisp:
(defun c:xrefatts ()
(setq ename (nentsel "\nSelect block in xref: "))
(if (= (length (nth 3 ename)) 2)
(progn
(setq attlist
(setq obj (vlax-ename->vla-object (car (nth 3 ename))))
)
(mapcar
'(lambda (Att)
(cons (vla-get-TagString Att) (vla-get-TextString Att))
)
(vlax-invoke Obj "GetAttributes")
)
)
;else
(alert "Object selected is not a block")
)
)
I want to be able to return the attributes as variables and maybe display them in a MsgBox too. any help would be greatly appreciated
thanks
Lisp:
(defun c:xrefatts ()
(setq ename (nentsel "\nSelect block in xref: "))
(if (= (length (nth 3 ename)) 2)
(progn
(setq attlist
(setq obj (vlax-ename->vla-object (car (nth 3 ename))))
)
(mapcar
'(lambda (Att)
(cons (vla-get-TagString Att) (vla-get-TextString Att))
)
(vlax-invoke Obj "GetAttributes")
)
)
;else
(alert "Object selected is not a block")
)
)
I want to be able to return the attributes as variables and maybe display them in a MsgBox too. any help would be greatly appreciated
thanks





RE: Extracting X-Ref information (Autocad)
Check out this FAQ over at tek-tips - you don't care about the database part but it will show you how to extract attributes from a block (which is the same for an xref) using VBA: [link http://www.tek-tips.com/faqs.cfm?fid=5800]FAQ687-5800 [link].
HTH
Todd