Change this from Global to selection operation

Change this from Global to selection operation

timothy_crouse
Collaborator Collaborator
284 Views
1 Reply
Message 1 of 2

Change this from Global to selection operation

timothy_crouse
Collaborator
Collaborator

Could someone change this lisp that currently changes "each blocks attribute from byblock to bylayer" to change only a selected set of blocks attribute to bylayer?

 

Thanks for your time and help

-Tim C.

0 Likes
Accepted solutions (1)
285 Views
1 Reply
Reply (1)
Message 2 of 2

timothy_crouse
Collaborator
Collaborator
Accepted solution

Found a Solution here . . . .

 

Solved: LISP to change Attribute text color - Autodesk Community - AutoCAD

 

(vl-load-com)
;; select multi blocks,
;; to change all selected attrubutes color...
(defun c:demo (/ blk col i ss)
  (if (and (princ "\nSelect blocks to change attributes color: ")
           (setq ss (ssget '((0 . "INSERT") (66 . 1))))
           (setq col (acad_colordlg 7))
      )
    (repeat (setq i (sslength ss))
      (setq blk (vlax-ename->vla-object (ssname ss (setq i (1- i)))))
      (foreach att (vlax-safearray->list
                     (vlax-variant-value (vla-getattributes blk))
                   )
        (if (vlax-write-enabled-p att)
          (vla-put-color att col)
        )
      )
    )
  )
  (princ)
)
0 Likes