I have used this routine a lot. I sometimes get drawings that have attributes that have had their color changed to something other than “BYLAYER.” This routine will change all attributes colors to be BYLAYER.
Here’s How:
- After loading, simply type in CHGATTCOL <enter> to start and it finishes from there.
Note: if you need to change both the geometry and attribute color to BYLAYER, use the SETBYLAYER command that is already in AutoCAD.
;change all attribute colors to bylayer (defun C:ChgAttCol (/ name ss sslen cnt blck ent entinfo) ;(setq name (strcase (getvar "loginname"))) (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 256) (assoc 62 entinfo) entinfo)) ) (entupd ent) (setq ent (entnext ent)) (setq entinfo (entget ent)) ) (setq cnt (1+ cnt)) ) (princ) )
how do you change it to a color like “red”
Thank You, nifty little code, helps cleaning up.
This is an awesome routine. Thanks.
Mario Gallardo
Why can I not use this lisp?
I have error: bad argument type: lentityp nil.
Anyone can help me please?
Thanks!
same here! Help!