CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor and other Autodesk products []
Cesky English Deutsch
 Visitors: 2532 

CAD tip CAD tip # 11289:

Question CAD 
 %  platform  category 
Q - question

Adding, multiplying and rounding numbers inside DWG drawing texts.

A - answer 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, or delete the numbers. The application can also handle numbers combined with MText control codes.

You can download the add-on application CADstudio NumInText from, load it with APPLOAD and launch it by typing the command NumInText. After you select the texts to process, 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 integer numbers (process just real numbers), use trailing zeroes (full decimal places), whether to keep the original number of decimal places (or round them) inside the arithmetic operations, whether to avoid MText control codes, or whether to process just filtered numbers inside a given range of values (e.g. -9.9 to +9.9) or just attributes matching a given tag mask (the attribute can be picked).

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 orders - '-2'=100). The 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.
  • FixLength - 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
  • 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

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 _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 _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 require an activation code which can be purchased on CAD eShop. See the CADSTUDIOREG command.

More information on NumInText homepage.

See also the RoundT utility.

100% *  CAD 
31.1.2017    919x   FAQ  
Comments   Tell a friend
applies to: AutoCAD ·

See also:
Tip 10628:Ugly (jaggy) TrueType texts in DWG drawing.
Tip 10514:PDF published from AutoCAD 2016 has rectangles displayed around texts.
Tip 10497:Multileader with automatic text mask.
Tip 10416:How to fix/repair large 3D mesh models?
Tip 10167:Keyboard shortcuts in Autodesk Fusion 360.

Back   All CAD Tips All CAD tips&tricks

Iterative Move, Scale and Rotate - till boundary touch. « | » Selection cycling is not working in TRIM/EXTEND.

Have we helped you? If you want to support the CAD Forum web service, consider buying one of our CAD applications, or our custom software development offerings, or donating via PayPal (see above). You may also add a link to your web - like this "fan" link: CAD Forum - tips, utilities, blocks for Autodesk products
CAD:    OS:    Categ: 
Text:  FAQ glossary   

Increase your productivity with our set of BIM add-on functions for Autodesk Revit
CADstudio Revit Tools More info

Please use these tips at your own risk.
CAD Studio (Xanadu) is not responsible for possible problems that may occur as a result of using any of these tips.