Page 1 of 2 12 LastLast
Results 1 to 10 of 17

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

  1. #1
    I could stop if I wanted to
    Join Date
    2003-11
    Posts
    450
    Login to Give a bone
    0

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

    I would like to automatically set the border offset factor for masking my mtext, I didn't see it as a property. Here's the code I have so far.

    Code:
    (defun c:mt_mask (/ acaddocument mspace object)
          (initerr)
          (vl-load-com)
          (setq acaddocument (vla-get-activedocument (vlax-get-acad-object)))
          (setq mspace (vla-get-modelspace acaddocument))
          (setq object (car (entsel "\nSelect MTEXT Object: ")))
          (setq object (vlax-ename->vla-object object))
          ;(vlax-dump-object object)
          (vla-put-backgroundfill object 1)
          (reset)
          (princ)
          )
    (princ)

  2. #2
    I could stop if I wanted to
    Join Date
    2007-08
    Posts
    201
    Login to Give a bone
    0

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

    Hi,

    I can't found this property (neither the backgroun color) in ActiveX, but it can be done with DXF

    Code:
    (defun c:mt_mask (/ ent elst)
      (setq ent (car (entsel "\nSelect MTEXT Object: ")))
      (setq elst (entget ent))
      (if (= "MTEXT" (cdr (assoc 0 elst)))
        (entmod
          (append
    	(vl-remove-if
    	  (function
    	    (lambda (x)
    	      (or (member (car x) '(90 63 421 45))
    		  (< 419 (car x) 440)
    		  )
    	      )
    	  )
    	  elst
    	)
    	(list
    	  '(90 . 1)			; activate background color (2 for vport color)
    	  '(63 . 1)			; background index color
    	  '(45 . 1.5)			; background scale factor
    	)
          )
        )
      )
      (princ)
    )

  3. #3
    Certifiable AUGI Addict tedg's Avatar
    Join Date
    2005-06
    Location
    in the upper right corner
    Posts
    3,422
    Login to Give a bone
    0

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

    Quote Originally Posted by boesiii View Post
    I would like to automatically set the border offset factor for masking my mtext, I didn't see it as a property. Here's the code I have so far.

    Code:
    (defun c:mt_mask (/ acaddocument mspace object)
          (initerr)
          (vl-load-com)
          (setq acaddocument (vla-get-activedocument (vlax-get-acad-object)))
          (setq mspace (vla-get-modelspace acaddocument))
          (setq object (car (entsel "\nSelect MTEXT Object: ")))
          (setq object (vlax-ename->vla-object object))
          ;(vlax-dump-object object)
          (vla-put-backgroundfill object 1)
          (reset)
          (princ)
          )
    (princ)
    There's a routine in this thread called MTEXTMASK.lsp that's pretty handy and I think it does what you're looking for.

  4. #4
    I could stop if I wanted to
    Join Date
    2003-11
    Posts
    450
    Login to Give a bone
    0

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

    Thanks I will try it.

    Why wouldn't all the properties of an object be included in Active X?

  5. #5
    I could stop if I wanted to
    Join Date
    2006-06
    Location
    Olympia, Washington, U.S.A.
    Posts
    359
    Login to Give a bone
    0

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

    There is an Express Tool called "Enclose text with object" command TCIRCLE that gives you a choice to enclose with a circle, slot, or rectangle. then prompts you for offset distance. then variable or constant distances. It's not as fun as a Lisp routine, but why make a wrench if there is already one in the toolbox.

  6. #6
    100 Club
    Join Date
    2008-08
    Location
    Vancouver, BC
    Posts
    105
    Login to Give a bone
    0

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

    I agree, Mtextmask.lsp works well, I have been using it for quite a while.

    However, for the first time I had need to use the Trucolor background, which was an option in the lisp under "color". I does not seem to work for me, the mask does not take the RGB color I input (eg. 253,254,240). The mask always becomes yellow. Has anyone had the same problem?

    Otherwise the border offset and basic color background works fine.

    I tried it on AutoCAD 2005 and 2009.

    Brian C

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

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

    This works for me. I use a 'Border Offset Factor' of 1.15
    Code:
     
    ; Turns Background mask on/off
    ; Set 'Border Offset Factor' to 1.15
    (defun c:BGtoggle (/ ss1 num cnt obj ent)
      (setq ss1 (ssget '((0 . "mtext")))
        num (sslength ss1)
        cnt 0)
      (repeat num
          (setq obj (vlax-ename->vla-object (ssname ss1 cnt)))
          (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)
    )

  8. #8
    Member
    Join Date
    2009-07
    Posts
    45
    Login to Give a bone
    0

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

    Hi, Tom.
    I don´t know much about lisp, but I kind of figured out how to use part of your code to set a background color fill to all mtext selected... but I would like to bring all objects in layer Dims to front after I bring front selected background masked mtext...
    I found this thread in another forums but it is normal lisp... Would it be possible to add this feature to your code..

    I can see that you used the
    (vl-cmdf "_draworder" ss1 "" "f")

    So, How could I add something like this... after that order in your lisp?

    Code:
    ;; Moves all objects on the "dims" layer to the back
    (defun layf ()
    ;; creates a selection set of all objects on the "dims" layer.
      (setq sel1 (ssget "x" '((8 . "dims"))))
    ;; Uses the draworder command to move the objects to the back
      (command "draworder" sel1 "" "front")
    )
    --------------------
    Nevermind... I figured that out...
    and actually is the first time I found the way to add different types of selection sets and different commands to those selection sets...
    Last edited by gilsoto13; 2009-12-16 at 08:28 PM.

  9. #9
    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,

    I used BGtoggle, and it works great! I don't know much about Autolisp, but could this be modified to change regular text to mtext if it is not already, and then proceed with the rest of the command? That would be great.
    Last edited by tommcgtx; 2011-05-11 at 02:42 PM. Reason: Wanted to get e'mail notifacation

  10. #10
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,608
    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 Tom Beauford,

    I used BGtoggle, and it works great! I don't know much about Autolisp, but could this be modified to change regular text to mtext if it is not already, and then proceed with the rest of the command? That would be great.
    You're probably better off just using the Express Tool TXT2MTXT first. That way you can group TEXT lines together that belong in one MTEXT and keep others as seperate MTEXTs. Once it ran and returned MTEXT with background there would be no way to know if it started as TEXT or MTEXT.

Page 1 of 2 12 LastLast

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
  •