@neabailey ,
here is my fix \ new prompt
Command: XXXPRO
Choose [Show/Clear] <Clear>: s
Select objects: all
5 found
choose 'show' to pop 'xxx'
choose 'clear' to remove 'xxx'
at select object you can select multiple blocks.
enjoy
Moshe
;;; XXX PROPOGATE
(vl-load-com) ; load activex support
(defun c:xxxpro (/ is_white_space _option ; local functions
default adoc ss ename AcDbBlkRef AcDbAttrib text)
; anonymous function
(setq is_white_space (lambda (s) (vl-every (function (lambda (n) (member n '(9 32)))) (vl-string->list s))))
(defun _option (def / ask)
(initget "Show Clear")
(if (not (setq ask (getkword (strcat "\nChoose [Show/Clear] <" def ">: "))))
(setq ask def)
(setq def ask)
)
); _option
; here start c:xxxpro
(setq adoc (vla-get-activedocument (vlax-get-acad-object)))
(vla-startUndoMark adoc)
(if (or (eq (getvar "users1") "")
(null (member (getvar "users1") '("Show" "Clear")))
)
(setvar "users1" (setq default "Show"))
(setq default (getvar "users1"))
)
(if (and
(setvar "users1" (setq opn (_option default)))
(setq ss (ssget "_:L" '((0 . "insert") (66 . 1))))
)
(foreach ename (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
(setq AcDbBlkRef (vlax-ename->vla-object ename))
(foreach AcDbAttrib (vlax-invoke AcDbBlkRef 'GetAttributes)
(setq text (vla-get-textString AcDbAttrib))
(cond
((eq opn "Show")
(if (or (not text) (eq text "") (is_white_space text))
(vla-put-textString AcDbAttrib "xxx")
); if
); case
( t
(if (eq (strcase text) "XXX")
(vla-put-textString AcDbAttrib "")
)
); case
); cond
(vlax-release-object AcDbAttrib)
); foreach
(vlax-release-object AcDbBlkRef)
); foreach
); if
(vla-endUndoMark adoc)
(vlax-release-object adoc)
(princ)
); c:xxxpro