Author Topic: MText stretch Column Width  (Read 1730 times)

0 Members and 1 Guest are viewing this topic.

Coder

  • Swamp Rat
  • Posts: 827
MText stretch Column Width
« on: June 16, 2011, 03:09:27 AM »
Hello .

I have many Mtexts in a dwg, and when I scaled the dwg 10 times , all MTexts become as if you entered the Mtext editor and pressed enter which caused one sentence of
string to be in three lines .

Is there a way to stretch the MText to fit the length of string (sentence) ?

My try seems does not work  :oops:

Code: [Select]
(setq ss (car (entsel "\n Select MText :")))
(setq wid (vla-put-Width (vlax-ename->vla-object ss) 1000.))

Thanks .

*EDIT* codes added .
« Last Edit: June 16, 2011, 03:37:03 AM by coder »

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: MText stretch Column Width
« Reply #1 on: June 16, 2011, 09:05:51 AM »
FYI it is standard practice to use ent as a variable name when the object is an entity and
to use ss when using a selection set.

My first thought is the following:
Code: [Select]
Get the mtext entity
Strip unwanted dxf code pairs
Use a parser to break the mtext string into sentences
Loop through to sentences and use TEXTBOX to get the width & the max width
Put the new width (entmod (substu (cons 42 <new width>) (assoc 42 elst) elst))


Or you could just set the width to zero & ACAD would do the rest.  8-)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Coder

  • Swamp Rat
  • Posts: 827
Re: MText stretch Column Width
« Reply #2 on: June 16, 2011, 01:07:47 PM »
Thank you CAB.

I will try to re-make the Mtext once again with a new width factor for it .

Appreciated.

danallen

  • Guest
Re: MText stretch Column Width
« Reply #3 on: June 16, 2011, 01:16:19 PM »
all MTexts become as if you entered the Mtext editor and pressed enter which caused one sentence of
string to be in three lines

That sounds like the line breaks need to be removed. Try StripMtext http://www.theswamp.org/index.php?topic=31584.0