The following codes has been pasted here for N times....
;;; EXAMPLE: (vlex-ChangeAttributes (list blk (cons "tag" "new-value"))) ;;; ;;;***************************************************************************;;; ;;; Arguments: ;;; A list containing one atom and one or more dotted pairs. ;;; The atom is the entity name of the block to change. ;;; The dotted pairs consist of the attribute tag and the new value for that attribute. ;;; ;;; Notes: ;;; Modifies the specified attribute in the specified block reference ;;;***************************************************************************;;;
(vl-load-com)
(defun vlex-ChangeAttributes (lst / blk itm atts) (setq blk (vlax-Ename->vla-Object (car lst)) lst (cdr lst) ) (if (= (vla-Get-HasAttributes blk) :vlax-true) (progn (setq atts (vlax-SafeArray->list (vlax-Variant-Value (vla-GetAttributes blk)) ) ); setq (foreach item lst (mapcar '(lambda (x) (if (= (strcase (car item)) (strcase (vla-Get-TagString x))) (vla-Put-TextString x (cdr item)) ); endif ) atts ); mapcar ); foreach (vla-Update blk) ) ); endif )