(vl-load-com)
(AT:Undo "V" "B")
;; background offset setting
(setq #BackgroundOffset 1)
(cond
;; select mtext and multileaders
((setq #SSList
(AT:SS->List (ssget ":L" '((0 . "MTEXT,MULTILEADER"))) T)
) ;_ setq
;; something selected, time to process data
(mapcar
'(lambda (x)
(cond
;; mtext
((eq (vla-get-ObjectName x) "AcDbMText")
(if (eq (vla-get-backgroundfill x) :vlax-false)
(progn
;; set backgroundfill to true
(vla-put-backgroundfill x :vlax-true)
;; convert object to ename and entmod offset
(setq #Ent (entget (vlax-vla-object->ename x)))
(entmod (subst (cons 45 #BackgroundOffset)
(assoc 45 #Ent)
#Ent
) ;_ subst
) ;_ entmod
) ;_ progn
;; set backgroundfill to false
;(vla-put-backgroundfill x :vlax-false)
) ;_ if
)
;; multileader
((eq (vla-get-Objectname x) "AcDbMLeader")
(vlax-property-available-p x "TextBackgroundFill" T);can the property be modified?
(if (vl-catch-all-apply (eq (vla-get-TextBackgroundFill x) :vlax-false));tried to use error catching unsuccesfully here.
(progn
;; set background fill to true
(vla-put-TextBackgroundFill x :vlax-true)
;; convert object to ename and entmod offset
(setq #Ent (entget (vlax-vla-object->ename x)))
(entmod (subst (cons 141 #BackgroundOffset)
(assoc 141 #Ent)
#Ent
) ;_ subst
) ;_ entmod
) ;_ progn
;----else----- ;; toggle, set backgroundfill to false
;(vla-put-TextBackgroundFill x :vlax-false)
) ;end of if
);end of condition
) ;_ cond
) ;_ lambda
#SSList
) ;_ mapcar
)
) ;_ cond
(AT:Undo "V" "E")
(princ)
You can check the contenttype property of the Multileader, e.g.:Speaking of mleader content, did you ever come across a way to set rotation for multileaders with blocks instead of text?Code - Auto/Visual Lisp: [Select]
(= acmtextcontent (vla-get-contenttype <mleader-object>))
You can check the contenttype property of the Multileader, e.g.:Code - Auto/Visual Lisp: [Select]
(= acmtextcontent (vla-get-contenttype <mleader-object>))