StripMtext v5.0

StripMtext v5 Copyright© Steve Doman and Joe Burke 2010

StripMtext is an AutoLISP program that runs inside AutoCAD 2000 and above and enables the AutoCAD user to quickly remove unwanted Mtext formatting embedded in Mtext, Mleaders, Dimensions, Tables, and Multiline Attributes.

Below are a few screen demonstrations of StripMtext in action.  Thanks to Lee Mac for making the demos.

Download StripMtext v5.0c
AutoCAD for Mac users: Sorry but StripMtext can not run on Mac systems.

If you cant see image, right click and follow link

Please right click here and follow link

Please right click here and follow link

Please right click here and follow link

85 thoughts on “StripMtext v5.0

  1. Pingback: MText – Back to Basics | Dirt Modelers

  2. Hi,
    I work at a consulting firm and we use MS Visio to draw our single line schematics and then saveas to dwg and import them into our CAD drawings. The only downside to this is that all of the mtext has overrides on color and height. So I’m trying to use your lisp routine and it’s not working :-s
    Most of the mtext contents will look somehting like \C7;\H.063321545;TEXT . There is one piece of mtext that the routine does work on however and the only difference on the contents is that this piece is surrounded by { } brackets for some reason.
    Is there something that I am doing wrong? Are those brackets always supposed to be there? PLS help 🙂
    -Jason

    • Hi Jason,

      Thanks for the message. I’m am always interested in fixing any problem user’s experience using StripMtext. I assume you are familiar with using AutoCAD commands and have viewed the demo on this blog for instruction on how to use StripMtext.

      The curly brackets are Mtext formatting characters which group a block of text which formatting is applied. They are very common and probably supposed to be there.

      StripMtext works by searching and removing specific formatting codes per AutoCAD’s Mtext formatting rules. My guess is that when Visio converts the file into DWG, the formatting codes Visio is using are not strictly following AutoCAD’s rules. However, if AutoCAD is rendering the formatting okay, then there may be some undocumented formatting syntax which I am unaware of.

      They best way for me to help is to run some test on a drawing created by Visio that contains Mtext. Please send a DWG to the email address shown on my about page. I can’t promise a quick fix. But I’ll do my best to help.

      Thanks,
      Steve

  3. Sorry to say that but StripMtext v5.0b just doesn’t work with Autocad 2000 (Polish version). When I say work, I think that all functions and procedures works according to author ideas. I have Acad2000 Polish version with full express tools. Whenever I try to run by “smt” or “stripmtext” I get error about bad string in ssget.
    I tried it on trial version Acad 2006 (full functionality, polish language version) and got this error too. Under 2006 I workaround the problem preparing own lsp script and trying to run SMT in script mode. It was for short while so I did only what I needed, and I didn’t dig in it to solve the problem completely. But I still only a beginner in lisp language.
    After some examinations I found that line: (if (and (setq ss (ssget “:L” ssfilter) … is sth that my Acad2000 can’t swallow. In help there is no info about “:L” switch.
    After removed “:L” it started to work but I don’t know if it is working according to author idea. Is it possible to make this script to fully work with 2000?
    Best regards.

  4. thank you so much for your tool

    I am still a dinosaur using r2000, but having to interface with others using much more recent versions. your tool has helped me with funny mtext formatting from other’s files.

  5. Pingback: ACAD: Убираем лишнее форматирование текста | Блог «НПО Прометей»

    • Спасибо, что написали ваш блог статью, чтобы помочь пользователям AutoCAD узнать о StripMtext.
      -Стив

      Thank you for writing your blog article to help AutoCAD users learn about StripMtext.
      -Steve

  6. Hello,
    I have downloaded this program because it is a great need for me but when i go to use it this comes up:

    stripMtext error: cannot load dcl file “stripmtext[3].dcl”

    I am using AutoCAD Architecture 2011….does your program work for this version? If so, is there anyway I can fix this error?

    • Hi Eeb Stder,

      You are using a very old version. I recommend downloading the latest version available by clicking on the link way above that says: “Download StripMtext v5.0c”.

  7. I have used StripMtext for many years and it has been very helpful. I recently received a DWG file that I believe came from Visio and StripMtext5.0c is not able to remove all of the formatting from the text. The text height formatting persists after running the lsp. Any thoughts?

    -Ethan

    • Hi Ethan,

      Thanks for the report. Please send a small sample drawing showing before and after resuls. I will do some testing as soon as possible. My email address is shown on the “about” page.

      Steve Doman

  8. Hi, I’ve downloaded the lsp file and loaded it via appload yet StripMText is not a command in my Autocad drawing. The appload status bar says that the lsp was loaded successfully. I am running Auto cad 2013 on a mac but am admittedly inexperienced in Autocad and primarily use Rhino.

    Any ideas on why the command is not available?

    Thank you for your time,

    Jackson

    • Hi Jackson,

      The reason the command is not available is because StripMtext is coded in VisualLisp and utilizes Windows specific functions, which are not available in AutoCAD for Mac.

      It might be possible to create a new Mac version of StripMtext, but since I have neither a Mac or AutoCAD for Mac, I am able to even try.

      There are other ways to remove Mtext formatting. AutoCAD has a method to remove formatting, albeit one mtext object at a time. Open the Mtext object in the Mtext Editor. Select all of the text in the editor, then right click and a menu will pop up with an option to remove formatting. This works for AutoCAD for Windows. Not sure about the Mac version.

      Thanks for the question. I’m sure other Mac users will appreciate this information. And I’m sorry for the really late reply. Been offline.

      Steve

  9. Hello,

    From what I’ve read this lsp file seems like it is exactly what I need. I have downloaded and loaded it into AutoCAD MEP 2013. When I call the “stripmtext” command, I am able to select the objects, but then the following message appears:

    Error in dialog file
    “C:\Users\MMOSBA~1\AppData\Local\Temp\SMT005.tmp”, line 2:
    warning: redefining object.
    Symbol: “stripmtext”.

    After clicking OK, the following message appears

    Error in dialog file
    “C:\Users\MMOSBA~1\AppData\Local\Temp\SMT005.tmp”, line 2:
    syntax error.
    Symbol: “stripmtext”.

    And then after clicking OK one more time, the following message appears:

    StripMText Error:
    Cannot load DCL file:
    C:\Users\MMOSBA~1\AppData\Local\Temp\SMT005.tmp

    The “SMT005” changes each time I try the command (ie – next time I try, it will be SMT006).

    Any help you may be able to offer is greatly appreciated.

    Best regards,
    Michael

    • Hi Michael,

      The SMT###.tmp files are temporary files that the StripMtext program creates each time the program is invoked. The temporary file contains code to draw a dialog box on the screen for the user to enter options. In StripMtext, this dialog displays format removal options. When StripMtext ends, it deletes the temporary file.

      I suspect that for some reason this temporary file has failed to be created. But it might be something else. Lets first rule out file making by checking if you have read and write access to your temp folder. Please do the following:

      (1) Reboot
      (2) Start AutoCAD and load StripMtext
      (3) Run StripMtext. When the error message is displayed, copy the path and file name.
      (4) Start Notepad and open the file name obtain from step 3.
      (5) If the file can be opened, try typing a few characters anywhere in the text and then save the file to a new unique file name and close the file. (You can type any characters anywhere in the file. We just want to make a change in the file and see it it can be written to disk.)

      Where you able to open the file, edit it, and save it?

      (6) Open the file you just saved. Are you changes present?

      If all the above steps are successful, then you must have read and write access. So next step is to please send me a copy of one of the unedited temp files for examining. Also please include which version of Windows you are running. My email address is on my About page.

      Thank you,
      Steve

  10. Hi Steve,
    Thank you very much for your great and useful utility!

    I use v5-0c.
    If it is executed against an annotative object in a paper space, the errors result:
    **The command is only allowed in model space**
    Object name: XXXXXXXX
    Unknown command: “SMT”. Press F1 for help.
    Unknown command: “ADD”. Press F1 for help.
    Unknown command: “1:1”. Press F1 for help.
    Unknown command: “SMT”. Press F1 for help.

    This will loop for each processed object.
    This is caused by line 1089: (command “._objectscale” ename “” “_Add” x “”)

    It is indeed should not be called in paper space.
    This could be fixed by adding the following function:

    (defun IsPaperSpace ( / active-document)
    (setq active-document (vla-get-ActiveDocument (vlax-get-acad-object)))
    (if (= (vla-get-ActiveSpace active-document) acPaperSpace) ;; A layout is active?
    (if (= (vla-get-MSpace active-document) :vlax-false) ;; Are we not in model space?
    T
    )
    )
    )

    and adding one more condition to (and) in lines 1080-1083 to become this:

    ((and
    (not (IsPaperSpace))
    (IsAnnotative ename)
    (setq sclst (GetAnnoScales ename))
    )

    Thank you!

    • Hi Mike,

      Thank you for the bug report and suggested solution.

      I know you’ve waited a long time for a reply. I’ve been busy remodeling my home and haven’t had a chance to code. But today I had a chance and can now say that an update is imminent. Please standby while we test the code.

      Thanks again.
      Steve

  11. Pingback: AutoCAD tip - fixing corrupt text

  12. Hi Steve Doman and Joe Burke. My greatest respects and thanks to you, I can only appreciate the beautiful minds you have. This is a serious programmer engineering piece of art. Personally I do program in VLISP, but not to that level, that´s the reason I´m amazed.
    Yours Sincerely
    Antonio Ruiz Romero – México

    • Hi Brad,
      AutoCAD users are free to use and modify StripMtext. It’s not permitted to incorporate the routine into another software product, or sell or exchange it for a fee. Thanks for asking.
      Steve

  13. This routine is what I am looking for but not quite. Saves a lot of time to manipulate embedded formatting of multiple Mtext objects without having to do it one at a time. Unfortunately, It doesn’t have the option to strip the bold formatting of an Mtext object. Can you please add this? Also is there an opposite routine where you can add embedded formatting to multiple Mtext objects simultaneously? Perhaps this can be combined with StripMtext and call it TextFormat. Thanks.

    • Hi Gigantor,

      StripMtext should strip bold formatting if “Font” is checked marked on the dialog window. What probably is not clear is that “Font” formats include “Bold” and “Italic”. Your question shows that the dialog needs to be more clear on this and I’ll try to improve that on the next update.

      Also, after testing just now due to your question, I see that “Strikethrough” formatting isn’t being stripped. Strikethrough formatting is rather new and I didn’t notice it until now. I’ll add that too to the next release when I get a chance.

      So please try again and let us know if that works for you. If it doesn’t, then please send me a small DWG file with an example of the Mtext you are trying to strip and I’ll drill down into it and see what going on. My email address can be found on my “About” page.

      Thanks for posting.
      Steve

    • Hi John,

      Thanks for posting. I thought this problem had been fixed a long time ago. Please be sure you are using the latest version of StripMtext. If you are, then please send a small sample drawing file I’ll do some sleuthing. The email address is shown on my About page.

      Thanks, Steve

  14. Thanks so much cadbyss for the lisp. It worked on my AutoCAD 2016. I’ve been searching for a tool to remove the text formatting within the curly brackets which I can’t remove manually except by formatting the text using the mtext dialog box. I did not know what caused it since the drawings were worked on by many people with different versions of ACAD. And you tool removed it like magic all at once and the default text style is now applied!

    Abd Muis

    • Hi Denisov,

      Please send a small example AutoCAD drawing that contains some of these multileaders and I’ll see what I can do. My email address is shown on my “About” page on this site.

      Steve

  15. Hi,
    I really appreciate you work. This tool is an every day lifesaver…
    But today I needed to strip the relatively new “strikethrough”-format from a bunch of MTexts.
    Thanks to your good code I was able to integrate it.
    Tested it & it works.
    I’ll send it to you by eMail.
    best regards,
    Marc Scherer

  16. Hi Guys,not sure that this applies on this forum, but my problem is:
    I have ONE PC that is connected to TWO displays (screens) and the issue is that if I open the SAME drawing the SAME TEXT font is DIFFERENT in each screen. Today I also noticed that the correct font that was previously only showing on my RIGHT screen is now only showing on my LEFT screen…. Any suggestions?

  17. I had issues also with the Height, file exported from Visio didn’t want to change the Height. And at the end I managed to change the code a little bit… now it works (hopefully there will not be problems with other strings…)

    (defun Height (str)
    ;; revised 6/6/2010
    ;(RE:Replace “” “\\\\H[0-9]?[.]?[0-9]+x;” str)
    ;; changed from original below
    ;(RE:Replace “” “\\\\H[0-9]*?[.]?[0-9]*?(x|X)+;” str)
    ;; My change (ChrisMedina 31-08-2018)
    (RE:Replace “” “\\\\H.*?;” str)

    • Just careful when copy/paste the code to replace it (the double apostrophe in the code is formatted from this page incorrectly, i suggest first to copy the code to notepad and replace the apostrophes with the correct one….

  18. Hi Steve, your StripMtext command is great and saves us A LOT of time. I was excited to see support for Mleaders in v5, but the v5.0c download is not removing the color override from mtext embedded in a multileader. Am I doing something wrong or expecting a function it is not intended to do?

  19. Using your lisp routine in AutoCAD Architecture 2017. Everything works except resetting the Text Height as defined in the Text Style. Has your routine been updated and tested to work on the latest versions 2017 and beyond?

  20. Hi,
    Thank you for this great tool!!!
    It makes my life easier 🙂

    Would it be possible to add a new Select type for Strike-through Text { \k } ?

    Thank you in advance!!!
    Henrik

  21. Hi,

    9 years later, the tool still works great in AutoCAD 2019.
    Thank you very much for this great and ingenious tool.

    Greetings from Austria.

    • Hi Thuan. Sorry for my very late reply. Somehow, I missed your message. I do have plans to revisit StripMtext in the near future to update it. I am not sure about adding a MATCHPROP feature. I would need to know more about how you would expect the routine to work. Let me know. Thank you for the feedback.

    • Hi Matthew,
      AutoCAD 2021 has introduced a bug that breaks StripMtext and other Autolisp routines that use Regular Expressions to search and replace text. I have reported the problem to Autodesk and their response is the error will be fixed hopefully in the next update. Meanwhile, the only work around I know is to set the system variable LISPSYS To 0 (zero). You will have to restart AutoCAD after setting the variable.
      HTH,
      Steve Doman

  22. your tool is awesome, but my client needs to clear the character format automatically. I developed a small program to clear that, but I can’t understand your code. forgive me I don’t know lsp language, so can you give me the regular character format expression? thank you very much.

    • StripMtext is open code and all the regular expressions for removing format codes are clearly readable. Sorry, I know it’s difficult to read code if you don’t understand the language. But I don’t know how to make it easier.

    • Hi Jason,
      If you are looking for instructions on how to load and start StripMtext, they are inside the lisp file. Just open the file in a text editor and read the comments.
      Steve

  23. Thank you!!!!
    You saved me from modifying the 5000+ points colours override.Thank you for making this and keeping it free!

  24. Is it possible to add returning annotative properties to this? Or is there another LISP out there to do that?

    • Hi Kent,

      Sorry, I don’t regularly use annotative objects so I don’t know what you mean by “add returning annotative properties”.

      StripMtext is designed to remove formatting embedded in mtext content and turn off certain properties like columns. It doesn’t add anything.

      Having said that, I remain open to updating StripMtext to applicable new ideas. Please enlighten me about the annotative subject and if it something that is consistent with what StripMtext does, then I’ll take a serious look at including that feature.

      Thanks, Steve.

  25. Thank you Steve Doman, Joe Burke and others involved. This routine saved me a large amount of time. I am very appreciative of you being willing to share your hard work with us common users.
    Best regards,

    • Hi DPof13f,

      Sorry StripMtext is not working for you. Tables are really complex objects. I can look into this if you send me a CAD file with an example of the table you are trying to strip formatting from. My email address is on my about page.

      Thanks,
      Steve

Leave a reply to Marek Marczyński Cancel reply