Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extracting X-Ref information (Autocad)

Status
Not open for further replies.

NWood

Computer
Feb 2, 2006
1
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
 
Replies continue below

Recommended for you

Hi NWood,

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: FAQ687-5800 [link].

HTH
Todd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor