Jumped on this a little today at lunch, didn't add multi select but I did add color background colors.
;;; ------------------------------------------------------------------------
;;; TEXT_BMASK.lsp v2.0
;;;
;;; Copyright © March 16, 2009
;;; Timothy G. Spangler
;;;
;;; Permission to use, copy, modify, and distribute this software
;;; for any purpose and without fee is hereby granted, provided
;;; that the above copyright notice appears in all copies and
;;; that both that copyright notice and the limited warranty and
;;; restricted rights notice below appear in all supporting
;;; documentation.
;;;
;;; THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
;;; WARRANTY. ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR
;;; PURPOSE AND OF MERCHANTIBILITY ARE HEREBY DISCLAIMED BY THE
;;; PROGRAMMER.
;;;
;;; -----------------------------------------------------------------------
(defun C:BM (/ *error* OldCmdEcho BMaskOffset TextObj BMaskOffset BMaskColor TextElist)
;;; Begin Error Handler -------------------------------------------------
(defun *error* (MSG)
(if (not (member MSG '("Function cancelled" "quit / exit abort")))
(princ (strcat "\n*** Program Error: " (strcase MSG) " ***"))
(princ "\n... Program Cancelled ...")
)
(while (< 0 (getvar "cmdactive"))
(command)
)
(setvar "CMDECHO" OldCmdEcho)
)
;; Set variables
(setq OldCmdEcho (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
(setq BMaskOffset 2.0);<-- Set default offset
;; Get selection
(setq TextObj (car (entsel "\n Select MTEXT to mask or [ENTER] for Settings: ")))
(if (= (type TextObj) nil)
;; Set the settings
(progn
(setq BMaskOffset (getreal (strcat "\n Enter offset distance <" (rtos BMaskOffset 2 2) ">")))
(setq BMaskColor (acad_colordlg 256 T))
(setq TextObj (car (entsel "\n Select MTEXT to mask or [ENTER] for Settings: ")))
)
)
;; Get text entity list
(setq TextElist (entget TextObj))
;; Check for MTEXT
(if (not (= (cdr (assoc 0 TextElist)) "MTEXT"))
;; If not mtext, alert the user and restart
(progn
(alert "Selected entity is not MTEXT")
;; Reset variables
(setvar "CMDECHO" OldCmdEcho)
;; Restart the program
(C:BM)
)
;; If is mtext add/remove the mask
(progn
(if (or (= (cdr (assoc 90 TextElist)) 1)(= (cdr (assoc 90 TextElist)) 3))
(progn
(setq TextElist (subst (cons 90 2) (assoc 90 TextElist) TextElist))
(princ "\n Background fill removed")
)
(progn
(setq TextElist (subst (cons 90 3)(assoc 90 TextElist) TextElist))
(setq TextElist (append TextElist (list (cons 45 BMaskOffset))))
(princ "\n Background fill applied")
)
)
)
)
;; Check for a masking color
(if (and BMaskColor (< BMaskColor 256))
(progn
(setq TextElist (subst (cons 90 1) (assoc 90 TextElist) TextElist))
(setq TextElist (append TextElist (list (cons 63 BMaskColor))))
(setq TextElist (append TextElist (list (cons 441 0))))
)
)
;; Modify the enityt list
(entmod TextElist)
;; Set the draworder to bring text front
(command "draworder" TextObj "" "front")
;; Reset variables
(setvar "CMDECHO" OldCmdEcho)
(princ)
)
;;;
;;; Echos to the command line
(princ "\n BMask v2.0 ©Timothy Spangler, \n March, 2009....loaded.")
(terpri)
(princ "C:BM")
(print)
;;; End echo
I will try to get time tonite to add multiselect and gripselect
BTW great code 7, CAB....