AutoCAD Sum Numbers in Text LISP: Total, Average, Min, Max
Adds up the numbers in selected texts, reports average, minimum and maximum, and can write the total into the drawing.
TXTSUMLoad the downloaded .lsp file with the APPLOAD command in AutoCAD or GstarCAD, then type the command name. How to load a LISP file
Download all tools in one file (138 KB)TXTSUM is an AutoCAD sum numbers in text LISP that adds up the numbers written in your drawing. Instead of typing room areas, elevations, load labels or quantity notes into a calculator, select the texts and get the total, average, minimum and maximum directly.
The first number in each text is used, so 'Living room 26.4 sq m' gives 26.4. Both a decimal point and a decimal comma are accepted, and a leading minus sign is respected. Texts without a number are skipped and the count of skipped texts is reported. After the results are shown, click a point to write the total into the drawing with the current text height and layer, or press Enter to skip.
How to use it
- Load txtsum.lsp with APPLOAD and run TXTSUM.
- Select the TEXT and MTEXT objects that contain numbers and press Enter.
- Read the count, total, average, minimum and maximum on the command line.
- Click a point to write the total into the drawing, or press Enter to skip.
Notes and tips
- Only the first number in each text is read, so '2x36W' gives 2.
- Numbers with thousands separators are misread: '1,250.50' is taken as 1.25. Remove thousands separators first.
- In formatted MTEXT, digits inside formatting codes (font, height) can be picked up; plain TEXT or unformatted MTEXT gives reliable results. Block attributes and dimensions are not selected.
Frequently asked questions
Can I use it to add up room areas?
Yes. Select labels like 'Kitchen 135 sq ft' and the first number in each is used. If a label contains another number before the area, such as a room number, that number is taken instead, so make sure the area comes first.
How is the total written into the drawing?
As a single-line TEXT at the current TEXTSIZE on the current layer, with no decimals if the total is a whole number and two decimals otherwise.