"michael puckett" wrote in message
news:4051101c_1@newsprd01...
> If you cache the active document you could obviously
> realize performance gains for subsequent calls. Caching
> the layers collection would be dangerous unless you
> were absolutely certain no changes would occur to said
> collection between calls.
>
Michael, the nice thing about ActiveX is the "active" part. Observe.....
_$ (setq *acad* (vlax-get-acad-object)
*doc* (vla-get-activedocument *acad*))
#
_$ (setq lays (vla-get-layers *doc*))
#NOTE THIS OBJECT
_$ (vl-catch-all-apply
'(lambda (a)(vla-item Lays a)) (list "testy1")))
#<%catch-all-apply-error%>
_$ (vla-add lays "testy1")
#
_$ (setq lays (vla-get-layers *doc*))
# NOTE THE SAME OBJECT
_$ (vl-catch-all-apply
'(lambda (a)(vla-item Lays a)) (list "testy1"))
#
_$
SO you can set a reference to your layers, blocks, styles, etc. at
startup and they references to them will still be good after adding,
deleting, modifying them.
HTH,
Jeff