Author Topic: mtext to multileaders  (Read 4714 times)

0 Members and 1 Guest are viewing this topic.

yarnstormer

  • Guest
mtext to multileaders
« on: October 30, 2012, 08:20:06 AM »
Hi all,
I am a newbie here - and not a programmer. I do have many years of cad under my belt tho.
I'm in a drawing - running Civil 3d 2012. I have many labels that I am converting to multileader text. Right now they are dtext and separate leaders.

I have been converting them to multiline text first, then running the mt2ml lisp I found on the autocad forums. It works, but I have a couple of bugs that I am hoping someone here can help me with.

I am going sheet by sheet on paperspace tabs (66 of them). The drawing is drawn in model space but I prefer to go tab by tab and toggle to model space to keep organized. When I run the mt2ml command it scales the text to the viewport scale I guess...I have to set each one to 1 scale in the properties. If I run the command in the model space "tab" it does not scale them up like that.

Also, it puts all the text on one line so I have to double click it and rearrange everything. Can I set the width automatically somehow?

Other weirdness is it changes the centerline symbol to ?

Ideas? I don't have a lot of experience with multileaders so maybe there's some setting there I can mess with. I did manage to create a style so it would look *exactly* like it did before.

Here's the code...thanks in advance for any help you can provide!


(defun c:mt2ml ( / oobj nobj nstrg)
  (vl-load-com)
  (setq oobj (vlax-ename->vla-object (car (nentsel "\nSelect source text: "))))
  (if (= (vlax-get-property oobj 'ObjectName) "AcDbMText")
    (setq nstrg (vlax-get-property oobj 'TextString))
    (exit)      
    )
  (command "_MLEADER")
  (while (= 1 (logand (getvar "CMDACTIVE") 1)) (command PAUSE))
  (setq nobj (vlax-ename->vla-object (entlast)))
  (if (= (vlax-get-property nobj 'ObjectName) "AcDbMLeader")
    (vlax-put-property nobj 'TextString nstrg)
    (exit)      
    )
  (entdel (vlax-vla-object->ename oobj))
  (princ)
)
« Last Edit: October 30, 2012, 08:33:38 AM by yarnstormer »

ronjonp

  • Needs a day job
  • Posts: 7527
Re: mtext to multileaders
« Reply #1 on: October 30, 2012, 09:15:33 AM »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

yarnstormer

  • Guest
Re: mtext to multileaders
« Reply #2 on: October 30, 2012, 12:25:48 PM »
hm...works for me in a fresh drawing but in the file I'm working in now I get an error and everything disappears. I assume they are together somewhere.  :-)

I did figure out that I had my multiline text setting scaling to the viewport, set it to 1 and it's not rescaling them every time.

Here's the error I got with the txt2ml.

Command: TXT2ML

Select objects: 1 found

Select objects: 1 found, 2 total

Select objects: 1 found, 3 total

Select objects: 1 found, 4 total

Select objects:

Select leader to replace [Enter to pick new points]:
Select objects:
._mleader
Specify leader arrowhead location or [leader Landing first/Content
first/Options] <Options>:
Specify next point or [End] <End>:
Specify next point or [End] <End>:
Enter text: ; error: Automation Error. Description was not provided.
« Last Edit: October 30, 2012, 12:53:25 PM by yarnstormer »

ronjonp

  • Needs a day job
  • Posts: 7527
Re: mtext to multileaders
« Reply #3 on: October 30, 2012, 12:49:04 PM »
My guess is your current mleader style has content type set to either block or none rather than mtext. Can you post the drawing?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

yarnstormer

  • Guest
Re: mtext to multileaders
« Reply #4 on: October 30, 2012, 01:54:13 PM »
Nope it's set to mtext.
Here's the drawing. Excuse the missing xrefs.


ronjonp

  • Needs a day job
  • Posts: 7527
Re: mtext to multileaders
« Reply #5 on: October 30, 2012, 03:13:30 PM »
Try this version. I removed the command call.


Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

yarnstormer

  • Guest
Re: mtext to multileaders
« Reply #6 on: October 30, 2012, 03:39:46 PM »
That did it! It rotates them but that's a good thing because I can tell which ones I have fixed in each view...can pick them all and set to 0 when I'm done. I assume it's some setting I have or how the rotated views are setup. in this office we rotate the ucs to rotate views. That is new to me.

Only 42 more pages to go...now they will go much faster. Thanks for your help!

ronjonp

  • Needs a day job
  • Posts: 7527
Re: mtext to multileaders
« Reply #7 on: October 30, 2012, 04:22:16 PM »
Glad to help :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC