Fonte
(defun toggleBackgroundMaskOfAMText (en / ed)
(setq ed (entget en)) ; Sets ed to the entity data
(setq atom90 (assoc 90 ed))
(if (= atom90 nil)
;; no 90 groud code at all
(progn
(setq lst90 (cons 90 1))
(setq atom63 (cons 63 1))
(setq ed (append ed (list atom63 lst90)))
;; Add the 63 group code to set the background color as 1 (RED)
)
(progn
(setq maskProp (cdr atom90))
(if (= (boole 1 maskProp 1) 1)
(setq new90 (cons 90 2))
(setq new90 (cons 90 1))
)
(setq ed
(subst new90
(assoc 90 ed) ; Toggle the value of 90 group in ed.
ed
)
)
)
)
(entmod ed)
(princ)
)