You might be able to script the 2 commands one after another into a toolbar macro.
|
You might be able to script the 2 commands one after another into a toolbar macro.
In response to Tom Beauford,
Yeah, that's what I've been doing, I just thought it might be nice to have it all in one command.
quickie edit...
Code:; Turns Background mask on/off ; Set 'Border Offset Factor' to 1.15 (defun c:BGtoggle (/ ss1 num cnt data ent obj ent) (setq ss1 (ssget '((0 . "mtext,text"))) num (sslength ss1) cnt 0 ) (repeat num ;; alanjt edit BEGIN (if (eq (cdr (assoc 0 (entget (setq ent (ssname ss1 cnt))))) "TEXT") (progn (command "_.txt2mtxt" ent "") (entmod (subst '(41 . 0.) (assoc 41 (setq data (entget (setq ent (entlast))))) data)) ) ) ;; alanjt edit END (setq obj (vlax-ename->vla-object ent)) (if (= (vlax-get-property obj 'BackgroundFill) :vlax-true) (vlax-put-property obj 'BackgroundFill :vlax-false) (progn (vlax-put-property obj 'BackgroundFill :vlax-true) (setq ent (vlax-vla-object->ename obj) elist (entget ent) elist (subst (cons 45 1.15) (assoc 45 elist) elist) ) (entmod elist) ) ; progn ) (setq cnt (1+ cnt)) ) ; repeat (vl-cmdf "_draworder" ss1 "" "f") (princ) )
In response to alanjt,
Thanks, alanjt! That work's nicely. You are a gentleman and a scholar.
Thanks as always Alan. I modified it a little more. It shrinks the mtext width to the width of the text and sets the color to the drawing background color. Wish that was the default instead of Red.
Code:(defun c:BGtoggle (/ ss1 num cnt obj ent data elist mtwidth) (setq ss1 (ssget '((0 . "mtext,text"))) num (sslength ss1) cnt 0 ) (repeat num ;; alanjt edit BEGIN (if (eq (cdr (assoc 0 (entget (setq ent (ssname ss1 cnt))))) "TEXT") (progn (command "_.txt2mtxt" ent "") (entmod (subst '(41 . 0.) (assoc 41 (setq data (entget (setq ent (entlast))))) data)) ) ) ;; alanjt edit END (setq obj (vlax-ename->vla-object ent)) (if (= (vlax-get-property obj 'BackgroundFill) :vlax-true) (vlax-put-property obj 'BackgroundFill :vlax-false) (progn (vlax-put-property obj 'BackgroundFill :vlax-true) (setq ent (vlax-vla-object->ename obj) elist (entget ent) elist (subst (cons 90 3)(assoc 90 elist) elist) ;Use drawing background color elist (subst (cons 45 1.15) (assoc 45 elist) elist) ;Set 'Border Offset Factor' to 1.15 mtwidth (* (cdr (assoc 42 elist))1.015) elist (subst (cons 41 mtwidth)(assoc 41 elist) elist) ;Trim excess width ) (entmod elist) ) ; progn ) (setq cnt (1+ cnt)) ) ; repeat (vl-cmdf "_draworder" ss1 "" "f") (princ) )