Results 1 to 3 of 3

Thread: multileader background fill

  1. #1
    Member
    Join Date
    2009-01
    Location
    New Jersey
    Posts
    32
    Login to Give a bone
    0

    Default multileader background fill

    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
    Last edited by Opie; 2009-03-19 at 08:09 PM. Reason: [code] tags added

  2. #2
    Active Member mweaver's Avatar
    Join Date
    2015-12
    Location
    Utah
    Posts
    69
    Login to Give a bone
    0

    Default Re: multileader background fill

    Quote Originally Posted by parkerfeldman View Post
    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?
    You will need something like this on your selection sets:
    (if (and
    ssml ;the selection set exists
    (< 0 (sslength ssml)) ;it contains something
    )


    Now, about your automation error, you can normally use vl-catch-all-apply and vl-catch-all-error-p to capture automation errors. However, I'm using the beta for 2010 and vla-get-textbackgroundfill fails on a valid mleader with text when wrapped in a vl-catch-all-apply. It shouldn't. I get no error, no return value, nothing. This should have returned either an error, which I could handle with vl-catch-all-error-p, or the value for the property.

    I will check this when I get to a machine running 2009 and see what I get for results there.

    Later,
    Mike Weaver

  3. #3
    Active Member mweaver's Avatar
    Join Date
    2015-12
    Location
    Utah
    Posts
    69
    Login to Give a bone
    0

    Default Re: multileader background fill

    vl-catch-all-apply works as expected in 2009, so you can do something like:
    Code:
    (if (vl-catch-all-error-p (setq tf (vl-catch-all-apply 'vla-get-textbackgroundfill (list obj))))
      ;do this because there was an error getting the background fill property
      ;do this because there was no error
    )
    Hope that helps,
    Mike

Similar Threads

  1. Table Background Fill Transparency
    By Wish List System in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2013-08-14, 12:10 PM
  2. Text Fill Option in Multileader Style Manager
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2007-11-27, 05:43 PM
  3. Fill patterns - Background colour
    By markl.70662 in forum Revit Architecture - Wish List
    Replies: 8
    Last Post: 2006-11-17, 03:35 PM
  4. Dimension Background Mask (Fill)
    By avennem in forum AutoCAD General
    Replies: 1
    Last Post: 2006-10-26, 08:01 PM
  5. Cell's background fill
    By Beaglemommy in forum AutoCAD Tables
    Replies: 3
    Last Post: 2005-12-16, 07:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •