Add prefix if Mtext is number

Add prefix if Mtext is number

mmouvet
Contributor Contributor
4,601 Views
8 Replies
Message 1 of 9

Add prefix if Mtext is number

mmouvet
Contributor
Contributor

Hello, I'm working on a project that requires 2 sets of notes on the same level, but for demolition and proposed works phases. 

The engineer has asked for demolition notes with a D prefix to the note numbers:

 

D1   Prior to any demolition....

D2   Provide temporary...

 

And so forth.

 

The proposed works notes have a similar prefix;

P1   All works to be arranged....

P2   ...

 

The engineer requires this distinction between notes, as they are called out on the plan as See Note D3, See Note P5, etc.

 

I've spent an hour looking for solutions but come up blank. 

I'm hopeful someone can help. Thanks.

0 Likes
Accepted solutions (1)
4,602 Views
8 Replies
Replies (8)
Message 2 of 9

JFN_KSH
Advocate
Advocate

Typically I use the bullet numbering tool from the mtext editor... But in your case, maybe it would be simpler to just type the require prefix & number (manually) and then use the tab function (you can adjust the width to your desire)....

Message 3 of 9

Kent1Cooper
Consultant
Consultant

Are those notes separate Text objects?  Or are [for example] D1 and D2 parts of the same Mtext object?  The former wouldn't be too hard to work with.  The latter would also be imaginable, but more complex -- a routine could search for new-line characters followed immediately by numerical characters, if there would never be any instance of such a combination that you don't  want to have the letter prefix added to.  But if the Mtext might have any internal formatting overrides, the code characters for those sometimes come before the first text-content character, which would make it a lot more difficult....

Kent Cooper, AIA
0 Likes
Message 4 of 9

john.vellek
Alumni
Alumni

Hi @mmouvet,

 

The numbering of lists in MTEXT is not terribly flexible.  You might check the add-ins in the Autodesk App Store. It looks like there a couple there that might allow you to do this.

 

 

Please select the Accept as Solution button if my post solves your issue or answers your question.


John Vellek


Join the Autodesk Customer Council - Interact with developers, provide feedback on current and future software releases, and beta test the latest software!

Autodesk Knowledge Network | Autodesk Account | Product Feedback
Message 5 of 9

Kent1Cooper
Consultant
Consultant

Looking at others' Replies, I'm starting to wonder....  Are you talking about adding a letter prefix to leading numbers in existing already-drawn  notes [my assumption, from the Subject line], or some kind of automatically prefixing in the process of drawing  notes [apparently what some assume, from talk of bullets]?

Kent Cooper, AIA
0 Likes
Message 6 of 9

elshawadfy
Collaborator
Collaborator
Accepted solution

A work around would be to:

 

If the text hasn't already been written in an MText:

   - Write the text in word,

   - Give it the custom numbering you want,

   - Copy it "INSIDE" an mtext..

 

If the text is written in an MText:

   - copy it from inside the MText to word,

   - If it's white change it to automatic to be visible,

   - Add the custom numbering you want,

   - Then copy it back to Autocad "INSIDE" an MText object..

 

Regards..

Message 7 of 9

Kent1Cooper
Consultant
Consultant

@Kent1Cooper wrote:

Are those notes separate [I should have said M]Text objects?  .... wouldn't be too hard to work with. ....


For instance, in simplest terms, and provided they start with a number and not any internal-override formatting characters:

(SETQ
  ss (ssget '((0 . "MTEXT")))
  pre (getstring "\nPrefix to add before initial number(s): ")
)
(repeat (setq n (sslength ss))
  (setq tent (ssname ss (setq n (1- n))))
  (if
    (wcmatch
      (setq str (vla-get-TextString (setq tobj (vlax-ename->vla-object tent))))
      "#*" ; starts with numerical character
    )
    (vla-put-TextString tobj (strcat pre str))
  )
)

You can also select a bunch of stuff that may include Mtext objects that don't  start with a number, and they'll be left alone.

Kent Cooper, AIA
Message 8 of 9

john.vellek
Alumni
Alumni

Hi @mmouvet,

 

I am checking back to see if my post or others helped you with your problem. You have received some great suggestions on how to make this work. Please mark a post or posts as accepted solutions if they resolved the issue or give me a bit more detail on this issue so we can continue to work towards getting this solved.

 

 

 

Please hit the Accept as Solution button if a post or posts solves your issue or answers your question.


John Vellek


Join the Autodesk Customer Council - Interact with developers, provide feedback on current and future software releases, and beta test the latest software!

Autodesk Knowledge Network | Autodesk Account | Product Feedback
0 Likes
Message 9 of 9

mmouvet
Contributor
Contributor

Seems I posted this a few weeks ago, and must have slipped under the radar (was expecting email notifications of replies). 

There really isn't anything here I haven't explored, except for the App Store. Found some good ones, thanks. 

The MText editor is fairly rigid, when compared to dedicated text editors like Word. but I think there might be room for some added features (like custom bulleting). 

 

Thanks for everyones answers and patience.

0 Likes