I had the need to get all of the attribute tags and values from a block attached to an mLeader. It took me a bit to figure out how to accomplish this and I don't think that I could have without Lee's itemp function, as you can see in the code. There may be even better ways to accomplish this, but this is what I know and it works, given how much it took me to figure this out, I thought it might benefit some others as well and that I would post it here to see if anyone had ideas from improving it.
;;-----------------------=={ Itemp }==------------------------;;
;; ;;
;; Retrieves the item with index 'item' if present in the ;;
;; specified collection, else nil ;;
;;------------------------------------------------------------;;
;; Author: Lee McDonnell, 2010 ;;
;; ;;
;; Copyright � 2010 by Lee McDonnell, All Rights Reserved. ;;
;; Contact: Lee Mac @ TheSwamp.org, CADTutor.net ;;
;;------------------------------------------------------------;;
;; Arguments: ;;
;; coll - the VLA Collection Object ;;
;; item - the index of the item to be retrieved ;;
;;------------------------------------------------------------;;
;; Returns: the VLA Object at the specified index, else nil ;;
;;------------------------------------------------------------;;
(defun LM:Itemp ( coll item )
;; � Lee Mac 2010
(if
(not
(vl-catch-all-error-p
(setq item
(vl-catch-all-apply
(function vla-item) (list coll item)
)
)
)
)
item
)
)
(defun CW:GetMleaderAttData (Obj / Att AttList Ent Obj Temp)
(setq AttList (LM:Itemp (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object))) (vla-get-ContentBlockName Obj)))
(vlax-for Att AttList
(if (= (vla-get-objectname Att) "AcDbAttributeDefinition")
(progn
(setq Temp (list Temp (cons (vla-get-tagstring Att) (vla-GetBlockAttributeValue Obj (vla-get-ObjectID Att)))))
)
)
)
Temp
)