Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski 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
Joined
Feb 2, 2006
Messages
1
Location
NZ
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
 
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

Back
Top