Among the comments recently left on The CAD Geek was one asking if I could help them out with a script to sequentially number text. The solution is perhaps easier than one may think. In fact chances are, you already have such a tool at your fingertips. Housed within the infamous Express Tools is a command known as “Automatic Text Numbering”, or for the command line warriors – TCOUNT.
The TCOUNT command has a bunch of hidden secrets contained within it. Sure, it knows how to count 1, 2, 3, 4, 5, …, but what about 2, 4, 6, 8? Those writing cheers with AutoCAD will appreciate the fact the TCOUNT command can indeed do this.
Beyond that what other tricks does the TCOUNT command have up it’s sleeve? Well it also has the ability to prefix or suffix your text with a number, or of course replace it altogether. So enough talk, how does one use this hidden gem?
Sequentially Numbering Text
- Enter TCOUNT at the command line, or execute it from the “Express > Text > Automatic Text Numbering”
- Although the TCOUNT command allows you to window select text, I generally recommended selecting each piece of text individually.
- You will next be prompted to “Sort selected objects by”. If you happen to have neatly arranged text, the X or Y option may work for you. However a more common scenario is to have text scattered throughout my site, and thus the Select-order generally gets me more mileage.
- Next I’ll be prompted to Specify starting number and increment (Start, increment) <1,1>. The default is to start with 1, and step by 1. Thus under thus my first piece of text will be numbered 1, my second 2, etc… You could certainly change the increment to 2, and your first piece of text would be numbered 1, your second 3, your third 5, etc…
- Finally you will be asked Placement of numbers in text. In this case I want to replace my text with the respective number, although I can have the command prefix or suffix my text with the respective number.