- ;;By 龙龙仔(LUCAS)
- (defun C:BLK_COL (/ ENT N NAME SS) (defun GETATT (ENT)
- (while (/= (DXF 0 (entget (setq ENT (entnext ENT)))) "SEQEND")
- (MODD ENT 62 COL)
- )
- (princ)
- ) ;|
- (defun GETATT (E / N ATT E1 EN EN1 RSLT)
- (setq EN (entget E)
- E1 E
- )
- (if (and (= (DXF 0 EN) "INSERT")
- (= (DXF 66 EN) 1)
- )
- (progn
- (setq E1 (entnext E1))
- (while (and E1
- (setq EN1 (entget E1))
- (= (DXF 0 EN1) "ATTRIB")
- )
- (MODD E1 62 COL)
- (setq E1 (entnext E1))
- )
- )
- )
- )|; (defun DXF (A1 A2)
- (cdr (assoc A1 A2))
- ) (defun MODD (E EE COL)
- (setq E (entget E))
- (if (= (assoc EE E) NIL)
- (setq E (append E (list (cons EE COL))))
- (setq E (subst (cons EE COL) (assoc EE E) E))
- )
- (entmod E)
- ) (if (and (setq ENT (car (entsel "\nSelect Block: ")))
- (= "INSERT" (DXF 0 (setq ENT (entget ENT))))
- )
- (progn
- (setq COL (acad_colordlg 7))
- (setq NAME (assoc 2 ENT))
- (if (= (DXF 66 ENT) 1)
- (progn
- (setq SS (ssget "x"
- (list (cons 0 "INSERT")
- NAME
- )
- )
- N 0
- )
- (repeat (sslength SS)
- (GETATT (ssname SS N))
- (setq N (1+ N))
- )
- )
- )
- (setq ENT
- (cdr
- (assoc
- -2
- (tblsearch "BLOCK" (cdr NAME))
- )
- )
- )
- (while ENT
- (MODD ENT 62 COL)
- (setq ENT (entnext ENT))
- )
- (command "_.REGEN")
- )
- )
- (princ)
- )
|