×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Extracting X-Ref information (Autocad)

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

RE: Extracting X-Ref information (Autocad)

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: [link http://www.tek-tips.com/faqs.cfm?fid=5800]FAQ687-5800 [link].

HTH
Todd

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources