Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: How to set border offset factor for background masking Mtext?

  1. #11
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: How to set border offset factor for background masking Mtext?

    You might be able to script the 2 commands one after another into a toolbar macro.

  2. #12
    Member
    Join Date
    2009-07
    Posts
    5
    Login to Give a bone
    0

    Default Re: How to set border offset factor for background masking Mtext?

    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.

  3. #13
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: How to set border offset factor for background masking Mtext?

    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)
    )

  4. #14
    Member
    Join Date
    2009-07
    Posts
    5
    Login to Give a bone
    0

    Default Re: How to set border offset factor for background masking Mtext?

    In response to alanjt,

    Thanks, alanjt! That work's nicely. You are a gentleman and a scholar.

  5. #15
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: How to set border offset factor for background masking Mtext?

    Quote Originally Posted by tommcgtx View Post
    In response to alanjt,

    Thanks, alanjt! That work's nicely. You are a gentleman and a scholar.
    It was a minor addition; you're welcome.

  6. #16
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: How to set border offset factor for background masking Mtext?

    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)
    )

  7. #17
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: How to set border offset factor for background masking Mtext?

    Quote Originally Posted by Tom Beauford View Post
    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.
    Nice work. Odd that it's defaulting to red, I have a background mask one I wrote a year or so ago and I only set the width - never had to worry with color.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. MTEXT Background Masking Improvements
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 5
    Last Post: 2012-02-03, 08:29 PM
  2. Control of background mask border offset
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2006-01-15, 01:49 AM
  3. Border(s) for MText Background Mask
    By Tom Beauford in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2005-02-21, 01:41 PM
  4. Background's border offset factor with dimensions
    By anton_4u76002 in forum AutoCAD General
    Replies: 2
    Last Post: 2004-10-06, 06:16 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
  •