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:
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.
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