Hello i wrote a routine that gets all multileaders and all mtext in the drawing and turns the background fill on or off. when the routine is run i get the error "; error: Automation Error. Description was not provided." i figured out that the issue is some multileaders do not have text so in the dump of the object it says "textbackgroundfill = exception occurred" how can i have it test if the multileader has text or have it test that the vla-get-textbackgroundfill must have a true or false value?
on another note like i said this routine does multileaders and mtext it has to ssget's
Code:
(setq ssml (ssget "X" (list (cons 0 "MULTILEADER"))))
(setq ssmt (ssget "X" (list (cons 0 "MTEXT"))))
it does not work when there is no mtext or no multileader in the drawing. how can i have it perform the ssget and set the value to nil if it is nil?
my code
Code:
(defun All (toggle /) ;tf ssml ssmt i obj)
(vl-cmdf "ZOOM" "E")
(setq ssml (ssget "X" (list (cons 0 "MULTILEADER"))))
(setq ssmt (ssget "X" (list (cons 0 "MTEXT"))))
(setq i (- 1))
(setq mlc 0)
(setq mtc 0)
(repeat (sslength ssml)
(setq
obj (vlax-ename->vla-object (ssname ssml (setq i (1+ i))))
)
(setq tf (vla-get-textbackgroundfill obj))
(if (/= tf toggle)
(progn
(vla-put-textbackgroundfill obj toggle)
(setq mlc (1+ mlc))
) ;_end progn
) ;_end if
) ;_end repeat
(setq i (- 1))
(repeat (sslength ssmt)
(setq
obj (vlax-ename->vla-object (ssname ssmt (setq i (1+ i))))
)
(setq tf (vla-get-backgroundfill obj))
(if (/= tf toggle)
(progn
(vla-put-backgroundfill obj toggle)
(setq mtc (1+ mtc))
) ;_end progn
) ;_end if
) ;_end repeat
(if (= toggle :vlax-true)
(setq onoff "ON")
(setq onoff "OFF")
)
(vl-cmdf "ZOOM" "P")
(princ "\n")
(princ mlc)
(princ " MULTILEADER BACKGROUND FILL ")
(princ onoff)
(terpri)
(princ mtc)
(princ " MULTITEXT BACKGROUND FILL ")
(princ onoff)
) ;_end All