Author Topic: Edit Column Width/Height for MText - has anyone figured this out?  (Read 4298 times)

0 Members and 1 Guest are viewing this topic.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
I generally use zero width text, so I hadn't noticed, but today I tried to change the width of some MText with my width editing routine and it didn't work. Has anyone come up with a way to edit the column width/height on MText (testing in v2011) in code?

vla-put-width no long works on MText. :(

Here's my width editing code:
Code: [Select]
(defun c:WD (/ ss wd)
  ;; Change width of selected MText and MultiLeader objects
  ;; Alan J. Thompson, 11.05.09
  (if (and (setq ss (ssget "_:L" '((0 . "MTEXT,MULTILEADER"))))
           (setq wd (initget 4)
                 wd (cond ((getdist "\nWidth <0.0>: "))
                          (0.)
                    )
           )
      )
    (progn
      (vlax-for x (setq ss (vla-get-activeselectionset
                             (cond (*AcadDoc*)
                                   ((setq *AcadDoc* (vla-get-activedocument
                                                      (vlax-get-acad-object)
                                                    )
                                    )
                                   )
                             )
                           )
                  )
        (vl-catch-all-apply
          (function vlax-put-property)
          (list x
                (cond ((eq (vla-get-objectname x) "AcDbMText") 'Width)
                      ((eq (vla-get-objectname x) "AcDbMLeader") 'TextWidth)
                )
                wd
          )
        )
      )
      (vla-delete ss)
    )
  )
  (princ)
)
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

mkweaver

  • Bull Frog
  • Posts: 352
Re: Edit Column Width/Height for MText - has anyone figured this out?
« Reply #1 on: November 17, 2011, 12:11:15 PM »
That is curious.

In 2012, even entmod doesn't work.  It appears to work - the returned list has the modified 41 value, but nothing changes on the entity:
Quote
(setq
  ent (car (entsel))
  elist (entget ent)
  test (entmod (subst (cons 41 (getdist)) (assoc 41 elist) elist))
  )
(princ (assoc 41 elist))
(princ (assoc 41 test))
(princ (assoc 41 (entget ent)))
((-1 . <Entity name: 7ffff60f660>) (0 . "MTEXT") (330 . <Entity name: 7ffff6039f0>) (5 . "509EE") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "20-LITE") (100 . "AcDbMText") (10 31.9157 -4.75434 0.0) (40 . 0.09375) (41 . 2.56575) (46 . 0.0) (71 . 1) (72 . 5) (1 . "This is a test") (7 . "Standard") (210 0.0 0.0 1.0) (11 1.0 0.0 0.0) (42 . 0.629464) (43 . 0.25) (50 . 0.0) (73 . 1) (44 . 1.0))
(41 . 0.821385)(41 . 0.821385)
(41 . 2.56575)(41 . 2.56575)
(41 . 2.56575)(41 . 2.56575)

So entmod accepts the change, the value changes, but there is no visible change in the object.  Even the properties palette still shows the old value.  I wonder if the width value is stored in xdata or a dictionary...

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Edit Column Width/Height for MText - has anyone figured this out?
« Reply #2 on: November 17, 2011, 12:13:45 PM »
Damn.
Yeah,
Code: [Select]
(vla-put-width (vlax-ename->vla-object (car (entsel))) 0.) doesn't throw an error, it just doesn't do anything.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Edit Column Width/Height for MText - has anyone figured this out?
« Reply #3 on: November 17, 2011, 12:14:38 PM »
Does an entupd or vla-update remedy?
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Edit Column Width/Height for MText - has anyone figured this out?
« Reply #4 on: November 17, 2011, 12:15:40 PM »
MTEXTCOLUMN = 0

With Dynamic Columns set, the MText width becomes read-only; set this to No Columns.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Edit Column Width/Height for MText - has anyone figured this out?
« Reply #5 on: November 17, 2011, 12:22:50 PM »
Does an entupd or vla-update remedy?
no dice.

MTEXTCOLUMN = 0

With Dynamic Columns set, the MText width becomes read-only; set this to No Columns.
Well I'll be damned. <adds setting change to acaddoc.lsp>
Of course, this doesn't help existing MText.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

eddybeerke

  • Mosquito
  • Posts: 2
Re: Edit Column Width/Height for MText - has anyone figured this out?
« Reply #6 on: March 08, 2018, 06:44:18 AM »
Is there a solution found?
In order to make a good use of the boundingbox (for blocks with mtext(s) in  it) i need to change the Columns to None and the Defined width to 0.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Edit Column Width/Height for MText - has anyone figured this out?
« Reply #7 on: March 08, 2018, 08:33:22 AM »
Is there a solution found?
In order to make a good use of the boundingbox (for blocks with mtext(s) in  it) i need to change the Columns to None and the Defined width to 0.

You can determine the bounding box surrounding MText content (not the MText frame) using DXF groups 42 & 43, you don't need to modify the MText width.