How to Select Text Boxes That Only Contain Spaces and Delete Them

How to Select Text Boxes That Only Contain Spaces and Delete Them

ChrisHuK22QT
Explorer Explorer
907 Views
7 Replies
Message 1 of 8

How to Select Text Boxes That Only Contain Spaces and Delete Them

ChrisHuK22QT
Explorer
Explorer

I have several drawings that contain a lot of text boxes, only containing spaces, and I was wondering if there is an easy way to select and remove them.  I have only noticed this in Autocad 2025 and not in 2023. They also disappear as you zoom in, so it is hard to select with precision in some areas.

0 Likes
Accepted solutions (1)
908 Views
7 Replies
Replies (7)
Message 2 of 8

CGBenner
Community Manager
Community Manager

@ChrisHuK22QT 

Hello, and welcome!

Were these drawings translated from another CAD system?

Try this:  Type QTEXT and turn it on (set value to 1), do these entities turn to actual boxes?  If you edit one does it come up as empty text?  If so, you can simply select with a window and delete.

 

Did you find a post helpful? Then feel free to give likes to these posts!
Did your question get successfully answered? Then just click on the 'Accept solution' button.  Thanks and Enjoy!


Chris Benner
Community Manager

Message 3 of 8

Brock_Olly
Collaborator
Collaborator
Accepted solution

Since there's thousands, try this:
> QTEXT ON like CGBenner said
> FILTER
> click 'Add selected object <' and select one of the empty text objects
You get a list of filters like this:

Brock_Olly_0-1743681735105.png


>Deselect everything except 'Text Value' and 'Object' with delete button so it looks like this:

Brock_Olly_1-1743681803269.png

> Click 'Apply'
> While still in the command, type 'ALL'
This selects all empty text objects
>Press ENTER again to exit out the filter command
>Press DELETE

Brock_Olly_2-1743681858156.png

 


Now that I'm done writing this I realise you can also use QSELECT command, it's a bit easier to use:

  • Type QSELECT and press Enter.

  • Set these options:

    • Object Type: MText (or Text for single-line text).

    • Properties: Contents

    • Operator: = Equals

    • Value: (Press Space once and leave it blank)

  • Click OK—AutoCAD will select all text objects containing only spaces.

  • Press Delete to remove them.

 

 


 

Message 4 of 8

ChrisHuK22QT
Explorer
Explorer

@CGBenner 

 

Thanks for the response.

 

I am not sure if they originated from another CAD software unforently.

 

I tried the QTEXT command, and it looks like it has changed to entries that show up with rectangles, but not all. This doesn't affect the plot, just more annoying than anything.  But I approached the help.

 

I attached two pictures at different zoom levels, showing some still disappearing from view, and one with the contents shown.

 

What is also odd is that once I edited the text with TEXTEDIT, it now shows with QTEXT with an outline.

0 Likes
Message 5 of 8

CGBenner
Community Manager
Community Manager

@ChrisHuK22QT 

I saw this probably 30 years ago with AutoCAD files that had originated in MicroStation and were sent to me as a .dxf.  Once identifying that these are empty text entities, they can simply be erased.  I'm not sure of any fast automatic way to do it, I always just manually erased them.  Sometimes there were thousands of them in a single drawing file.

Did you find a post helpful? Then feel free to give likes to these posts!
Did your question get successfully answered? Then just click on the 'Accept solution' button.  Thanks and Enjoy!


Chris Benner
Community Manager

0 Likes
Message 6 of 8

ChrisHuK22QT
Explorer
Explorer

Thanks for the help, everyone @Brock_Olly this helps make it go faster, and now I know a new tool.

0 Likes
Message 7 of 8

Kent1Cooper
Consultant
Consultant

You have some with a space character, and some with no contents, i.e. an empty string [there's a difference].  This will get rid of all Text objects with empty string contents [in the current space]:

(command "_.erase" (ssget "_X" '((0 . "TEXT") (1 . ""))) "")
and this all of them with a single space:
(command "_.erase" (ssget "_X" '((0 . "TEXT") (1 . " "))) "")
You could continue with the more-than-one-space equivalents -- I didn't get any when I did that.
Unfortunately, you also have some "empty" Mtext that isn't really empty, with only some formatting characters and no visible content, but because of the formatting, the "contents" string isn't empty, so (ssget) won't be able to find them in the same way as it does above for Text.
Kent Cooper, AIA
Message 8 of 8

gbattinPH5TG
Advocate
Advocate

The PURGE command has an option for empty texts as well.

 

Empty Text Purge.png