You can use the add-on application **NumInText** to perform operations on numbers written inside AutoCAD drawing objects - texts and block attributes.
It works both on purely numerical texts and on numbers contained in longer texts and MTexts.
You can round the numbers (also in non-standard steps like 0.5), add (or subtract) constant values to them, multiply (or divide) them by a constant value, left- or right-fill them to a fixed number of digits, cut off higher orders, add prefix or suffix, keep minimum/maximum, keep leading zeroes, or delete the numbers. The application can also handle numbers combined with MText control codes.

Load the NumInText.VLX file into your AutoCAD drawing.
You can load it automatically using ACAD.LSP/ACADDOC.LSP or with the _APPLOAD command (drag it to the briefcase icon).
Start the function with the `NUMINTEXT` command.

You can use the `CADSTUDIO` command to list all loaded CAD Studio LISP utilities. The `CADSTUDIOREG` command allows to authorize the trial version of NumInText and unlock all its functions.

After you select the texts to process (or confirm All), the application prompts for the requested operation or Setup.
In the setup options you can set
the processing of "comma" (not only "dot") as the decimal separator, whether to ignore integers (process just real numbers), whether to round to full decimal places (use trailing zeroes) or keep any leading zeroes (in an attempt to keep constant length),
whether to keep the original number of decimal places (or round them) inside the arithmetic operations, whether to avoid numerical parameters in MText control codes,
or whether to process just filtered^{*} numbers inside a given range of values (e.g. -9.9 to +9.9) or in attributes matching a tag mask (you can specify the mask using wildcards or by picking a sample attribute).
You can also process just the Nth number in each selected text (0=all).

You can paste the report of all performed replacements with Ctrl+V to AutoCAD or any other application.

You can use the following operations to process the matching numbers:

**Add**- add (or subtract, negative value) the given value to the numbers in drawing texts**Multiply**^{*}- multiply (or divide, the 1/x value) the numbers in drawing texts by the given value - e.g. with a conversion rate of length units (mm/inch)**Round**- you can enter the number of requested decimal places to round real numbers in the selected texts (0=integer, a negative number means higher places - '-2'=100). The rounding options^{*}Stepped, Up and Down allow to round the number in arbitrary steps (e.g. 0.25, 0.5 or 100) - you can round arithmetically, always up or always down.**FixedLength**- fill the number from the left side with leading zeroes to the specified^{*}total number of digits, if you specify the number of digits as negative, the zeroes are added from the right side (trailing decimal zeroes)**LeftCut**^{*}- cuts of higher orders from the number, e.g. by entering "100", the thousands and higher orders will be cut off**Pfix**^{*}- adds a specified prefix and/or suffix to the numbers - e.g. physical units**Min of**- changes the numbers to a specified minimum (if they are smaller)**Max of**- changes the numbers to a specified maximum (if they are larger)**User operation**^{*}- you can define your own function to apply on the numbers (`NumInTextUser(n)`)**Separator**- you can replace the decimal separator with e.g. a comma "," or space " ", you can also use a special "station" formatting ("KM 12+345 6").**Delete**- erase the numbers in drawing texts or replace^{*}them with the specified string, either with a single string for the whole number, or with a character replacing each digit individually

If you repeat the last operation by pressing Enter, its parameters are not prompted again. Use the specific option to re-prompt for parameters.

You can use these LISP variables to preset some application parameters (from Setup):

(setq _numintextDoComma T) ; respect decimal comma (setq _numintextDoInts T) ; process also integers (setq _numintextDecimals 2) ; default number of decimal places (setq _numintextNoKeepDP T) ; do not keep the original number of dec.places for math ops (setq _numintextOrder 1) ; process just the Nth number in each text (0 = all) (setq _numintextTextMask "A*") ; text value mask (setq _numintextTagMask "A*") ; attribute tag mask (setq _numintextRoundMode "Stepped") ; rounding mode (setq _numintextRoundTo 0.5) ; round step in stepped modes (setq _numintextRoundToDP -2) ; round decimals in stepped modes (setq _numintextSafeMText T) ; avoid changing MText codes (setq _numintextNoTrail0 T) ; do not add trailing "0" (full dec.places) (setq _numintextNoLead0 T) ; do not keep leading zeroes (fixed lengths) (setq _numintextPrefix "") ; prefix (setq _numintextPostfix "") ; suffix (setq _numintextDPsep "") ; or "STATION" (setq _numintextNoClipboard T) ; do not use Clipboard for reports

Most of the NumInText functions are available in the freeware (trial) version, some functions (marked here with ^{*}) require an activation code which can be purchased on CAD eShop. See the CADSTUDIOREG command.

- Version 1.5 (10/2023) text mask, select
- Version 1.4 (10/2022) dialog settings, added Min/Max operators and custom user function, added leading zeroes option, added 'just Nth number' option
- Version 1.3 (2/2017) options renamed, fixes negative numbers, fixed non-numbers, trailing zeroes, default values, repeated operations, prefix/suffix, station, pick attribute
- Version 1.2 (2/2017) attr.tag mask, avoid MText controls, session options, report of replacements, fixed bug in multiple replacements
- Version 1.1 (2/2017) fixdigits, stepped rounding, cut, separator, authorization
- Version 1.0 (1/2017) initial version.

The CAD Studio NumInText tool was tested in AutoCAD versions 2015 to 2024. It runs also in all AutoCAD "verticals" (industry-specific versions).

Be careful with the Integer option and MTexts (and also some operations on Reals) - you may inadvertently modify some of the invisible control codes.
E.g. the MText contents `\\A1;is {\\H0.9x;2}m{\\H0.7x;\\S2^;}` may become `\\A1;is {\\H1.0x;2}m{\\H1.0x;\\S2^;}` changing the text and index size.

Replacing the decimal separator with e.g. a space will make two separate numbers, the original numeric value is lost.

Please send possible questions, proposals and problems to: support@cadstudio.cz.

The free/trial version of NumInText does not offer some of the processing functions.

** Download trial CAD Studio NumInText**