Results 1 to 6 of 6

Thread: MText width set to zero

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Wish List Administration
    Join Date
    2011-08
    Posts
    4,581

    Default MText width set to zero

    Summary: SETVAR for MText width and be able to remove the width from an existing MText item

    Description: Add a SETVAR, for MText, that can be (pre)set to any width, including zero. This should also allow the width of an existing MText item to be changed, in the properties dialog box, to any width, including zero.

    Product and Feature: AutoCAD - MText

    Submitted By: kentw on 10/30/2017


  2. #2
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,658

    Default Re: MText width set to zero

    We should be able to set the width in Properties or simply drag the ruler in the editor to 0.
    In the Properties Palette below width set Columns to None and it will work.
    It's controlled by the system variable MTEXTCOLUMN.
    Last edited by Tom Beauford; 2017-11-01 at 05:03 PM.

  3. #3
    Member
    Join Date
    2003-02
    Posts
    6

    Default Re: MText width set to zero

    When an MText object is created with a defined width, it can only be changed (at least, on my system) by dragging the ruler, in the editor. It will only allow the width to be decreased to the same as the text height (then, the auto-wrap does it's thing and it's a big mess). The line for "Defined width", in the Properties dialog box, is greyed out and cannot be edited.

    Mtext Screen Shot.jpg

    When I create an MText object, I don't want a defined width. I find the auto-wrap feature quite irritating, most of the time, so I set the width to zero, to bypass it. To do this, I have to enter "w" then "0" EVERY TIME (after picking the origin and setting the justification). Being able to set the width, via a system variable, would safe me a LOT of keystrokes. The MTEXTCOLUMN system variable does not appear to affect this, in any way.

  4. #4
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714

    Default Re: MText width set to zero

    In the above image, you can't change the width as your selection also includes one or more MText entities with Columns - as Tom aptly described Columns must be set to None, then you can set for 0 width.

    This may help to expedite the setting of Columns to None:

    [Edit] - As well as set Width to 0.

    Code:
    (vl-load-com)
    
    (defun c:MtextColumnsOffZeroWidth (/ *error* ss acDoc i e)
    
      (defun *error* (msg)
        (if s
          (vla-delete s)
        )
        (if acDoc
          (vla-endundomark acDoc)
        )
        (cond ((not msg))                                                   ; Normal exit
              ((member msg '("Function cancelled" "quit / exit abort")))    ; <esc> or (quit)
              ((princ (strcat "\n** Error: " msg " ** ")))                  ; Fatal error, display it
        )
        (princ)
      )
    
      (if (setq ss (ssget "_:L" '((0 . "MTEXT"))))    
        (progn
          (vla-startundomark
            (setq acDoc (vla-get-activedocument (vlax-get-acad-object)))
          )
          (repeat (setq i (sslength ss))
            (setq e (entget (ssname ss (setq i (1- i))))
                  e (append e '((75 . 0)))
                  e (subst '(41 . 0.0) (assoc 41 e) e)
            )
            (entmod e)
          )
        )
      )
      (*error* nil)
    )
    
    (princ)

    Cheers
    Last edited by BlackBox; 2017-11-01 at 07:56 PM. Reason: Code updated for MText width.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  5. #5
    Member
    Join Date
    2003-02
    Posts
    6

    Default Re: MText width set to zero

    BlackBox,

    You're right, on the screenshot. But, with the MTEXTCOLUMN set to "2" (stock setting), the "Defined width" box is greyed out, even if there is only one object selected. I only had multiple selected to show the grips. I'll do better, next time.

    For some reason, I followed your explanation, about the columns, better than Toms (my issue, not his). After setting columns to none (MTEXTCOLUMN "0"), the "Defined width" is editable. That will help, but when editing a drawing, with MTEXTCOLUMN set to "2", it is a rather long-winded and cumbersome process to change the columns then the width. The "expert bar" at AU, last year, didn't know this workaround. I'll try out your lisp, to save some time. Thanks.

    The real time-saver, for me, would be the ability to have the width set to zero, statically, to keep me from having to go thru the keystrokes for every MText object I create. The AU experts didn't have an answer for this, either.

    Thanks for the help

  6. #6
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714

    Default Re: MText width set to zero

    Quote Originally Posted by kentw View Post
    You're right, on the screenshot. But, with the MTEXTCOLUMN set to "2" (stock setting), the "Defined width" box is greyed out, even if there is only one object selected. I only had multiple selected to show the grips. I'll do better, next time.
    Correct.

    Give the MTEXTCOLUMN sysvar another read in SYSVDLG, and see if you spot the irony at play here.

    Problem is that the sysvar value only determines the entity settings at creation, and not after the fact - meaning, once an MText entity is created with columns, changing the sysvar doesn't 'change' anything, except the entities created thereafter.

    Quote Originally Posted by kentw View Post
    For some reason, I followed your explanation, about the columns, better than Toms (my issue, not his). After setting columns to none (MTEXTCOLUMN "0"), the "Defined width" is editable. That will help, but when editing a drawing, with MTEXTCOLUMN set to "2", it is a rather long-winded and cumbersome process to change the columns then the width. The "expert bar" at AU, last year, didn't know this workaround. I'll try out your lisp, to save some time. Thanks.

    The real time-saver, for me, would be the ability to have the width set to zero, statically, to keep me from having to go thru the keystrokes for every MText object I create. The AU experts didn't have an answer for this, either.

    Thanks for the help
    No worries; I read a lot, and by that I mean I frequently have to read things 2-3 times myself. Haha

    This is one of those times where setting this sysvar in Acad.lsp is my preference (to speed up drawing open, because it's Registry-saved, for Drawing saved sysvars, set them in AcadDoc.lsp).

    The revised code above, will now also set the MText Width to zero (0).


    Cheers
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

Posting Permissions

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