In this Article...
The numbered texts issue
Once upon a time I was designing the fire detection system of a huge building in AutoCAD 2014. I had already spread hundreds of smoke detectors among the place, and besides each block symbolizing them I had to insert a text label saying “SD” (for smoke detector) and a specific number, to make them different from each other. Then, reaching smoke detector number 300, I realized I’d forgotten one in the beginning.
So I had to manually change almost 300 text objects to make the numbering appropriate, since each detector had to be named as a number progressing from the previous. Like “SD-01”, “SD-02”, “SD-03”…
It took me 3 hours.
Could that be done more easily?
Oh yes.
I always say working with multiple text objects in AutoCAD is a bit painful, but that occasion made me search for alternatives – and they always exist.
There is an express tools command you can use in situations where you have to assign an incrementing (or decrementing) numbering as prefixes, suffixes or even overwrites to the contents of multiple text objects in your drawing.
Let’s say you have a lot of texts (either texts or mtexts). In this example I have organized them vertically, like in the image above, but they could be spread in any direction (like my sad story about the smoke detectors).
What you have to do is use the Tcount command, which may seem complicated at first sight, but actually isn’t. Here’s how:
Step 1: select all of your texts (the order in which you select them may be important, you’ll just see):
Step 2: enter Tcount;
Step 3: select now the sorting of your texts – this step has tons of importance:
- If you choose “X”, the command will create a numbering in the horizontal order, from left to right, considering the X axis position of all of them.
- Analogously, the same go for the “Y” option, sorting in the Y axis.If you choose the “Select order” option, the numbering will be applied in the very order in selected your texts. So, if you click them one by one before entering the command, this order will be chosen if you select this option;
- If you choose the “Select order” option, the numbering will be applied in the very order in selected your texts. So, if you click them one by one before entering the command, this order will be chosen if you select this option;In this example I chose the “Y”
- In this example I chose the “Y” option, since my texts are displayed in a vertical way and I want to number them from top to bottom;
Step 4: specify now the starting number (which will be added to the first text of your selection order), and the increment from one number to the next (it can be negative), separating them both with a comma.
- For the example, I specified the starting number as 0 and the increment as -1;
Step 5: finally, choose where the numbering will be displayed in all texts:
- Overwrite: all texts contents will be erased and replaced by the numbering;
- Prefix: the number will be added before the text, separating them with a single space;
- Suffix: the number will be added after the text, also separating them with a single space;
- Find&Replace: with this option you can type a string (a part of what’s written in your texts) and it will be replaced by the numbering.
Step 6: gaze at the magical results.
For this example I used the Find&Replace option to replace the word “cad”. As you can see, in all texts objects this word was replaced with the appropriate numbering, starting from 0 and decreasing 1 unit per text. Nothing else from the text contents was altered.
What about multiple texts all spread?
That makes things a little harder, but not regarding using Tcount. It’s just harder to select all texts in the right order.
I recommend you don’t use Filter for this selection, because the selection order may be flawed. Unfortunately, this step is still pretty manual (but if you find a different way, please comment below)!
But there you go. Had I known this before, 3 hours of my life would’ve been spared of a tedious job.
I hope this help you with your numbering and labeling needs, and we’ll talk again in the next useful text related express tools command!
thank you for this powerful command and your good explanations