Author Topic: Text to Mtext and change width to 0  (Read 4064 times)

0 Members and 1 Guest are viewing this topic.

T-Square

  • Guest
Text to Mtext and change width to 0
« on: May 31, 2012, 02:57:48 PM »
Hello all... Especially CAB. Still owe you that beer my man.

Back in the cubicleized world of regular employment. ughhhh

I am using the Express tools to convert text to mtext. Problem is the annoyance of it defining a width. I would like to change the width to 0...via the conversion process. I am not familiar with VL and have never claimed to be a coder, hurts my head. :-)

Any help would be suuuuweeet.

Thanks a bunch folks. Here is what I am using.

Code: [Select]
(defun c:T2M (/)
(INITERR)
(setvar "CMDECHO" 0)
(command ".undo" "end")
(command ".undo" "m")
(setq SNM (getvar "SNAPMODE"))
(setvar "SNAPMODE" 0)
;;;
(graphscr)
;;;
(setq ss (ssget (list (cons 0 "TEXT"))))
(setq i -1)
(if ss
(repeat (sslength ss)
(setq elist (cdr (assoc -1 (entget (ssname ss (setq i (1+ i)))))))
(command "TXT2MTXT" elist ""); Express Tools command
)
)
;;;
(setvar "OSMODE" OSM)
;;;
(command ".undo" "end")
(RESET)
(princ)
)

jvillarreal

  • Bull Frog
  • Posts: 332
Re: Text to Mtext and change width to 0
« Reply #1 on: May 31, 2012, 03:02:48 PM »
Seems like you need to turn off the word wrap option.

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Text to Mtext and change width to 0
« Reply #2 on: May 31, 2012, 03:15:10 PM »
You could just filter your text objects and define the width in the properties palette.

Also look at this .. perhaps it will help you out.
http://www.theswamp.org/index.php?topic=35607.0

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

T-Square

  • Guest
Re: Text to Mtext and change width to 0
« Reply #3 on: May 31, 2012, 03:35:12 PM »
Hello,

I am not certain that is what I am looking for. When I do the conversion from plain text to mtext, the new mtext has a defined width. I'd like the defined width to be set to 0...no defined width. Right now I go into the properties palette and change the defined width to 0. Is there a way to combine the conversion of the text to mtext and define the new mtext width to 0?

Thanks.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Text to Mtext and change width to 0
« Reply #4 on: May 31, 2012, 03:39:27 PM »
Another one
http://www.theswamp.org/index.php?topic=30451.0  txt2mtxt w/ copy option LeeMac
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.

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Text to Mtext and change width to 0
« Reply #5 on: May 31, 2012, 03:45:09 PM »
Try this:
Code: [Select]
(defun c:t2m (/ chk e i ss)
  (if (setq ss (ssget ":L" (list (cons 0 "TEXT"))))
    (progn (setq i (sslength ss))
   (repeat (sslength ss)
     (setq chk (entlast))
     (setq e (ssname ss (setq i (1- i))))
     (command "TXT2MTXT" e "") ; Express Tools command
     (and (not (equal chk (setq e (entlast))))
  (entmod (subst (cons 41 0.0) (assoc 41 (entget e)) (entget e)))
     )
   )
    )
  )
)
« Last Edit: May 31, 2012, 04:01:04 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Text to Mtext and change width to 0
« Reply #6 on: May 31, 2012, 03:49:10 PM »
Here is one that I have used in-house but may not be fully tested.
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.

T-Square

  • Guest
Re: Text to Mtext and change width to 0
« Reply #7 on: May 31, 2012, 03:56:04 PM »
Ronjop,

Thanks. It errors with:

Error: bad argument type: lselsetp nil

I forgot to mention I am using AC2008. Going backwards is painful. I did (vl-load-com) after the defun.

I tried earlier to use some vl code, but I am just a hack. I wish I could afford the time to learn vl. The terminology is easier to decipher what it's doing. i.e. "vla-put-width"

Too much time driving 50+ miles to work...one way. uggghhhhh....

Tim

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Text to Mtext and change width to 0
« Reply #8 on: May 31, 2012, 03:59:21 PM »
Try it again ... had a typo.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Dave M

  • Newt
  • Posts: 196
Re: Text to Mtext and change width to 0
« Reply #9 on: May 31, 2012, 04:29:39 PM »
Check out the routine in this link, it's what I use and I think it's great

http://www.cadalyst.com/management/tips-amp-tools-weekly-vol-16-no-33-14065

Cheers
Civil 3D 2018 - Microstation SS4 - Windows 10 - Dropbox

T-Square

  • Guest
Re: Text to Mtext and change width to 0
« Reply #10 on: May 31, 2012, 06:26:18 PM »
jvillarreal,

I did not know there was the "word wrap" in the options. That is what I needed. Ok, so is that a registry saved option or is it drawing saved? I can't...or am not allowed to get to the "Express tools" help file. They have this CAD install locked down and doing some funky stuff.

Ronjop,

That worked. Mobetta. Thanks a lot. One of those annoying things you do umpteen million times a day.

CAB,

Still using some of your routines for my everyday production. Man if I knew how to code I could be freaking dangerous. hahahah Maybe someday.

--

This set up here at this office is server based licenses and loads of startup scripts. Sometimes customizations go too far in their attempt at making standards work. I am so old school. All these buttons get in the way. I only use the layer, styles, properties, workspaces and my one of my own custom toolbars. Everything else is done from ye ol command line. :-) I had AutoCAD just disappear this morning. Poof. Just gone. I can't even get the "mouse clicks" into the lowly custom.cui they give us. I hate "shift click" for my osnaps menu. Makes my pinky hurt after a long day of drawing. I like using running osnaps and then adding the ones I occasionally use to the top and bottom of the osnaps menu. Makes for easier selecting of them depending on where you initiate the popup on the screen.

Every drawing I get into has a different flava of the one standard we are all supposed to be using. It "was" nice being self employed. I could work in my own stuff. hahahaha

I will say this. I am just glad to have this job. Darn OCD just makes me want to fly through this stuff. hahahahah Are there any drawers that aren't OCD. hahahahaha....

Back to the lines and circles.

Thanks all.

T-Square

  • Guest
Re: Text to Mtext and change width to 0
« Reply #11 on: May 31, 2012, 07:14:03 PM »
ronjonp,

Ok. Never mind. It was working. Some really screwy "over" customized stuff here. Frustrating. Very frustrating.

Have an Excellent evening.

Tim

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Text to Mtext and change width to 0
« Reply #12 on: June 01, 2012, 08:29:25 AM »
ronjonp,

Ok. Never mind. It was working. Some really screwy "over" customized stuff here. Frustrating. Very frustrating.

Have an Excellent evening.

Tim

Glad to help  :-D

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC