Hello,
I am trying to change the attribute color to a given number. I have several drawings with a lot of blocks with attributes using color ByLayer. I want to globally change the color of my attributes to a different color. I did modified a code I found in this newgroup 2 years ago, but this is not working.
Here is the code:
(defun C:ChgAttColorToOther (/ name ss sslen cnt blck ent entinfo) (setq name (strcase (getvar "loginname"))) (initget 7) (setq AttribColor (getint "\n\nEnter New Attribute Color <11>: ")) (terpri) (cond ((not AttribColor) (setq AttribColor 11))) (setq ss (ssget "x" '((0 . "INSERT")))) (setq cnt 0) (setq sslen (sslength ss)) (while (< cnt sslen) (setq blck (ssname ss cnt)) (setq ent (entnext blck)) (setq entinfo (entget ent)) (while (and ent (= (cdr (assoc 0 entinfo)) "ATTRIB")) (if (assoc 62 entinfo) (entmod (subst (cons 62 AttribColor) (assoc 62 entinfo) entinfo)) ) (entupd ent) (setq ent (entnext ent)) (setq entinfo (entget ent)) ) (setq cnt (1+ cnt)) ) (princ)
)
What's wrong?
TIA
I am trying to change the attribute color to a given number. I have several drawings with a lot of blocks with attributes using color ByLayer. I want to globally change the color of my attributes to a different color. I did modified a code I found in this newgroup 2 years ago, but this is not working.
Here is the code:
(defun C:ChgAttColorToOther (/ name ss sslen cnt blck ent entinfo) (setq name (strcase (getvar "loginname"))) (initget 7) (setq AttribColor (getint "\n\nEnter New Attribute Color <11>: ")) (terpri) (cond ((not AttribColor) (setq AttribColor 11))) (setq ss (ssget "x" '((0 . "INSERT")))) (setq cnt 0) (setq sslen (sslength ss)) (while (< cnt sslen) (setq blck (ssname ss cnt)) (setq ent (entnext blck)) (setq entinfo (entget ent)) (while (and ent (= (cdr (assoc 0 entinfo)) "ATTRIB")) (if (assoc 62 entinfo) (entmod (subst (cons 62 AttribColor) (assoc 62 entinfo) entinfo)) ) (entupd ent) (setq ent (entnext ent)) (setq entinfo (entget ent)) ) (setq cnt (1+ cnt)) ) (princ)
)
What's wrong?
TIA