Hi,
easy and dirty but should works for you.
Run it with TRY in cmd - you can change it if you want to.
Lisp was written by LeeMac, I've just modified a little his test part.
;;---------=={ Set MLeader Block Attribute Value }==----------;;
;; ;;
;; Sets the value of the specified tag for the specified ;;
;; MLeader ;;
;;------------------------------------------------------------;;
;; Author: Lee McDonnell, 2010 ;;
;; ;;
;; Copyright © 2010 by Lee McDonnell, All Rights Reserved. ;;
;; Contact: Lee Mac @ TheSwamp.org, CADTutor.net ;;
;;------------------------------------------------------------;;
;; Arguments: ;;
;; mleader - ename/VLA-Object MLeader with attributed block ;;
;; tag - Tagstring of the attribute to change ;;
;; value - Value to which attribute will be set ;;
;;------------------------------------------------------------;;
;; Returns: T if successful, else nil ;;
;;------------------------------------------------------------;;
(defun LM:SetMLeaderBlockAttributeValue ( mleader tag value / def id )
(vl-load-com)
;; © Lee Mac 2010
(if
(and
(eq "AcDbMLeader"
(vla-get-Objectname
(setq mleader
(cond
( (eq 'VLA-OBJECT (type mleader)) mleader)
( (vlax-ename->vla-object mleader) )
)
)
)
)
(= 1 (vla-get-ContentType mleader))
(setq def
(LM:Itemp
(vla-get-Blocks
(vla-get-ActiveDocument
(vlax-get-acad-object)
)
)
(vla-get-ContentBlockName mleader)
)
)
)
(if
(progn
(vlax-for obj def
(if (and (eq "AcDbAttributeDefinition" (vla-get-Objectname obj))
(eq (strcase tag) (strcase (vla-get-TagString obj))))
(setq id (vla-get-ObjectID obj))
)
)
id
)
(not (vla-SetBlockAttributeValue mleader id value))
)
)
)
;;-----------------------=={ 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 c:Try (/ i e); change command here
(setq i 0) ; enter start number here instead of 0
(while (setq e (car (entsel "\nSelect MLeader: ")))
(LM:SetMLeaderBlockAttributeValue e "TAG" (rtos i 2 0));put TAG name which you want to modify here instead of "TAG"
(setq i (+ 1 i)) ;put increment you want here instead of 1
)
)
Chris