... but I really need to get to the object thru an Xref.
Handles in XREF's are arbitrary ...
A most salient point.
This can be used to find a handle in a block ( xref ) definition, feel free to convert to equivalent vb code:
(defun FindHandleInBlockDef ( name handle / data ename result )
(setq ename (cdr (assoc -2 (tblsearch "block" name))))
(vl-catch-all-apply
'(lambda ( )
(while ename
(if (eq handle (cdr (assoc 5 (entget ename))))
(setq
result ename
data (exit)
)
)
(setq ename (entnext ename))
)
)
)
result
)
But Mr. Spageddie -- What is your ultimate goal? Back in your original post you said --
I'm want to get the DXF codes from an object in a drawing. I know this can done using LISP (entget (car (entsel))) , but can this done in VBA?
Not quite right if the object is buried in an xref, you need to call nentsel:
(entget (car (nentsel)))
But still, what's the ultimate goal? The Autoplant scheme involves the use of components (they don't host a lot of data themselves) which are linked via master objects (AT_Master) which can be found in a component's xdata (look for "AT_GRP") which subsequently hosts the link to the main database entry (via xdata entry "GN") ... but where are ya going with all this?
If I may be so bold to ask.