马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
- ;;---------=={ 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: nothing ;;
- ;;------------------------------------------------------------;;
-
-
- (defun lm:_rjp_mod_setmleaderblockattributevalue (mleader value / def id exval)
- (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)
- )
- )
- )
- (vlax-for obj def
- (if (eq "AcDbAttributeDefinition" (vla-get-objectname obj))
- ;; RJP mod to get existing value and add a new value to it
- (if (and (setq id (vla-get-objectid obj))
- (setq exval (vla-getblockattributevalue mleader id))
- )
- (vla-setblockattributevalue mleader id (vl-princ-to-string (+ value (atof exval))))
- )
- )
- )
- )
- )
- ;;-----------------------=={ 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:test (/ e i n ss)
- (if (and (setq n (getdist "\nEnter increment amount: "))
- (setq ss (ssget ":L" '((0 . "multileader"))))
- )
- (repeat (setq i (sslength ss))
- (lm:_rjp_mod_setmleaderblockattributevalue (ssname ss (setq i (1- i))) n)
- )
- )
- )
|