Results 1 to 2 of 2

Thread: Mtext bounding box fix

  1. #1
    I could stop if I wanted to
    Join Date
    2001-01
    Posts
    265
    Login to Give a bone
    0

    Red face Mtext bounding box fix

    Hi Everyone:

    I am trying to write a routine that will adjust the bounding (grips) around mtext so that it is tight up against the text. The problem has been that over time people have stretch the grips all over the place and it is sometimes difficult to find the grips without having to zoom way out. I wrote this routine that will 'eventually' adjust both the width and height. However, I cannot get the routine to adjust both directions at one time. If I move the code around, I can only get it to adjust in one direction or another. Any help is greatly appreciated.

    Manuel A. Ayala

    (Defun c:mtextfix (/ sset cntr ent entlst nmtextlen)
    (princ "\nMTEXT Wrap Fix: ")
    (prompt "\nSelect MTEXT to fix or <Enter for All>: ")
    (setq sset (ssget "+.:S:E" (list (cons 0 "MTEXT"))))
    (if (null sset)
    (progn
    (princ "\nAll text is now selected, Filter text down by: ")
    (setq sset (ssget "x" (list (cons 0 "MTEXT"))))
    )
    )
    (if sset
    (progn
    (setq cntr 0)
    (repeat (sslength sset)
    (setq ent (ssname sset cntr))
    (setq entlst (entget ent))
    (setq nmtextlen (dxf 42 entlst))
    (entmod (subst (cons 46 0)(assoc 46 entlst) entlst))
    (entmod (subst (cons 41 nmtextlen)(assoc 41 entlst) entlst))
    (entupd ent)
    (setq cntr (1+ cntr))
    )
    )
    )
    (princ)
    )

  2. #2
    Member
    Join Date
    2002-08
    Posts
    43
    Login to Give a bone
    0

    Smile Re: Mtext bounding box fix

    You just need to retreive the entget list between the two entmod operation

    (entmod (subst (cons 46 0)(assoc 46 entlst) entlst))
    (setq entlst (entget ent))
    (entmod (subst (cons 41 nmtextlen)(assoc 41 entlst) entlst))

    Quote Originally Posted by cadconcepts View Post
    Hi Everyone:

    I am trying to write a routine that will adjust the bounding (grips) around mtext so that it is tight up against the text. The problem has been that over time people have stretch the grips all over the place and it is sometimes difficult to find the grips without having to zoom way out. I wrote this routine that will 'eventually' adjust both the width and height. However, I cannot get the routine to adjust both directions at one time. If I move the code around, I can only get it to adjust in one direction or another. Any help is greatly appreciated.

    Manuel A. Ayala

    (Defun c:mtextfix (/ sset cntr ent entlst nmtextlen)
    (princ "\nMTEXT Wrap Fix: ")
    (prompt "\nSelect MTEXT to fix or <Enter for All>: ")
    (setq sset (ssget "+.:S:E" (list (cons 0 "MTEXT"))))
    (if (null sset)
    (progn
    (princ "\nAll text is now selected, Filter text down by: ")
    (setq sset (ssget "x" (list (cons 0 "MTEXT"))))
    )
    )
    (if sset
    (progn
    (setq cntr 0)
    (repeat (sslength sset)
    (setq ent (ssname sset cntr))
    (setq entlst (entget ent))
    (setq nmtextlen (dxf 42 entlst))
    (entmod (subst (cons 46 0)(assoc 46 entlst) entlst))
    (entmod (subst (cons 41 nmtextlen)(assoc 41 entlst) entlst))
    (entupd ent)
    (setq cntr (1+ cntr))
    )
    )
    )
    (princ)
    )

Similar Threads

  1. Room Bounding Walls NOT Bounding Rooms??
    By jkady in forum Revit Architecture - General
    Replies: 3
    Last Post: 2009-09-30, 04:57 PM
  2. MText bounding box
    By amaser in forum VBA/COM Interop
    Replies: 0
    Last Post: 2008-09-18, 04:22 PM
  3. Mtext Bounding box
    By Shoey in forum AutoCAD General
    Replies: 2
    Last Post: 2007-07-09, 05:09 PM
  4. Replies: 8
    Last Post: 2007-03-12, 02:18 AM
  5. Replies: 3
    Last Post: 2006-10-31, 05:46 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
  •